entities
list
max_stars_repo_path
stringlengths
6
131
max_stars_repo_name
stringlengths
9
67
max_stars_count
int64
0
17k
content
stringlengths
25
1M
id
stringlengths
1
5
new_content
stringlengths
17
1M
modified
bool
1 class
references
stringlengths
32
1M
[ { "context": "ck)\n\n -- GStreamer\n -- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>\n -- * 200", "end": 2607, "score": 0.9998767971992493, "start": 2592, "tag": "NAME", "value": "Erik Walthinsen" }, { "context": "r\n -- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>\n -- * 2005 Wim Taymans <wim@", "end": 2626, "score": 0.999932050704956, "start": 2609, "tag": "EMAIL", "value": "omega@cse.ogi.edu" }, { "context": "<omega@cse.ogi.edu>\n -- * 2005 Wim Taymans <wim@fluendo.com>\n -- *\n -- * This library is f", "end": 2670, "score": 0.9998776316642761, "start": 2659, "tag": "NAME", "value": "Wim Taymans" }, { "context": ".edu>\n -- * 2005 Wim Taymans <wim@fluendo.com>\n -- *\n -- * This library is free software; you", "end": 2687, "score": 0.9999331831932068, "start": 2672, "tag": "EMAIL", "value": "wim@fluendo.com" } ]
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_base_gstbasetransform_h.ads
persan/A-gst
1
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.gstreamer_0_10_gst_gstelement_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h; -- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h; with System; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h; with glib; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbasetransform_h is -- unsupported macro: GST_TYPE_BASE_TRANSFORM (gst_base_transform_get_type()) -- arg-macro: function GST_BASE_TRANSFORM (obj) -- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_TRANSFORM,GstBaseTransform); -- arg-macro: function GST_BASE_TRANSFORM_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_TRANSFORM,GstBaseTransformClass); -- arg-macro: function GST_BASE_TRANSFORM_GET_CLASS (obj) -- return G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_TRANSFORM,GstBaseTransformClass); -- arg-macro: function GST_IS_BASE_TRANSFORM (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_TRANSFORM); -- arg-macro: function GST_IS_BASE_TRANSFORM_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_TRANSFORM); -- arg-macro: function GST_BASE_TRANSFORM_CAST (obj) -- return (GstBaseTransform *)(obj); GST_BASE_TRANSFORM_SINK_NAME : aliased constant String := "sink" & ASCII.NUL; -- gst/base/gstbasetransform.h:42 GST_BASE_TRANSFORM_SRC_NAME : aliased constant String := "src" & ASCII.NUL; -- gst/base/gstbasetransform.h:48 -- arg-macro: function GST_BASE_TRANSFORM_SRC_PAD (obj) -- return GST_BASE_TRANSFORM_CAST (obj).srcpad; -- arg-macro: function GST_BASE_TRANSFORM_SINK_PAD (obj) -- return GST_BASE_TRANSFORM_CAST (obj).sinkpad; -- unsupported macro: GST_BASE_TRANSFORM_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS -- arg-macro: procedure GST_BASE_TRANSFORM_LOCK (obj) -- g_mutex_lock (GST_BASE_TRANSFORM_CAST (obj).transform_lock) -- arg-macro: procedure GST_BASE_TRANSFORM_UNLOCK (obj) -- g_mutex_unlock (GST_BASE_TRANSFORM_CAST (obj).transform_lock) -- GStreamer -- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> -- * 2005 Wim Taymans <wim@fluendo.com> -- * -- * 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. -- -- since 0.10.4 --* -- * GST_BASE_TRANSFORM_SINK_NAME: -- * -- * The name of the templates for the sink pad. -- --* -- * GST_BASE_TRANSFORM_SRC_NAME: -- * -- * The name of the templates for the source pad. -- --* -- * GST_BASE_TRANSFORM_SRC_PAD: -- * @obj: base transform instance -- * -- * Gives the pointer to the source #GstPad object of the element. -- * -- * Since: 0.10.4 -- --* -- * GST_BASE_TRANSFORM_SINK_PAD: -- * @obj: base transform instance -- * -- * Gives the pointer to the sink #GstPad object of the element. -- * -- * Since: 0.10.4 -- --* -- * GST_BASE_TRANSFORM_FLOW_DROPPED: -- * -- * A #GstFlowReturn that can be returned from transform and transform_ip to -- * indicate that no output buffer was generated. -- * -- * Since: 0.10.13 -- --* -- * GST_BASE_TRANSFORM_LOCK: -- * @obj: base transform instance -- * -- * Obtain a lock to protect the transform function from concurrent access. -- * -- * Since: 0.10.13 -- --* -- * GST_BASE_TRANSFORM_UNLOCK: -- * @obj: base transform instance -- * -- * Release the lock that protects the transform function from concurrent access. -- * -- * Since: 0.10.13 -- type GstBaseTransform; type u_GstBaseTransform_u_gst_reserved_array is array (0 .. 18) of System.Address; --subtype GstBaseTransform is u_GstBaseTransform; -- gst/base/gstbasetransform.h:100 type GstBaseTransformClass; type u_GstBaseTransformClass_u_gst_reserved_array is array (0 .. 15) of System.Address; --subtype GstBaseTransformClass is u_GstBaseTransformClass; -- gst/base/gstbasetransform.h:101 -- skipped empty struct u_GstBaseTransformPrivate -- skipped empty struct GstBaseTransformPrivate --* -- * GstBaseTransform: -- * -- * The opaque #GstBaseTransform data structure. -- type GstBaseTransform is record element : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/base/gstbasetransform.h:110 sinkpad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/base/gstbasetransform.h:114 srcpad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/base/gstbasetransform.h:115 passthrough : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:118 always_in_place : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:119 cache_caps1 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/base/gstbasetransform.h:121 cache_caps1_size : aliased GLIB.guint; -- gst/base/gstbasetransform.h:122 cache_caps2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/base/gstbasetransform.h:123 cache_caps2_size : aliased GLIB.guint; -- gst/base/gstbasetransform.h:124 have_same_caps : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:125 delay_configure : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:127 pending_configure : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:128 negotiated : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:129 have_newsegment : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:131 segment : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h.GstSegment; -- gst/base/gstbasetransform.h:134 transform_lock : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex; -- gst/base/gstbasetransform.h:136 priv : System.Address; -- gst/base/gstbasetransform.h:139 u_gst_reserved : u_GstBaseTransform_u_gst_reserved_array; -- gst/base/gstbasetransform.h:141 end record; pragma Convention (C_Pass_By_Copy, GstBaseTransform); -- gst/base/gstbasetransform.h:109 --< protected > -- source and sink pads -- Set by sub-class -- MT-protected (with STREAM_LOCK) --< private > --* -- * GstBaseTransformClass: -- * @parent_class: Element parent class -- * @transform_caps: Optional. Given the pad in this direction and the given -- * caps, what caps are allowed on the other pad in this -- * element ? -- * @fixate_caps: Optional. Given the pad in this direction and the given -- * caps, fixate the caps on the other pad. -- * @transform_size: Optional. Given the size of a buffer in the given direction -- * with the given caps, calculate the size in bytes of a buffer -- * on the other pad with the given other caps. -- * The default implementation uses get_unit_size and keeps -- * the number of units the same. -- * @get_unit_size: Required if the transform is not in-place. -- * get the size in bytes of one unit for the given caps. -- * @set_caps: allows the subclass to be notified of the actual caps set. -- * @start: Optional. -- * Called when the element starts processing. -- * Allows opening external resources. -- * @stop: Optional. -- * Called when the element stops processing. -- * Allows closing external resources. -- * @transform: Required if the element does not operate in-place. -- * Transforms one incoming buffer to one outgoing buffer. -- * The function is allowed to change size/timestamp/duration -- * of the outgoing buffer. -- * @transform_ip: Required if the element operates in-place. -- * Transform the incoming buffer in-place. -- * @event: Optional. -- * Event handler on the sink pad. This function should return -- * TRUE if the base class should forward the event. -- * @src_event: Optional. -- * Event handler on the source pad. -- * @passthrough_on_same_caps: If set to TRUE, passthrough mode will be -- * automatically enabled if the caps are the same. -- * @prepare_output_buffer: Optional. -- * Subclasses can override this to do their own -- * allocation of output buffers. Elements that only do -- * analysis can return a subbuffer or even just -- * increment the reference to the input buffer (if in -- * passthrough mode) -- * @before_transform: Optional. Since 0.10.22 -- * This method is called right before the base class will -- * start processing. Dynamic properties or other delayed -- * configuration could be performed in this method. -- * @accept_caps: Optional. Since 0.10.30 -- * Subclasses can override this method to check if @caps can be -- * handled by the element. The default implementation might not be -- * the most optimal way to check this in all cases. -- * @query: Optional Since 0.10.36 -- * Handle a requested query. Subclasses that implement this -- * should must chain up to the parent if they didn't handle the -- * query -- * -- * Subclasses can override any of the available virtual methods or not, as -- * needed. At minimum either @transform or @transform_ip need to be overridden. -- * If the element can overwrite the input data with the results (data is of the -- * same type and quantity) it should provide @transform_ip. -- type GstBaseTransformClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElementClass; -- gst/base/gstbasetransform.h:204 transform_caps : access function (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/base/gstbasetransform.h:211 fixate_caps : access procedure (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg4 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps); -- gst/base/gstbasetransform.h:215 transform_size : access function (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg4 : GLIB.guint; arg5 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg6 : access GLIB.guint) return GLIB.gboolean; -- gst/base/gstbasetransform.h:220 get_unit_size : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg3 : access GLIB.guint) return GLIB.gboolean; -- gst/base/gstbasetransform.h:223 set_caps : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/base/gstbasetransform.h:226 start : access function (arg1 : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:228 stop : access function (arg1 : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:229 event : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/base/gstbasetransform.h:231 transform : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/base/gstbasetransform.h:234 transform_ip : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/base/gstbasetransform.h:235 passthrough_on_same_caps : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:238 prepare_output_buffer : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; arg3 : GLIB.gint; arg4 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg5 : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/base/gstbasetransform.h:241 src_event : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/base/gstbasetransform.h:244 before_transform : access procedure (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer); -- gst/base/gstbasetransform.h:246 accept_caps : access function (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/base/gstbasetransform.h:249 query : access function (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery) return GLIB.gboolean; -- gst/base/gstbasetransform.h:251 u_gst_reserved : u_GstBaseTransformClass_u_gst_reserved_array; -- gst/base/gstbasetransform.h:254 end record; pragma Convention (C_Pass_By_Copy, GstBaseTransformClass); -- gst/base/gstbasetransform.h:203 --< public > -- virtual methods for subclasses -- FIXME: When adjusting the padding, move these to nicer places in the class -- src event --< private > function gst_base_transform_get_type return GLIB.GType; -- gst/base/gstbasetransform.h:257 pragma Import (C, gst_base_transform_get_type, "gst_base_transform_get_type"); procedure gst_base_transform_set_passthrough (trans : access GstBaseTransform; passthrough : GLIB.gboolean); -- gst/base/gstbasetransform.h:259 pragma Import (C, gst_base_transform_set_passthrough, "gst_base_transform_set_passthrough"); function gst_base_transform_is_passthrough (trans : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:261 pragma Import (C, gst_base_transform_is_passthrough, "gst_base_transform_is_passthrough"); procedure gst_base_transform_set_in_place (trans : access GstBaseTransform; in_place : GLIB.gboolean); -- gst/base/gstbasetransform.h:263 pragma Import (C, gst_base_transform_set_in_place, "gst_base_transform_set_in_place"); function gst_base_transform_is_in_place (trans : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:265 pragma Import (C, gst_base_transform_is_in_place, "gst_base_transform_is_in_place"); procedure gst_base_transform_update_qos (trans : access GstBaseTransform; proportion : GLIB.gdouble; diff : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTimeDiff; timestamp : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTime); -- gst/base/gstbasetransform.h:267 pragma Import (C, gst_base_transform_update_qos, "gst_base_transform_update_qos"); procedure gst_base_transform_set_qos_enabled (trans : access GstBaseTransform; enabled : GLIB.gboolean); -- gst/base/gstbasetransform.h:271 pragma Import (C, gst_base_transform_set_qos_enabled, "gst_base_transform_set_qos_enabled"); function gst_base_transform_is_qos_enabled (trans : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:273 pragma Import (C, gst_base_transform_is_qos_enabled, "gst_base_transform_is_qos_enabled"); procedure gst_base_transform_set_gap_aware (trans : access GstBaseTransform; gap_aware : GLIB.gboolean); -- gst/base/gstbasetransform.h:275 pragma Import (C, gst_base_transform_set_gap_aware, "gst_base_transform_set_gap_aware"); procedure gst_base_transform_suggest (trans : access GstBaseTransform; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; size : GLIB.guint); -- gst/base/gstbasetransform.h:278 pragma Import (C, gst_base_transform_suggest, "gst_base_transform_suggest"); procedure gst_base_transform_reconfigure (trans : access GstBaseTransform); -- gst/base/gstbasetransform.h:280 pragma Import (C, gst_base_transform_reconfigure, "gst_base_transform_reconfigure"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbasetransform_h;
17847
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.gstreamer_0_10_gst_gstelement_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h; -- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h; with System; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h; with glib; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbasetransform_h is -- unsupported macro: GST_TYPE_BASE_TRANSFORM (gst_base_transform_get_type()) -- arg-macro: function GST_BASE_TRANSFORM (obj) -- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_TRANSFORM,GstBaseTransform); -- arg-macro: function GST_BASE_TRANSFORM_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_TRANSFORM,GstBaseTransformClass); -- arg-macro: function GST_BASE_TRANSFORM_GET_CLASS (obj) -- return G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_TRANSFORM,GstBaseTransformClass); -- arg-macro: function GST_IS_BASE_TRANSFORM (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_TRANSFORM); -- arg-macro: function GST_IS_BASE_TRANSFORM_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_TRANSFORM); -- arg-macro: function GST_BASE_TRANSFORM_CAST (obj) -- return (GstBaseTransform *)(obj); GST_BASE_TRANSFORM_SINK_NAME : aliased constant String := "sink" & ASCII.NUL; -- gst/base/gstbasetransform.h:42 GST_BASE_TRANSFORM_SRC_NAME : aliased constant String := "src" & ASCII.NUL; -- gst/base/gstbasetransform.h:48 -- arg-macro: function GST_BASE_TRANSFORM_SRC_PAD (obj) -- return GST_BASE_TRANSFORM_CAST (obj).srcpad; -- arg-macro: function GST_BASE_TRANSFORM_SINK_PAD (obj) -- return GST_BASE_TRANSFORM_CAST (obj).sinkpad; -- unsupported macro: GST_BASE_TRANSFORM_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS -- arg-macro: procedure GST_BASE_TRANSFORM_LOCK (obj) -- g_mutex_lock (GST_BASE_TRANSFORM_CAST (obj).transform_lock) -- arg-macro: procedure GST_BASE_TRANSFORM_UNLOCK (obj) -- g_mutex_unlock (GST_BASE_TRANSFORM_CAST (obj).transform_lock) -- GStreamer -- * Copyright (C) 1999,2000 <NAME> <<EMAIL>> -- * 2005 <NAME> <<EMAIL>> -- * -- * 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. -- -- since 0.10.4 --* -- * GST_BASE_TRANSFORM_SINK_NAME: -- * -- * The name of the templates for the sink pad. -- --* -- * GST_BASE_TRANSFORM_SRC_NAME: -- * -- * The name of the templates for the source pad. -- --* -- * GST_BASE_TRANSFORM_SRC_PAD: -- * @obj: base transform instance -- * -- * Gives the pointer to the source #GstPad object of the element. -- * -- * Since: 0.10.4 -- --* -- * GST_BASE_TRANSFORM_SINK_PAD: -- * @obj: base transform instance -- * -- * Gives the pointer to the sink #GstPad object of the element. -- * -- * Since: 0.10.4 -- --* -- * GST_BASE_TRANSFORM_FLOW_DROPPED: -- * -- * A #GstFlowReturn that can be returned from transform and transform_ip to -- * indicate that no output buffer was generated. -- * -- * Since: 0.10.13 -- --* -- * GST_BASE_TRANSFORM_LOCK: -- * @obj: base transform instance -- * -- * Obtain a lock to protect the transform function from concurrent access. -- * -- * Since: 0.10.13 -- --* -- * GST_BASE_TRANSFORM_UNLOCK: -- * @obj: base transform instance -- * -- * Release the lock that protects the transform function from concurrent access. -- * -- * Since: 0.10.13 -- type GstBaseTransform; type u_GstBaseTransform_u_gst_reserved_array is array (0 .. 18) of System.Address; --subtype GstBaseTransform is u_GstBaseTransform; -- gst/base/gstbasetransform.h:100 type GstBaseTransformClass; type u_GstBaseTransformClass_u_gst_reserved_array is array (0 .. 15) of System.Address; --subtype GstBaseTransformClass is u_GstBaseTransformClass; -- gst/base/gstbasetransform.h:101 -- skipped empty struct u_GstBaseTransformPrivate -- skipped empty struct GstBaseTransformPrivate --* -- * GstBaseTransform: -- * -- * The opaque #GstBaseTransform data structure. -- type GstBaseTransform is record element : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/base/gstbasetransform.h:110 sinkpad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/base/gstbasetransform.h:114 srcpad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/base/gstbasetransform.h:115 passthrough : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:118 always_in_place : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:119 cache_caps1 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/base/gstbasetransform.h:121 cache_caps1_size : aliased GLIB.guint; -- gst/base/gstbasetransform.h:122 cache_caps2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/base/gstbasetransform.h:123 cache_caps2_size : aliased GLIB.guint; -- gst/base/gstbasetransform.h:124 have_same_caps : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:125 delay_configure : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:127 pending_configure : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:128 negotiated : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:129 have_newsegment : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:131 segment : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h.GstSegment; -- gst/base/gstbasetransform.h:134 transform_lock : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex; -- gst/base/gstbasetransform.h:136 priv : System.Address; -- gst/base/gstbasetransform.h:139 u_gst_reserved : u_GstBaseTransform_u_gst_reserved_array; -- gst/base/gstbasetransform.h:141 end record; pragma Convention (C_Pass_By_Copy, GstBaseTransform); -- gst/base/gstbasetransform.h:109 --< protected > -- source and sink pads -- Set by sub-class -- MT-protected (with STREAM_LOCK) --< private > --* -- * GstBaseTransformClass: -- * @parent_class: Element parent class -- * @transform_caps: Optional. Given the pad in this direction and the given -- * caps, what caps are allowed on the other pad in this -- * element ? -- * @fixate_caps: Optional. Given the pad in this direction and the given -- * caps, fixate the caps on the other pad. -- * @transform_size: Optional. Given the size of a buffer in the given direction -- * with the given caps, calculate the size in bytes of a buffer -- * on the other pad with the given other caps. -- * The default implementation uses get_unit_size and keeps -- * the number of units the same. -- * @get_unit_size: Required if the transform is not in-place. -- * get the size in bytes of one unit for the given caps. -- * @set_caps: allows the subclass to be notified of the actual caps set. -- * @start: Optional. -- * Called when the element starts processing. -- * Allows opening external resources. -- * @stop: Optional. -- * Called when the element stops processing. -- * Allows closing external resources. -- * @transform: Required if the element does not operate in-place. -- * Transforms one incoming buffer to one outgoing buffer. -- * The function is allowed to change size/timestamp/duration -- * of the outgoing buffer. -- * @transform_ip: Required if the element operates in-place. -- * Transform the incoming buffer in-place. -- * @event: Optional. -- * Event handler on the sink pad. This function should return -- * TRUE if the base class should forward the event. -- * @src_event: Optional. -- * Event handler on the source pad. -- * @passthrough_on_same_caps: If set to TRUE, passthrough mode will be -- * automatically enabled if the caps are the same. -- * @prepare_output_buffer: Optional. -- * Subclasses can override this to do their own -- * allocation of output buffers. Elements that only do -- * analysis can return a subbuffer or even just -- * increment the reference to the input buffer (if in -- * passthrough mode) -- * @before_transform: Optional. Since 0.10.22 -- * This method is called right before the base class will -- * start processing. Dynamic properties or other delayed -- * configuration could be performed in this method. -- * @accept_caps: Optional. Since 0.10.30 -- * Subclasses can override this method to check if @caps can be -- * handled by the element. The default implementation might not be -- * the most optimal way to check this in all cases. -- * @query: Optional Since 0.10.36 -- * Handle a requested query. Subclasses that implement this -- * should must chain up to the parent if they didn't handle the -- * query -- * -- * Subclasses can override any of the available virtual methods or not, as -- * needed. At minimum either @transform or @transform_ip need to be overridden. -- * If the element can overwrite the input data with the results (data is of the -- * same type and quantity) it should provide @transform_ip. -- type GstBaseTransformClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElementClass; -- gst/base/gstbasetransform.h:204 transform_caps : access function (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/base/gstbasetransform.h:211 fixate_caps : access procedure (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg4 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps); -- gst/base/gstbasetransform.h:215 transform_size : access function (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg4 : GLIB.guint; arg5 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg6 : access GLIB.guint) return GLIB.gboolean; -- gst/base/gstbasetransform.h:220 get_unit_size : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg3 : access GLIB.guint) return GLIB.gboolean; -- gst/base/gstbasetransform.h:223 set_caps : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/base/gstbasetransform.h:226 start : access function (arg1 : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:228 stop : access function (arg1 : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:229 event : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/base/gstbasetransform.h:231 transform : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/base/gstbasetransform.h:234 transform_ip : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/base/gstbasetransform.h:235 passthrough_on_same_caps : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:238 prepare_output_buffer : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; arg3 : GLIB.gint; arg4 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg5 : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/base/gstbasetransform.h:241 src_event : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/base/gstbasetransform.h:244 before_transform : access procedure (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer); -- gst/base/gstbasetransform.h:246 accept_caps : access function (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/base/gstbasetransform.h:249 query : access function (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery) return GLIB.gboolean; -- gst/base/gstbasetransform.h:251 u_gst_reserved : u_GstBaseTransformClass_u_gst_reserved_array; -- gst/base/gstbasetransform.h:254 end record; pragma Convention (C_Pass_By_Copy, GstBaseTransformClass); -- gst/base/gstbasetransform.h:203 --< public > -- virtual methods for subclasses -- FIXME: When adjusting the padding, move these to nicer places in the class -- src event --< private > function gst_base_transform_get_type return GLIB.GType; -- gst/base/gstbasetransform.h:257 pragma Import (C, gst_base_transform_get_type, "gst_base_transform_get_type"); procedure gst_base_transform_set_passthrough (trans : access GstBaseTransform; passthrough : GLIB.gboolean); -- gst/base/gstbasetransform.h:259 pragma Import (C, gst_base_transform_set_passthrough, "gst_base_transform_set_passthrough"); function gst_base_transform_is_passthrough (trans : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:261 pragma Import (C, gst_base_transform_is_passthrough, "gst_base_transform_is_passthrough"); procedure gst_base_transform_set_in_place (trans : access GstBaseTransform; in_place : GLIB.gboolean); -- gst/base/gstbasetransform.h:263 pragma Import (C, gst_base_transform_set_in_place, "gst_base_transform_set_in_place"); function gst_base_transform_is_in_place (trans : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:265 pragma Import (C, gst_base_transform_is_in_place, "gst_base_transform_is_in_place"); procedure gst_base_transform_update_qos (trans : access GstBaseTransform; proportion : GLIB.gdouble; diff : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTimeDiff; timestamp : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTime); -- gst/base/gstbasetransform.h:267 pragma Import (C, gst_base_transform_update_qos, "gst_base_transform_update_qos"); procedure gst_base_transform_set_qos_enabled (trans : access GstBaseTransform; enabled : GLIB.gboolean); -- gst/base/gstbasetransform.h:271 pragma Import (C, gst_base_transform_set_qos_enabled, "gst_base_transform_set_qos_enabled"); function gst_base_transform_is_qos_enabled (trans : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:273 pragma Import (C, gst_base_transform_is_qos_enabled, "gst_base_transform_is_qos_enabled"); procedure gst_base_transform_set_gap_aware (trans : access GstBaseTransform; gap_aware : GLIB.gboolean); -- gst/base/gstbasetransform.h:275 pragma Import (C, gst_base_transform_set_gap_aware, "gst_base_transform_set_gap_aware"); procedure gst_base_transform_suggest (trans : access GstBaseTransform; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; size : GLIB.guint); -- gst/base/gstbasetransform.h:278 pragma Import (C, gst_base_transform_suggest, "gst_base_transform_suggest"); procedure gst_base_transform_reconfigure (trans : access GstBaseTransform); -- gst/base/gstbasetransform.h:280 pragma Import (C, gst_base_transform_reconfigure, "gst_base_transform_reconfigure"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbasetransform_h;
true
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.gstreamer_0_10_gst_gstelement_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h; -- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h; with System; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h; with glib; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbasetransform_h is -- unsupported macro: GST_TYPE_BASE_TRANSFORM (gst_base_transform_get_type()) -- arg-macro: function GST_BASE_TRANSFORM (obj) -- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_TRANSFORM,GstBaseTransform); -- arg-macro: function GST_BASE_TRANSFORM_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_TRANSFORM,GstBaseTransformClass); -- arg-macro: function GST_BASE_TRANSFORM_GET_CLASS (obj) -- return G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BASE_TRANSFORM,GstBaseTransformClass); -- arg-macro: function GST_IS_BASE_TRANSFORM (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_TRANSFORM); -- arg-macro: function GST_IS_BASE_TRANSFORM_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_TRANSFORM); -- arg-macro: function GST_BASE_TRANSFORM_CAST (obj) -- return (GstBaseTransform *)(obj); GST_BASE_TRANSFORM_SINK_NAME : aliased constant String := "sink" & ASCII.NUL; -- gst/base/gstbasetransform.h:42 GST_BASE_TRANSFORM_SRC_NAME : aliased constant String := "src" & ASCII.NUL; -- gst/base/gstbasetransform.h:48 -- arg-macro: function GST_BASE_TRANSFORM_SRC_PAD (obj) -- return GST_BASE_TRANSFORM_CAST (obj).srcpad; -- arg-macro: function GST_BASE_TRANSFORM_SINK_PAD (obj) -- return GST_BASE_TRANSFORM_CAST (obj).sinkpad; -- unsupported macro: GST_BASE_TRANSFORM_FLOW_DROPPED GST_FLOW_CUSTOM_SUCCESS -- arg-macro: procedure GST_BASE_TRANSFORM_LOCK (obj) -- g_mutex_lock (GST_BASE_TRANSFORM_CAST (obj).transform_lock) -- arg-macro: procedure GST_BASE_TRANSFORM_UNLOCK (obj) -- g_mutex_unlock (GST_BASE_TRANSFORM_CAST (obj).transform_lock) -- GStreamer -- * Copyright (C) 1999,2000 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- * 2005 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- * -- * 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. -- -- since 0.10.4 --* -- * GST_BASE_TRANSFORM_SINK_NAME: -- * -- * The name of the templates for the sink pad. -- --* -- * GST_BASE_TRANSFORM_SRC_NAME: -- * -- * The name of the templates for the source pad. -- --* -- * GST_BASE_TRANSFORM_SRC_PAD: -- * @obj: base transform instance -- * -- * Gives the pointer to the source #GstPad object of the element. -- * -- * Since: 0.10.4 -- --* -- * GST_BASE_TRANSFORM_SINK_PAD: -- * @obj: base transform instance -- * -- * Gives the pointer to the sink #GstPad object of the element. -- * -- * Since: 0.10.4 -- --* -- * GST_BASE_TRANSFORM_FLOW_DROPPED: -- * -- * A #GstFlowReturn that can be returned from transform and transform_ip to -- * indicate that no output buffer was generated. -- * -- * Since: 0.10.13 -- --* -- * GST_BASE_TRANSFORM_LOCK: -- * @obj: base transform instance -- * -- * Obtain a lock to protect the transform function from concurrent access. -- * -- * Since: 0.10.13 -- --* -- * GST_BASE_TRANSFORM_UNLOCK: -- * @obj: base transform instance -- * -- * Release the lock that protects the transform function from concurrent access. -- * -- * Since: 0.10.13 -- type GstBaseTransform; type u_GstBaseTransform_u_gst_reserved_array is array (0 .. 18) of System.Address; --subtype GstBaseTransform is u_GstBaseTransform; -- gst/base/gstbasetransform.h:100 type GstBaseTransformClass; type u_GstBaseTransformClass_u_gst_reserved_array is array (0 .. 15) of System.Address; --subtype GstBaseTransformClass is u_GstBaseTransformClass; -- gst/base/gstbasetransform.h:101 -- skipped empty struct u_GstBaseTransformPrivate -- skipped empty struct GstBaseTransformPrivate --* -- * GstBaseTransform: -- * -- * The opaque #GstBaseTransform data structure. -- type GstBaseTransform is record element : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/base/gstbasetransform.h:110 sinkpad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/base/gstbasetransform.h:114 srcpad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/base/gstbasetransform.h:115 passthrough : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:118 always_in_place : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:119 cache_caps1 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/base/gstbasetransform.h:121 cache_caps1_size : aliased GLIB.guint; -- gst/base/gstbasetransform.h:122 cache_caps2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/base/gstbasetransform.h:123 cache_caps2_size : aliased GLIB.guint; -- gst/base/gstbasetransform.h:124 have_same_caps : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:125 delay_configure : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:127 pending_configure : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:128 negotiated : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:129 have_newsegment : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:131 segment : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h.GstSegment; -- gst/base/gstbasetransform.h:134 transform_lock : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex; -- gst/base/gstbasetransform.h:136 priv : System.Address; -- gst/base/gstbasetransform.h:139 u_gst_reserved : u_GstBaseTransform_u_gst_reserved_array; -- gst/base/gstbasetransform.h:141 end record; pragma Convention (C_Pass_By_Copy, GstBaseTransform); -- gst/base/gstbasetransform.h:109 --< protected > -- source and sink pads -- Set by sub-class -- MT-protected (with STREAM_LOCK) --< private > --* -- * GstBaseTransformClass: -- * @parent_class: Element parent class -- * @transform_caps: Optional. Given the pad in this direction and the given -- * caps, what caps are allowed on the other pad in this -- * element ? -- * @fixate_caps: Optional. Given the pad in this direction and the given -- * caps, fixate the caps on the other pad. -- * @transform_size: Optional. Given the size of a buffer in the given direction -- * with the given caps, calculate the size in bytes of a buffer -- * on the other pad with the given other caps. -- * The default implementation uses get_unit_size and keeps -- * the number of units the same. -- * @get_unit_size: Required if the transform is not in-place. -- * get the size in bytes of one unit for the given caps. -- * @set_caps: allows the subclass to be notified of the actual caps set. -- * @start: Optional. -- * Called when the element starts processing. -- * Allows opening external resources. -- * @stop: Optional. -- * Called when the element stops processing. -- * Allows closing external resources. -- * @transform: Required if the element does not operate in-place. -- * Transforms one incoming buffer to one outgoing buffer. -- * The function is allowed to change size/timestamp/duration -- * of the outgoing buffer. -- * @transform_ip: Required if the element operates in-place. -- * Transform the incoming buffer in-place. -- * @event: Optional. -- * Event handler on the sink pad. This function should return -- * TRUE if the base class should forward the event. -- * @src_event: Optional. -- * Event handler on the source pad. -- * @passthrough_on_same_caps: If set to TRUE, passthrough mode will be -- * automatically enabled if the caps are the same. -- * @prepare_output_buffer: Optional. -- * Subclasses can override this to do their own -- * allocation of output buffers. Elements that only do -- * analysis can return a subbuffer or even just -- * increment the reference to the input buffer (if in -- * passthrough mode) -- * @before_transform: Optional. Since 0.10.22 -- * This method is called right before the base class will -- * start processing. Dynamic properties or other delayed -- * configuration could be performed in this method. -- * @accept_caps: Optional. Since 0.10.30 -- * Subclasses can override this method to check if @caps can be -- * handled by the element. The default implementation might not be -- * the most optimal way to check this in all cases. -- * @query: Optional Since 0.10.36 -- * Handle a requested query. Subclasses that implement this -- * should must chain up to the parent if they didn't handle the -- * query -- * -- * Subclasses can override any of the available virtual methods or not, as -- * needed. At minimum either @transform or @transform_ip need to be overridden. -- * If the element can overwrite the input data with the results (data is of the -- * same type and quantity) it should provide @transform_ip. -- type GstBaseTransformClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElementClass; -- gst/base/gstbasetransform.h:204 transform_caps : access function (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/base/gstbasetransform.h:211 fixate_caps : access procedure (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg4 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps); -- gst/base/gstbasetransform.h:215 transform_size : access function (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg4 : GLIB.guint; arg5 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg6 : access GLIB.guint) return GLIB.gboolean; -- gst/base/gstbasetransform.h:220 get_unit_size : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg3 : access GLIB.guint) return GLIB.gboolean; -- gst/base/gstbasetransform.h:223 set_caps : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/base/gstbasetransform.h:226 start : access function (arg1 : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:228 stop : access function (arg1 : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:229 event : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/base/gstbasetransform.h:231 transform : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/base/gstbasetransform.h:234 transform_ip : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/base/gstbasetransform.h:235 passthrough_on_same_caps : aliased GLIB.gboolean; -- gst/base/gstbasetransform.h:238 prepare_output_buffer : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; arg3 : GLIB.gint; arg4 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; arg5 : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/base/gstbasetransform.h:241 src_event : access function (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/base/gstbasetransform.h:244 before_transform : access procedure (arg1 : access GstBaseTransform; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer); -- gst/base/gstbasetransform.h:246 accept_caps : access function (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/base/gstbasetransform.h:249 query : access function (arg1 : access GstBaseTransform; arg2 : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery) return GLIB.gboolean; -- gst/base/gstbasetransform.h:251 u_gst_reserved : u_GstBaseTransformClass_u_gst_reserved_array; -- gst/base/gstbasetransform.h:254 end record; pragma Convention (C_Pass_By_Copy, GstBaseTransformClass); -- gst/base/gstbasetransform.h:203 --< public > -- virtual methods for subclasses -- FIXME: When adjusting the padding, move these to nicer places in the class -- src event --< private > function gst_base_transform_get_type return GLIB.GType; -- gst/base/gstbasetransform.h:257 pragma Import (C, gst_base_transform_get_type, "gst_base_transform_get_type"); procedure gst_base_transform_set_passthrough (trans : access GstBaseTransform; passthrough : GLIB.gboolean); -- gst/base/gstbasetransform.h:259 pragma Import (C, gst_base_transform_set_passthrough, "gst_base_transform_set_passthrough"); function gst_base_transform_is_passthrough (trans : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:261 pragma Import (C, gst_base_transform_is_passthrough, "gst_base_transform_is_passthrough"); procedure gst_base_transform_set_in_place (trans : access GstBaseTransform; in_place : GLIB.gboolean); -- gst/base/gstbasetransform.h:263 pragma Import (C, gst_base_transform_set_in_place, "gst_base_transform_set_in_place"); function gst_base_transform_is_in_place (trans : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:265 pragma Import (C, gst_base_transform_is_in_place, "gst_base_transform_is_in_place"); procedure gst_base_transform_update_qos (trans : access GstBaseTransform; proportion : GLIB.gdouble; diff : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTimeDiff; timestamp : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClockTime); -- gst/base/gstbasetransform.h:267 pragma Import (C, gst_base_transform_update_qos, "gst_base_transform_update_qos"); procedure gst_base_transform_set_qos_enabled (trans : access GstBaseTransform; enabled : GLIB.gboolean); -- gst/base/gstbasetransform.h:271 pragma Import (C, gst_base_transform_set_qos_enabled, "gst_base_transform_set_qos_enabled"); function gst_base_transform_is_qos_enabled (trans : access GstBaseTransform) return GLIB.gboolean; -- gst/base/gstbasetransform.h:273 pragma Import (C, gst_base_transform_is_qos_enabled, "gst_base_transform_is_qos_enabled"); procedure gst_base_transform_set_gap_aware (trans : access GstBaseTransform; gap_aware : GLIB.gboolean); -- gst/base/gstbasetransform.h:275 pragma Import (C, gst_base_transform_set_gap_aware, "gst_base_transform_set_gap_aware"); procedure gst_base_transform_suggest (trans : access GstBaseTransform; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; size : GLIB.guint); -- gst/base/gstbasetransform.h:278 pragma Import (C, gst_base_transform_suggest, "gst_base_transform_suggest"); procedure gst_base_transform_reconfigure (trans : access GstBaseTransform); -- gst/base/gstbasetransform.h:280 pragma Import (C, gst_base_transform_reconfigure, "gst_base_transform_reconfigure"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_base_gstbasetransform_h;
[ { "context": " --\n-- * Richard Wai (ANNEXI-STRAYLINE) ", "end": 1044, "score": 0.9997005462646484, "start": 1033, "tag": "NAME", "value": "Richard Wai" } ]
workers-reporting.adb
annexi-strayline/AURA
13
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Core -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ with Ada.Containers.Synchronized_Queue_Interfaces; with Ada.Containers.Unbounded_Synchronized_Queues; package body Workers.Reporting is ------------------ -- Report_Queue -- ------------------ package SQI is new Ada.Containers.Synchronized_Queue_Interfaces (Element_Type => Work_Report); package USQ is new Ada.Containers.Unbounded_Synchronized_Queues (Queue_Interfaces => SQI); Report_Queue: USQ.Queue; ------------------- -- Submit_Report -- ------------------- procedure Submit_Report (Report: Work_Report) is begin Report_Queue.Enqueue (Report); end Submit_Report; ----------------------- -- Available_Reports -- ----------------------- function Available_Reports return Count_Type is (Report_Queue.Current_Use); --------------------- -- Retrieve_Report -- --------------------- function Retrieve_Report return Work_Report is begin return Report: Work_Report do Report_Queue.Dequeue (Report); end return; end Retrieve_Report; end Workers.Reporting;
19459
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Core -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2019, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (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. -- -- -- ------------------------------------------------------------------------------ with Ada.Containers.Synchronized_Queue_Interfaces; with Ada.Containers.Unbounded_Synchronized_Queues; package body Workers.Reporting is ------------------ -- Report_Queue -- ------------------ package SQI is new Ada.Containers.Synchronized_Queue_Interfaces (Element_Type => Work_Report); package USQ is new Ada.Containers.Unbounded_Synchronized_Queues (Queue_Interfaces => SQI); Report_Queue: USQ.Queue; ------------------- -- Submit_Report -- ------------------- procedure Submit_Report (Report: Work_Report) is begin Report_Queue.Enqueue (Report); end Submit_Report; ----------------------- -- Available_Reports -- ----------------------- function Available_Reports return Count_Type is (Report_Queue.Current_Use); --------------------- -- Retrieve_Report -- --------------------- function Retrieve_Report return Work_Report is begin return Report: Work_Report do Report_Queue.Dequeue (Report); end return; end Retrieve_Report; end Workers.Reporting;
true
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Core -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2019, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * PI:NAME:<NAME>END_PI (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. -- -- -- ------------------------------------------------------------------------------ with Ada.Containers.Synchronized_Queue_Interfaces; with Ada.Containers.Unbounded_Synchronized_Queues; package body Workers.Reporting is ------------------ -- Report_Queue -- ------------------ package SQI is new Ada.Containers.Synchronized_Queue_Interfaces (Element_Type => Work_Report); package USQ is new Ada.Containers.Unbounded_Synchronized_Queues (Queue_Interfaces => SQI); Report_Queue: USQ.Queue; ------------------- -- Submit_Report -- ------------------- procedure Submit_Report (Report: Work_Report) is begin Report_Queue.Enqueue (Report); end Submit_Report; ----------------------- -- Available_Reports -- ----------------------- function Available_Reports return Count_Type is (Report_Queue.Current_Use); --------------------- -- Retrieve_Report -- --------------------- function Retrieve_Report return Work_Report is begin return Report: Work_Report do Report_Queue.Dequeue (Report); end return; end Retrieve_Report; end Workers.Reporting;
[ { "context": "rs for use with smart_ptrs\n\n-- Copyright (c) 2016, James Humphry\n--\n-- Permission to use, copy, modify, and/or dis", "end": 115, "score": 0.999860942363739, "start": 102, "tag": "NAME", "value": "James Humphry" } ]
src/counters/basic_counters.adb
jhumphry/auto_counters
5
-- basic_counters.adb -- Basic non-task safe counters for use with smart_ptrs -- Copyright (c) 2016, 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. pragma Profile (No_Implementation_Extensions); with Ada.Unchecked_Deallocation; package body Basic_Counters is function Make_New_Counter return Counter_Ptr is (new Counter'(SP_Count => 1, WP_Count => 0 ) ); procedure Deallocate_Counter is new Ada.Unchecked_Deallocation (Object => Counter, Name => Counter_Ptr); procedure Deallocate_If_Unused (C : in out Counter_Ptr) is begin if C.SP_Count = 0 and C.WP_Count = 0 then Deallocate_Counter(C); end if; end Deallocate_If_Unused; procedure Check_Increment_Use_Count (C : in out Counter) is begin if C.SP_Count > 0 then C.SP_Count := C.SP_Count + 1; end if; end Check_Increment_Use_Count; procedure Decrement_Use_Count (C : in out Counter) is begin C.SP_Count := C.SP_Count - 1; end Decrement_Use_Count; procedure Increment_Weak_Ptr_Count (C : in out Counter) is begin C.WP_Count := C.WP_Count + 1; end Increment_Weak_Ptr_Count; procedure Decrement_Weak_Ptr_Count (C : in out Counter) is begin C.WP_Count := C.WP_Count - 1; end Decrement_Weak_Ptr_Count; end Basic_Counters;
1896
-- basic_counters.adb -- Basic non-task safe counters for use with smart_ptrs -- Copyright (c) 2016, <NAME> -- -- 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. pragma Profile (No_Implementation_Extensions); with Ada.Unchecked_Deallocation; package body Basic_Counters is function Make_New_Counter return Counter_Ptr is (new Counter'(SP_Count => 1, WP_Count => 0 ) ); procedure Deallocate_Counter is new Ada.Unchecked_Deallocation (Object => Counter, Name => Counter_Ptr); procedure Deallocate_If_Unused (C : in out Counter_Ptr) is begin if C.SP_Count = 0 and C.WP_Count = 0 then Deallocate_Counter(C); end if; end Deallocate_If_Unused; procedure Check_Increment_Use_Count (C : in out Counter) is begin if C.SP_Count > 0 then C.SP_Count := C.SP_Count + 1; end if; end Check_Increment_Use_Count; procedure Decrement_Use_Count (C : in out Counter) is begin C.SP_Count := C.SP_Count - 1; end Decrement_Use_Count; procedure Increment_Weak_Ptr_Count (C : in out Counter) is begin C.WP_Count := C.WP_Count + 1; end Increment_Weak_Ptr_Count; procedure Decrement_Weak_Ptr_Count (C : in out Counter) is begin C.WP_Count := C.WP_Count - 1; end Decrement_Weak_Ptr_Count; end Basic_Counters;
true
-- basic_counters.adb -- Basic non-task safe counters for use with smart_ptrs -- Copyright (c) 2016, PI:NAME:<NAME>END_PI -- -- 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. pragma Profile (No_Implementation_Extensions); with Ada.Unchecked_Deallocation; package body Basic_Counters is function Make_New_Counter return Counter_Ptr is (new Counter'(SP_Count => 1, WP_Count => 0 ) ); procedure Deallocate_Counter is new Ada.Unchecked_Deallocation (Object => Counter, Name => Counter_Ptr); procedure Deallocate_If_Unused (C : in out Counter_Ptr) is begin if C.SP_Count = 0 and C.WP_Count = 0 then Deallocate_Counter(C); end if; end Deallocate_If_Unused; procedure Check_Increment_Use_Count (C : in out Counter) is begin if C.SP_Count > 0 then C.SP_Count := C.SP_Count + 1; end if; end Check_Increment_Use_Count; procedure Decrement_Use_Count (C : in out Counter) is begin C.SP_Count := C.SP_Count - 1; end Decrement_Use_Count; procedure Increment_Weak_Ptr_Count (C : in out Counter) is begin C.WP_Count := C.WP_Count + 1; end Increment_Weak_Ptr_Count; procedure Decrement_Weak_Ptr_Count (C : in out Counter) is begin C.WP_Count := C.WP_Count - 1; end Decrement_Weak_Ptr_Count; end Basic_Counters;
[ { "context": "-- part of OpenGLAda, (c) 2017 Felix Krause\n-- released under the terms of the MIT license, ", "end": 44, "score": 0.9998464584350586, "start": 32, "tag": "NAME", "value": "Felix Krause" } ]
src/gl/generated/gl-api.ads
Roldak/OpenGLAda
0
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" -- Autogenerated by Generate, do not edit with GL.Attributes; with GL.Blending; with GL.Buffers; with GL.Culling; with GL.Enums.Getter; with GL.Enums.Textures; with GL.Errors; with GL.Fixed.Textures; with GL.Fixed.Lighting; with GL.Framebuffer; with GL.Low_Level.Enums; with GL.Objects.Textures; with GL.Objects.Buffers; with GL.Objects.Framebuffers; with GL.Objects.Programs; with GL.Objects.Shaders; with GL.Pixels; with GL.Rasterization; with GL.Toggles; with GL.Types.Colors; with GL.Uniforms; with Interfaces.C.Strings; with System; private package GL.API is pragma Preelaborate; use GL.Types; type T1 is access procedure (P1 : Attributes.Attribute; P2 : Double); pragma Convention (StdCall, T1); type T2 is access procedure (P1 : Attributes.Attribute; P2, P3 : Double); pragma Convention (StdCall, T2); type T3 is access procedure (P1 : Attributes.Attribute; P2 : Types.Doubles.Vector2); pragma Convention (StdCall, T3); type T4 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : Double); pragma Convention (StdCall, T4); type T5 is access procedure (P1 : Attributes.Attribute; P2 : Types.Doubles.Vector3); pragma Convention (StdCall, T5); type T6 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : Double); pragma Convention (StdCall, T6); type T7 is access procedure (P1 : Attributes.Attribute; P2 : Types.Doubles.Vector4); pragma Convention (StdCall, T7); type T8 is access procedure (P1 : Uniforms.Uniform; P2 : Int); pragma Convention (StdCall, T8); type T9 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Int_Array); pragma Convention (StdCall, T9); type T10 is access procedure (P1 : Uniforms.Uniform; P2, P3 : Int); pragma Convention (StdCall, T10); type T11 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Ints.Vector2_Array); pragma Convention (StdCall, T11); type T12 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4 : Int); pragma Convention (StdCall, T12); type T13 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Ints.Vector3_Array); pragma Convention (StdCall, T13); type T14 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4, P5 : Int); pragma Convention (StdCall, T14); type T15 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Ints.Vector4_Array); pragma Convention (StdCall, T15); type T16 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Ints.Matrix2_Array); pragma Convention (StdCall, T16); type T17 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Ints.Matrix3_Array); pragma Convention (StdCall, T17); type T18 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Ints.Matrix4_Array); pragma Convention (StdCall, T18); type T19 is access procedure (P1 : Attributes.Attribute; P2 : Int); pragma Convention (StdCall, T19); type T20 is access procedure (P1 : Attributes.Attribute; P2, P3 : Int); pragma Convention (StdCall, T20); type T21 is access procedure (P1 : Attributes.Attribute; P2 : Types.Ints.Vector2); pragma Convention (StdCall, T21); type T22 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : Int); pragma Convention (StdCall, T22); type T23 is access procedure (P1 : Attributes.Attribute; P2 : Types.Ints.Vector3); pragma Convention (StdCall, T23); type T24 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : Int); pragma Convention (StdCall, T24); type T25 is access procedure (P1 : Attributes.Attribute; P2 : Types.Ints.Vector4); pragma Convention (StdCall, T25); type T26 is access procedure (P1 : Attributes.Attribute; P2 : Short); pragma Convention (StdCall, T26); type T27 is access procedure (P1 : Attributes.Attribute; P2, P3 : Short); pragma Convention (StdCall, T27); type T28 is access procedure (P1 : Attributes.Attribute; P2 : Shorts.Vector2); pragma Convention (StdCall, T28); type T29 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : Short); pragma Convention (StdCall, T29); type T30 is access procedure (P1 : Attributes.Attribute; P2 : Shorts.Vector3); pragma Convention (StdCall, T30); type T31 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : Short); pragma Convention (StdCall, T31); type T32 is access procedure (P1 : Attributes.Attribute; P2 : Shorts.Vector4); pragma Convention (StdCall, T32); type T33 is access procedure (P1 : Uniforms.Uniform; P2 : Single); pragma Convention (StdCall, T33); type T34 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Single_Array); pragma Convention (StdCall, T34); type T35 is access procedure (P1 : Uniforms.Uniform; P2, P3 : Single); pragma Convention (StdCall, T35); type T36 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Singles.Vector2_Array); pragma Convention (StdCall, T36); type T37 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4 : Single); pragma Convention (StdCall, T37); type T38 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Singles.Vector3_Array); pragma Convention (StdCall, T38); type T39 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4, P5 : Single); pragma Convention (StdCall, T39); type T40 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Singles.Vector4_Array); pragma Convention (StdCall, T40); type T41 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Singles.Matrix2_Array); pragma Convention (StdCall, T41); type T42 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Singles.Matrix3_Array); pragma Convention (StdCall, T42); type T43 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Singles.Matrix4_Array); pragma Convention (StdCall, T43); type T44 is access procedure (P1 : Attributes.Attribute; P2 : Single); pragma Convention (StdCall, T44); type T45 is access procedure (P1 : Attributes.Attribute; P2, P3 : Single); pragma Convention (StdCall, T45); type T46 is access procedure (P1 : Attributes.Attribute; P2 : Types.Singles.Vector2); pragma Convention (StdCall, T46); type T47 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : Single); pragma Convention (StdCall, T47); type T48 is access procedure (P1 : Attributes.Attribute; P2 : Types.Singles.Vector3); pragma Convention (StdCall, T48); type T49 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : Single); pragma Convention (StdCall, T49); type T50 is access procedure (P1 : Attributes.Attribute; P2 : Types.Singles.Vector4); pragma Convention (StdCall, T50); type T51 is access procedure (P1 : Uniforms.Uniform; P2 : UInt); pragma Convention (StdCall, T51); type T52 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : UInt_Array); pragma Convention (StdCall, T52); type T53 is access procedure (P1 : Uniforms.Uniform; P2, P3 : UInt); pragma Convention (StdCall, T53); type T54 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : UInts.Vector2_Array); pragma Convention (StdCall, T54); type T55 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4 : UInt); pragma Convention (StdCall, T55); type T56 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : UInts.Vector3_Array); pragma Convention (StdCall, T56); type T57 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4, P5 : UInt); pragma Convention (StdCall, T57); type T58 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : UInts.Vector4_Array); pragma Convention (StdCall, T58); type T59 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : UInts.Matrix2_Array); pragma Convention (StdCall, T59); type T60 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : UInts.Matrix3_Array); pragma Convention (StdCall, T60); type T61 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : UInts.Matrix4_Array); pragma Convention (StdCall, T61); type T62 is access procedure (P1 : Attributes.Attribute; P2 : UInt); pragma Convention (StdCall, T62); type T63 is access procedure (P1 : Attributes.Attribute; P2, P3 : UInt); pragma Convention (StdCall, T63); type T64 is access procedure (P1 : Attributes.Attribute; P2 : UInts.Vector2); pragma Convention (StdCall, T64); type T65 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : UInt); pragma Convention (StdCall, T65); type T66 is access procedure (P1 : Attributes.Attribute; P2 : UInts.Vector3); pragma Convention (StdCall, T66); type T67 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : UInt); pragma Convention (StdCall, T67); type T68 is access procedure (P1 : Attributes.Attribute; P2 : UInts.Vector4); pragma Convention (StdCall, T68); type T69 is access function (P1 : Enums.Getter.String_Parameter; P2 : UInt) return C.Strings.chars_ptr; pragma Convention (StdCall, T69); type T70 is access procedure (P1 : Colors.Color); pragma Convention (StdCall, T70); type T71 is access procedure (P1 : Double); pragma Convention (StdCall, T71); type T72 is access procedure (P1 : Connection_Mode; P2 : Size; P3 : Size; P4 : Size); pragma Convention (StdCall, T72); type T73 is access procedure (P1 : Connection_Mode; P2 : Size; P3 : Unsigned_Numeric_Type; P4 : Low_Level.IntPtr; P5 : Size); pragma Convention (StdCall, T73); type T74 is access procedure (P1 : Connection_Mode; P2 : UInt; P3 : Unsigned_Numeric_Type; P4 : UInt; P5 : Int); pragma Convention (StdCall, T74); type T75 is access procedure (P1 : Connection_Mode; P2 : UInt); pragma Convention (StdCall, T75); type T76 is access procedure (P1 : Connection_Mode; P2 : UInt; P3 : UInt); pragma Convention (StdCall, T76); type T77 is access procedure (P1 : UInt); pragma Convention (StdCall, T77); type T78 is access procedure (P1 : GL.Attributes.Attribute; P2 : UInt); pragma Convention (StdCall, T78); type T79 is access procedure (P1 : Buffers.Draw_Buffer_Index; P2, P3 : Blending.Blend_Factor); pragma Convention (StdCall, T79); type T80 is access procedure (P1, P2, P3, P4 : Blending.Blend_Factor); pragma Convention (StdCall, T80); type T81 is access procedure (P1 : Buffers.Draw_Buffer_Index; P2, P3, P4, P5 : Blending.Blend_Factor); pragma Convention (StdCall, T81); type T82 is access procedure (P1, P2, P3, P4 : Colors.Component); pragma Convention (StdCall, T82); type T83 is access procedure (P1 : Blending.Equation); pragma Convention (StdCall, T83); type T84 is access procedure (P1 : Buffers.Draw_Buffer_Index; P2 : Blending.Equation); pragma Convention (StdCall, T84); type T85 is access procedure (P1, P2 : Blending.Equation); pragma Convention (StdCall, T85); type T86 is access procedure (P1 : Buffers.Draw_Buffer_Index; P2, P3 : Blending.Equation); pragma Convention (StdCall, T86); type T87 is access procedure (P1 : Enums.Point_Param; P2 : Single); pragma Convention (StdCall, T87); type T88 is access procedure (P1 : UInt; P2 : Buffers.Explicit_Color_Buffer_List); pragma Convention (StdCall, T88); type T89 is access procedure (P1 : Buffers.Color_Buffer_Selector; P2 : Low_Level.Zero; P3 : Colors.Color); pragma Convention (StdCall, T89); type T90 is access procedure (P1 : Low_Level.Enums.Only_Color_Buffer; P2 : Buffers.Draw_Buffer_Index; P3 : Colors.Color); pragma Convention (StdCall, T90); type T91 is access procedure (P1 : Low_Level.Enums.Only_Depth_Buffer; P2 : Low_Level.Zero; P3 : access constant Buffers.Depth); pragma Convention (StdCall, T91); type T92 is access procedure (P1 : Low_Level.Enums.Only_Stencil_Buffer; P2 : Low_Level.Zero; P3 : access constant Buffers.Stencil_Index); pragma Convention (StdCall, T92); type T93 is access procedure (P1 : Low_Level.Enums.Only_Depth_Stencil_Buffer; P2 : Low_Level.Zero; P3 : Buffers.Depth; P4 : Buffers.Stencil_Index); pragma Convention (StdCall, T93); type T94 is access procedure (P1 : Culling.Face_Selector; P2 : Compare_Function; P3 : Int; P4 : UInt); pragma Convention (StdCall, T94); type T95 is access procedure (P1 : Culling.Face_Selector; P2, P3, P4 : Buffers.Stencil_Action); pragma Convention (StdCall, T95); type T96 is access procedure (P1 : Culling.Face_Selector; P2 : UInt); pragma Convention (StdCall, T96); type T97 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4 : Size; P5 : Low_Level.Zero; P6 : Size; P7 : Objects.Textures.Image_Source); pragma Convention (StdCall, T97); type T98 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3, P4 : Int; P5, P6 : Size; P7 : Pixels.Data_Format; P8 : Pixels.Data_Type; P9 : Objects.Textures.Image_Source); pragma Convention (StdCall, T98); type T99 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4 : Size); pragma Convention (StdCall, T99); type T100 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5 : Size; P6 : Low_Level.Zero; P7 : Size; P8 : Objects.Textures.Image_Source); pragma Convention (StdCall, T100); type T101 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5 : Size); pragma Convention (StdCall, T101); type T102 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5, P6 : Size; P7 : Low_Level.Zero; P8 : Pixels.Data_Format; P9 : Pixels.Data_Type; P10 : Objects.Textures.Image_Source); pragma Convention (StdCall, T102); type T103 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5, P6 : Size; P7 : Low_Level.Zero; P8 : Size; P9 : Objects.Textures.Image_Source); pragma Convention (StdCall, T103); type T104 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5, P6 : Size); pragma Convention (StdCall, T104); type T105 is access procedure (P1 : Int); pragma Convention (StdCall, T105); type T106 is access procedure (P1 : Low_Level.Enums.Texture_Kind); pragma Convention (StdCall, T106); type T107 is access procedure (P1 : UInt; P2 : Objects.Textures.Mipmap_Level); pragma Convention (StdCall, T107); type T108 is access procedure (P1 : UInt; P2 : Objects.Textures.Mipmap_Level; P3, P4, P5 : Int; P6, P7, P8 : Size); pragma Convention (StdCall, T108); type T109 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T109); type T110 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T110); type T111 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : UInt); pragma Convention (StdCall, T111); type T112 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : UInt; P3 : UInt); pragma Convention (StdCall, T112); type T113 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Low_Level.SizeIPtr; P3 : System.Address; P4 : Objects.Buffers.Buffer_Usage); pragma Convention (StdCall, T113); type T114 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Pixels.Internal_Format; P3 : UInt); pragma Convention (StdCall, T114); type T115 is access function (P1 : Low_Level.Enums.Buffer_Kind; P2 : Objects.Access_Kind) return System.Address; pragma Convention (StdCall, T115); type T116 is access function (P1 : Low_Level.Enums.Buffer_Kind; P2 : Low_Level.IntPtr; P3 : Low_Level.SizeIPtr; P4 : Low_Level.Bitfield) return System.Address; pragma Convention (StdCall, T116); type T117 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Pointer_Param; P3 : out System.Address); pragma Convention (StdCall, T117); type T118 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Low_Level.IntPtr; P3 : Low_Level.SizeIPtr; P4 : System.Address); pragma Convention (StdCall, T118); type T119 is access procedure (P1 : Low_Level.Enums.Buffer_Kind); pragma Convention (StdCall, T119); type T120 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Param; P3 : out Objects.Access_Kind); pragma Convention (StdCall, T120); type T121 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Param; P3 : out Low_Level.Bool); pragma Convention (StdCall, T121); type T122 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Param; P3 : out Size); pragma Convention (StdCall, T122); type T123 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Param; P3 : out Objects.Buffers.Buffer_Usage); pragma Convention (StdCall, T123); type T124 is access procedure (P1 : UInt); pragma Convention (StdCall, T124); type T125 is access procedure (P1 : UInt; P2 : Low_Level.IntPtr; P3 : Low_Level.SizeIPtr); pragma Convention (StdCall, T125); type T126 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Low_Level.IntPtr; P3 : Low_Level.SizeIPtr); pragma Convention (StdCall, T126); type T127 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T127); type T128 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T128); type T129 is access procedure (P1 : UInt); pragma Convention (StdCall, T129); type T130 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T130); type T131 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T131); type T132 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : Pixels.Internal_Format; P3, P4 : Size); pragma Convention (StdCall, T132); type T133 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : Size; P3 : Pixels.Internal_Format; P4, P5 : Size); pragma Convention (StdCall, T133); type T134 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : UInt); pragma Convention (StdCall, T134); type T135 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : Enums.Getter.Renderbuffer_Parameter; P3 : out Int); pragma Convention (StdCall, T135); type T136 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : Enums.Getter.Renderbuffer_Parameter; P3 : out Pixels.Internal_Format); pragma Convention (StdCall, T136); type T137 is access procedure (P1 : Enums.Clamp_Color_Param; P2 : Low_Level.Bool); pragma Convention (StdCall, T137); type T138 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T138); type T139 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T139); type T140 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : UInt); pragma Convention (StdCall, T140); type T141 is access function (P1 : Low_Level.Enums.Framebuffer_Kind) return Objects.Framebuffers.Framebuffer_Status; pragma Convention (StdCall, T141); type T142 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Objects.Framebuffers.Attachment_Point; P3 : Low_Level.Enums.Renderbuffer_Kind; P4 : UInt); pragma Convention (StdCall, T142); type T143 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Objects.Framebuffers.Attachment_Point; P3 : UInt; P4 : Objects.Textures.Mipmap_Level); pragma Convention (StdCall, T143); type T144 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Objects.Framebuffers.Attachment_Point; P3 : UInt; P4 : Objects.Textures.Mipmap_Level; P5 : Int); pragma Convention (StdCall, T144); type T145 is access procedure (P1, P2, P3, P4, P5, P6, P7, P8 : Int; P9 : Low_Level.Bitfield; P10 : Objects.Textures.Magnifying_Function); pragma Convention (StdCall, T145); type T146 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Size; P3 : Objects.Framebuffers.Attachment_List); pragma Convention (StdCall, T146); type T147 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Size; P3 : Objects.Framebuffers.Attachment_List; P4, P5 : Int; P6, P7 : Size); pragma Convention (StdCall, T147); type T148 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Enums.Framebuffer_Param; P3 : Size); pragma Convention (StdCall, T148); type T149 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Enums.Framebuffer_Param; P3 : Low_Level.Bool); pragma Convention (StdCall, T149); type T150 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Enums.Framebuffer_Param; P3 : out Size); pragma Convention (StdCall, T150); type T151 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Enums.Framebuffer_Param; P3 : out Low_Level.Bool); pragma Convention (StdCall, T151); type T152 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T152); type T153 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T153); type T154 is access function (P1 : UInt) return Boolean; pragma Convention (StdCall, T154); type T155 is access procedure (P1 : UInt; P2 : Low_Level.Enums.Query_Results; P3 : out UInt); pragma Convention (StdCall, T155); type T156 is access procedure (P1 : Low_Level.Enums.Query_Param; P2 : UInt); pragma Convention (StdCall, T156); type T157 is access procedure (P1 : Low_Level.Enums.Query_Param); pragma Convention (StdCall, T157); type T158 is access procedure (P1 : Low_Level.Enums.Query_Param; P2, P3 : UInt); pragma Convention (StdCall, T158); type T159 is access procedure (P1 : Low_Level.Enums.Query_Param; P2 : UInt); pragma Convention (StdCall, T159); type T160 is access procedure (P1 : UInt; P2 : Low_Level.Enums.Query_Param); pragma Convention (StdCall, T160); type T161 is access procedure (P1 : UInt; P2 : Enums.Shader_Param; P3 : out Int); pragma Convention (StdCall, T161); type T162 is access procedure (P1 : UInt; P2 : Enums.Shader_Param; P3 : out Objects.Shaders.Shader_Type); pragma Convention (StdCall, T162); type T163 is access function (P1 : Objects.Shaders.Shader_Type) return UInt; pragma Convention (StdCall, T163); type T164 is access procedure (P1 : UInt); pragma Convention (StdCall, T164); type T165 is access procedure (P1 : UInt; P2 : Size; P3 : Low_Level.Char_Access_Array; P4 : Low_Level.Int_Array); pragma Convention (StdCall, T165); type T166 is access procedure (P1 : UInt; P2 : Size; P3 : out Size; P4 : in out String); pragma Convention (StdCall, T166); type T167 is access procedure; pragma Convention (StdCall, T167); type T168 is access function return UInt; pragma Convention (StdCall, T168); type T169 is access procedure (P1 : UInt); pragma Convention (StdCall, T169); type T170 is access procedure (P1 : UInt; P2 : Enums.Program_Param; P3 : out Int); pragma Convention (StdCall, T170); type T171 is access procedure (P1, P2 : UInt); pragma Convention (StdCall, T171); type T172 is access procedure (P1 : UInt; P2 : Size; P3 : out Size; P4 : in out String); pragma Convention (StdCall, T172); type T173 is access procedure (P1 : UInt; P2 : Objects.Shaders.Shader_Type; P3 : Enums.Program_Stage_Param; P4 : out Size); pragma Convention (StdCall, T173); type T174 is access function (P1 : UInt; P2 : Objects.Shaders.Shader_Type; P3 : Interfaces.C.char_array) return Objects.Programs.Subroutine_Index_Type; pragma Convention (StdCall, T174); type T175 is access function (P1 : UInt; P2 : Objects.Shaders.Shader_Type; P3 : Interfaces.C.char_array) return Objects.Programs.Uniform_Location_Type; pragma Convention (StdCall, T175); type T176 is access function (P1 : UInt; P2 : C.char_array) return Uniforms.Uniform; pragma Convention (StdCall, T176); type T177 is access procedure (P1 : UInt; P2 : Attributes.Attribute; P3 : C.char_array); pragma Convention (StdCall, T177); type T178 is access function (P1 : UInt; P2 : C.char_array) return Attributes.Attribute; pragma Convention (StdCall, T178); type T179 is access procedure (P1 : Attributes.Attribute; P2 : Component_Count; P3 : Numeric_Type; P4 : Low_Level.Bool; P5 : Size; P6 : Int); pragma Convention (StdCall, T179); type T180 is access procedure (P1 : Attributes.Attribute; P2 : Component_Count; P3 : Numeric_Type; P4 : Size; P5 : Int); pragma Convention (StdCall, T180); type T181 is access procedure (P1 : Attributes.Attribute); pragma Convention (StdCall, T181); type T182 is access procedure (P1 : UInt; P2 : Size; P3 : out Size; P4 : in out UInt_Array); pragma Convention (StdCall, T182); type T183 is access procedure (P1 : UInt; P2 : Buffers.Draw_Buffer_Index; P3 : Interfaces.C.char_array); pragma Convention (StdCall, T183); type T184 is access function (P1 : UInt; P2 : Interfaces.C.char_array) return Int; pragma Convention (StdCall, T184); type T185 is access procedure (P1 : Connection_Mode); pragma Convention (StdCall, T185); type T186 is access procedure (P1 : UInt; P2 : Int; P3 : Size; P4 : out Size; P5 : out Size; P6 : out GL.Objects.Programs.Active_Attribute; P7 : in out Interfaces.C.char_array); pragma Convention (StdCall, T186); type T187 is access procedure (P1 : UInt; P2 : Size; P3 : Low_Level.Char_Access_Array; P4 : GL.Objects.Programs.Buffer_Mode); pragma Convention (StdCall, T187); type T188 is access procedure (P1 : Enums.Patch_Parameter_Int; P2 : Int); pragma Convention (StdCall, T188); type T189 is access procedure (P1 : Enums.Patch_Parameter_Float_Array; P2 : Types.Single_Array); pragma Convention (StdCall, T189); function Get_Error return Errors.Error_Code; pragma Import (StdCall, Get_Error, "glGetError"); procedure Flush; pragma Import (StdCall, Flush, "glFlush"); procedure Finish; pragma Import (StdCall, Finish, "glFinish"); procedure Get_Boolean (Name : Enums.Getter.Parameter; Target : access Low_Level.Bool); pragma Import (StdCall, Get_Boolean, "glGetBooleanv"); procedure Get_Double (Name : Enums.Getter.Parameter; Target : access Double); pragma Import (StdCall, Get_Double, "glGetDoublev"); procedure Get_Double_Vec2 (Name : Enums.Getter.Parameter; Target : in out Doubles.Vector2); pragma Import (StdCall, Get_Double_Vec2, "glGetDoublev"); procedure Get_Single (Name : Enums.Getter.Parameter; Target : access Single); pragma Import (StdCall, Get_Single, "glGetFloatv"); procedure Get_Single_Vec2 (Name : Enums.Getter.Parameter; Target : in out Singles.Vector2); pragma Import (StdCall, Get_Single_Vec2, "glGetFloatv"); procedure Get_Color (Name : Enums.Getter.Parameter; Target : in out Colors.Color); pragma Import (StdCall, Get_Color, "glGetFloatv"); procedure Get_Integer (Name : Enums.Getter.Parameter; Target : access Int); pragma Import (StdCall, Get_Integer, "glGetIntegerv"); procedure Get_Int_Vec4 (Name : Enums.Getter.Parameter; Target : in out Ints.Vector4); pragma Import (StdCall, Get_Int_Vec4, "glGetIntegerv"); procedure Get_Unsigned_Integer (Name : Enums.Getter.Parameter; Target : access UInt); pragma Import (StdCall, Get_Unsigned_Integer, "glGetIntegerv"); procedure Get_Size (Name : Enums.Getter.Parameter; Target : access Size); pragma Import (StdCall, Get_Size, "glGetIntegerv"); procedure Get_Color_Control (Name : Enums.Getter.Parameter; Target : access Fixed.Lighting.Color_Control); pragma Import (StdCall, Get_Color_Control, "glGetIntegerv"); procedure Get_Shade_Model (Name : Enums.Getter.Parameter; Target : access Fixed.Lighting.Shade_Model); pragma Import (StdCall, Get_Shade_Model, "glGetIntegerv"); procedure Get_Blend_Factor (Name : Enums.Getter.Parameter; Target : access Blending.Blend_Factor); pragma Import (StdCall, Get_Blend_Factor, "glGetIntegerv"); procedure Get_Alignment (Name : Enums.Getter.Parameter; Target : access Pixels.Alignment); pragma Import (StdCall, Get_Alignment, "glGetIntegerv"); procedure Get_Blend_Equation (Name : Enums.Getter.Parameter; Target : access Blending.Equation); pragma Import (StdCall, Get_Blend_Equation, "glGetIntegerv"); procedure Get_Compare_Function (Name : Enums.Getter.Parameter; Target : access Compare_Function); pragma Import (StdCall, Get_Compare_Function, "glGetIntegerv"); procedure Get_Orientation (Name : Enums.Getter.Parameter; Target : access Orientation); pragma Import (StdCall, Get_Orientation, "glGetIntegerv"); procedure Get_Face_Selector (Name : Enums.Getter.Parameter; Target : access Culling.Face_Selector); pragma Import (StdCall, Get_Face_Selector, "glGetIntegerv"); procedure Get_Polygon_Mode (Name : Enums.Getter.Parameter; Target : access Rasterization.Polygon_Mode_Type); pragma Import (StdCall, Get_Polygon_Mode, "glGetIntegerv"); procedure Get_Logic_Op (Name : Enums.Getter.Parameter; Target : access Framebuffer.Logic_Op); pragma Import (StdCall, Get_Logic_Op, "glGetIntegerv"); procedure Get_Stencil_Action (Name : Enums.Getter.Parameter; Target : access Buffers.Stencil_Action); pragma Import (StdCall, Get_Stencil_Action, "glGetIntegerv"); procedure Get_Read_Buffer_Selector (Name : Enums.Getter.Parameter; Target : access Framebuffer.Read_Buffer_Selector); pragma Import (StdCall, Get_Read_Buffer_Selector, "glGetIntegerv"); procedure Get_Light_Color (Name : Enums.Light_Name; Pname : Enums.Light_Param; Target : in out Colors.Color); pragma Import (StdCall, Get_Light_Color, "glGetLightfv"); function Get_String (Name : Enums.Getter.String_Parameter) return C.Strings.chars_ptr; pragma Import (StdCall, Get_String, "glGetString"); Get_String_I : T69; procedure Enable (Subject : Toggles.Toggle); pragma Import (StdCall, Enable, "glEnable"); procedure Disable (Subject : Toggles.Toggle); pragma Import (StdCall, Disable, "glDisable"); function Is_Enabled (Subject : Toggles.Toggle) return Low_Level.Bool; pragma Import (StdCall, Is_Enabled, "glIsEnabled"); procedure Cull_Face (Selector : Culling.Face_Selector); pragma Import (StdCall, Cull_Face, "glCullFace"); procedure Front_Face (Face : Orientation); pragma Import (StdCall, Front_Face, "glFrontFace"); procedure Pixel_Store (Param : Enums.Pixel_Store_Param; Value : Low_Level.Bool); procedure Pixel_Store (Param : Enums.Pixel_Store_Param; Value : Size); procedure Pixel_Store (Param : Enums.Pixel_Store_Param; Value : Pixels.Alignment); pragma Import (StdCall, Pixel_Store, "glPixelStorei"); procedure Matrix_Mode (Mode : Enums.Matrix_Mode); pragma Import (StdCall, Matrix_Mode, "glMatrixMode"); procedure Frustum (Left, Right, Bottom, Top, zNear, zFar : Double); pragma Import (StdCall, Frustum, "glFrustum"); procedure Ortho (Left, Right, Bottom, Top, zNear, zFar : Double); pragma Import (StdCall, Ortho, "glOrtho"); procedure Load_Identity; pragma Import (StdCall, Load_Identity, "glLoadIdentity"); procedure Push_Matrix; pragma Import (StdCall, Push_Matrix, "glPushMatrix"); procedure Pop_Matrix; pragma Import (StdCall, Pop_Matrix, "glPopMatrix"); procedure Rotate (Angle, X, Y, Z : Double); pragma Import (StdCall, Rotate, "glRotated"); procedure Scale (X, Y, Z : Double); pragma Import (StdCall, Scale, "glScaled"); procedure Translate (X, Y, Z : Double); pragma Import (StdCall, Translate, "glTranslated"); procedure GL_Begin (Mode : Connection_Mode); pragma Import (StdCall, GL_Begin, "glBegin"); procedure GL_End; pragma Import (StdCall, GL_End, "glEnd"); procedure Color (Value : Colors.Color); pragma Import (StdCall, Color, "glColor4fv"); Secondary_Color : T70; Fog_Coord : T71; procedure Vertex_Pointer (Count : Int; Data_Type : Signed_Numeric_Type; Stride : Size; Pointer : Int); pragma Import (StdCall, Vertex_Pointer, "glVertexPointer"); procedure Index_Pointer (Data_Type : Signed_Numeric_Type; Stride : Size; Pointer : Int); pragma Import (StdCall, Index_Pointer, "glIndexPointer"); procedure Color_Pointer (Count : Int; Data_Type : Signed_Numeric_Type; Stride : Size; Pointer : Int); pragma Import (StdCall, Color_Pointer, "glColorPointer"); procedure Enable_Client_State (Cap : Fixed.Client_Side_Capability); pragma Import (StdCall, Enable_Client_State, "glEnableClientState"); procedure Disable_Client_State (Cap : Fixed.Client_Side_Capability); pragma Import (StdCall, Disable_Client_State, "glDisableClientState"); procedure Draw_Arrays (Mode : Connection_Mode; First : Int; Count : Size); pragma Import (StdCall, Draw_Arrays, "glDrawArrays"); Draw_Arrays_Instanced : T72; procedure Draw_Elements (Mode : Connection_Mode; Count : Size; Index_Type : Unsigned_Numeric_Type; Indices : Low_Level.IntPtr); pragma Import (StdCall, Draw_Elements, "glDrawElements"); Draw_Elements_Instanced : T73; Draw_Elements_Base_Vertex : T74; Draw_Transform_Feedback : T75; Draw_Transform_Feedback_Stream : T76; Primitive_Restart_Index : T77; Vertex_Attrib_Divisor : T78; procedure Load_Matrix (Value : Types.Doubles.Matrix4); pragma Import (StdCall, Load_Matrix, "glLoadMatrixd"); procedure Mult_Matrix (Factor : Types.Doubles.Matrix4); pragma Import (StdCall, Mult_Matrix, "glMultMatrixd"); procedure Vertex4 (Value : Types.Doubles.Vector4); pragma Import (StdCall, Vertex4, "glVertex4dv"); procedure Vertex3 (Value : Types.Doubles.Vector3); pragma Import (StdCall, Vertex3, "glVertex3dv"); procedure Vertex2 (Value : Types.Doubles.Vector2); pragma Import (StdCall, Vertex2, "glVertex2dv"); procedure Normal (Value : Types.Doubles.Vector3); pragma Import (StdCall, Normal, "glNormal3dv"); procedure Tex_Coord4 (Value : Types.Doubles.Vector4); pragma Import (StdCall, Tex_Coord4, "glTexCoord4dv"); procedure Tex_Coord3 (Value : Types.Doubles.Vector3); pragma Import (StdCall, Tex_Coord3, "glTexCoord3dv"); procedure Tex_Coord2 (Value : Types.Doubles.Vector2); pragma Import (StdCall, Tex_Coord2, "glTexCoord2dv"); procedure Light_Model_Color (Param : Enums.Light_Model_Ambient_Parameter; Color : Colors.Color); pragma Import (StdCall, Light_Model_Color, "glLightModelfv"); procedure Light_Model_Color_Control (Param : Enums.Light_Model_CC_Parameter; Value : access constant Fixed.Lighting.Color_Control); pragma Import (StdCall, Light_Model_Color_Control, "glLightModeliv"); procedure Light_Model_Toggles (Param : Enums.Light_Model_Toggle_Parameter; Value : access constant Int); pragma Import (StdCall, Light_Model_Toggles, "glLightModeliv"); procedure Shade_Model (Mode : Fixed.Lighting.Shade_Model); pragma Import (StdCall, Shade_Model, "glShadeModel"); procedure Light_Color (Name : Enums.Light_Name; Pname : Enums.Light_Param; Param : Colors.Color); pragma Import (StdCall, Light_Color, "glLightfv"); procedure Get_Light_Position (Name : Enums.Light_Name; Pname : Enums.Light_Param; Target : in out Types.Singles.Vector4); pragma Import (StdCall, Get_Light_Position, "glGetLightfv"); procedure Get_Light_Direction (Name : Enums.Light_Name; Pname : Enums.Light_Param; Target : in out Types.Singles.Vector3); pragma Import (StdCall, Get_Light_Direction, "glGetLightfv"); procedure Light_Position (Name : Enums.Light_Name; Pname : Enums.Light_Param; Param : Types.Singles.Vector4); pragma Import (StdCall, Light_Position, "glLightfv"); procedure Light_Direction (Name : Enums.Light_Name; Pname : Enums.Light_Param; Param : Types.Singles.Vector3); pragma Import (StdCall, Light_Direction, "glLightfv"); procedure Blend_Func (Src_Factor, Dst_Factor : Blending.Blend_Factor); pragma Import (StdCall, Blend_Func, "glBlendFunc"); Blend_Func_I : T79; Blend_Func_Separate : T80; Blend_Func_Separate_I : T81; Blend_Color : T82; Blend_Equation : T83; Blend_Equation_I : T84; Blend_Equation_Separate : T85; Blend_Equation_Separate_I : T86; procedure Line_Width (Value : Single); pragma Import (StdCall, Line_Width, "glLineWidth"); procedure Polygon_Mode (Face : Culling.Face_Selector; Value : Rasterization.Polygon_Mode_Type); pragma Import (StdCall, Polygon_Mode, "glPolygonMode"); procedure Set_Point_Size (Value : Single); pragma Import (StdCall, Set_Point_Size, "glPointSize"); Set_Point_Parameter_Single : T87; procedure Raster_Pos4 (Value : Types.Doubles.Vector4); pragma Import (StdCall, Raster_Pos4, "glRasterPos4dv"); procedure Raster_Pos3 (Value : Types.Doubles.Vector3); pragma Import (StdCall, Raster_Pos3, "glRasterPos3dv"); procedure Raster_Pos2 (Value : Types.Doubles.Vector2); pragma Import (StdCall, Raster_Pos2, "glRasterPos2dv"); procedure Set_Polygon_Offset (Factor, Units : Single); pragma Import (StdCall, Set_Polygon_Offset, "glPolygonOffset"); procedure Clear (Bits : Low_Level.Bitfield); pragma Import (StdCall, Clear, "glClear"); procedure Draw_Buffer (Mode : Buffers.Explicit_Color_Buffer_Selector); pragma Import (StdCall, Draw_Buffer, "glDrawBuffer"); Draw_Buffers : T88; procedure Clear_Color (Red, Green, Blue, Alpha : Colors.Component); pragma Import (StdCall, Clear_Color, "glClearColor"); procedure Clear_Depth (Depth : Buffers.Depth); pragma Import (StdCall, Clear_Depth, "glClearDepth"); procedure Clear_Stencil (Index : Buffers.Stencil_Index); pragma Import (StdCall, Clear_Stencil, "glClearStencil"); Clear_Accum : T82; Clear_Buffer : T89; Clear_Draw_Buffer : T90; Clear_Buffer_Depth : T91; Clear_Buffer_Stencil : T92; Clear_Buffer_Depth_Stencil : T93; procedure Depth_Mask (Value : Low_Level.Bool); pragma Import (StdCall, Depth_Mask, "glDepthMask"); procedure Depth_Func (Func : Compare_Function); pragma Import (StdCall, Depth_Func, "glDepthFunc"); Stencil_Func_Separate : T94; Stencil_Op_Separate : T95; Stencil_Mask_Separate : T96; procedure Tex_Parameter_Float (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Single); pragma Import (StdCall, Tex_Parameter_Float, "glTexParameterf"); procedure Tex_Parameter_Int (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Int); pragma Import (StdCall, Tex_Parameter_Int, "glTexParameteri"); procedure Tex_Parameter_Min_Filter (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Objects.Textures.Minifying_Function); pragma Import (StdCall, Tex_Parameter_Min_Filter, "glTexParameteri"); procedure Tex_Parameter_Mag_Filter (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Objects.Textures.Magnifying_Function); pragma Import (StdCall, Tex_Parameter_Mag_Filter, "glTexParameteri"); procedure Tex_Parameter_Wrap_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Objects.Textures.Wrapping_Mode); pragma Import (StdCall, Tex_Parameter_Wrap_Mode, "glTexParameteri"); procedure Tex_Parameter_Comp_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Enums.Textures.Compare_Kind); pragma Import (StdCall, Tex_Parameter_Comp_Mode, "glTexParameteri"); procedure Tex_Parameter_Comp_Func (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Compare_Function); pragma Import (StdCall, Tex_Parameter_Comp_Func, "glTexParameteri"); procedure Tex_Parameter_Depth_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Objects.Textures.Depth_Mode); pragma Import (StdCall, Tex_Parameter_Depth_Mode, "glTexParameteri"); procedure Tex_Parameter_Bool (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Low_Level.Bool); pragma Import (StdCall, Tex_Parameter_Bool, "glTexParameteri"); procedure Tex_Parameter_Floats (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : Low_Level.Single_Array); pragma Import (StdCall, Tex_Parameter_Floats, "glTexParameterfv"); procedure Get_Tex_Parameter_Float (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : out Single); pragma Import (StdCall, Get_Tex_Parameter_Float, "glGetTexParameterfv"); procedure Get_Tex_Parameter_Floats (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : in out Low_Level.Single_Array); pragma Import (StdCall, Get_Tex_Parameter_Floats, "glGetTexParameterfv"); procedure Get_Tex_Parameter_Int (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Int); pragma Import (StdCall, Get_Tex_Parameter_Int, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Ints (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : in out Low_Level.Int_Array); pragma Import (StdCall, Get_Tex_Parameter_Ints, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Wrap_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Objects.Textures.Wrapping_Mode); pragma Import (StdCall, Get_Tex_Parameter_Wrap_Mode, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Comp_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Enums.Textures.Compare_Kind); pragma Import (StdCall, Get_Tex_Parameter_Comp_Mode, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Comp_Func (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Compare_Function); pragma Import (StdCall, Get_Tex_Parameter_Comp_Func, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Depth_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Objects.Textures.Depth_Mode); pragma Import (StdCall, Get_Tex_Parameter_Depth_Mode, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Bool (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Low_Level.Bool); pragma Import (StdCall, Get_Tex_Parameter_Bool, "glGetTexParameteriv"); procedure Get_Tex_Level_Parameter_Size (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Param_Name : Enums.Textures.Level_Parameter; Value : out Size); pragma Import (StdCall, Get_Tex_Level_Parameter_Size, "glGetTexLevelParameteriv"); procedure Get_Tex_Level_Parameter_Format (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Param_Name : Enums.Textures.Level_Parameter; Value : out Pixels.Internal_Format); pragma Import (StdCall, Get_Tex_Level_Parameter_Format, "glGetTexLevelParameteriv"); procedure Get_Tex_Level_Parameter_Type (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Param_Name : Enums.Textures.Level_Parameter; Value : out Pixels.Channel_Data_Type); pragma Import (StdCall, Get_Tex_Level_Parameter_Type, "glGetTexLevelParameteriv"); procedure Get_Tex_Level_Parameter_Bool (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Param_Name : Enums.Textures.Level_Parameter; Value : out Low_Level.Bool); pragma Import (StdCall, Get_Tex_Level_Parameter_Bool, "glGetTexLevelParameteriv"); procedure Gen_Textures (N : Size; Textures : out UInt); pragma Import (StdCall, Gen_Textures, "glGenTextures"); procedure Bind_Texture (Target : Low_Level.Enums.Texture_Kind; Texture : UInt); pragma Import (StdCall, Bind_Texture, "glBindTexture"); procedure Delete_Textures (N : Size; Textures : Low_Level.UInt_Array); pragma Import (StdCall, Delete_Textures, "glDeleteTextures"); function Is_Texture (Texture : UInt) return Boolean; pragma Import (StdCall, Is_Texture, "glIsTexture"); procedure Tex_Image_1D (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Internal_Format : Pixels.Internal_Format; Width : Size; Border : Low_Level.Zero; Format : Pixels.Data_Format; Data_Type : Pixels.Data_Type; Data : Objects.Textures.Image_Source); pragma Import (StdCall, Tex_Image_1D, "glTexImage1D"); Compressed_Tex_Image_1D : T97; Tex_Sub_Image_1D : T98; Tex_Storage_1D : T99; procedure Tex_Image_2D (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Internal_Format : Pixels.Internal_Format; Width, Height : Size; Border : Low_Level.Zero; Format : Pixels.Data_Format; Data_Type : Pixels.Data_Type; Data : Objects.Textures.Image_Source); pragma Import (StdCall, Tex_Image_2D, "glTexImage2D"); Compressed_Tex_Image_2D : T100; procedure Tex_Sub_Image_2D (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; X_Offset, Y_Offset : Int; Width, Height : Size; Format : Pixels.Data_Format; Data_Type : Pixels.Data_Type; Data : Objects.Textures.Image_Source); pragma Import (StdCall, Tex_Sub_Image_2D, "glTexSubImage2D"); Tex_Storage_2D : T101; Tex_Image_3D : T102; Compressed_Tex_Image_3D : T103; Tex_Sub_Image_3D : T98; Tex_Storage_3D : T104; procedure Tex_Env_Float (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Single); pragma Import (StdCall, Tex_Env_Float, "glTexEnvf"); procedure Tex_Env_Int (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Int); pragma Import (StdCall, Tex_Env_Int, "glTexEnvi"); procedure Tex_Env_Tex_Func (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Fixed.Textures.Texture_Function); pragma Import (StdCall, Tex_Env_Tex_Func, "glTexEnvi"); procedure Tex_Env_Combine_Func (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Fixed.Textures.Combine_Function); pragma Import (StdCall, Tex_Env_Combine_Func, "glTexEnvi"); procedure Tex_Env_Source (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Fixed.Textures.Source_Kind); pragma Import (StdCall, Tex_Env_Source, "glTexEnvi"); procedure Tex_Env_Arr (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Low_Level.Single_Array); pragma Import (StdCall, Tex_Env_Arr, "glTexEnvfv"); procedure Tex_Env_Bool (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Low_Level.Bool); pragma Import (StdCall, Tex_Env_Bool, "glTexEnvi"); procedure Get_Tex_Env_Float (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Single); pragma Import (StdCall, Get_Tex_Env_Float, "glGetTexEnvfv"); procedure Get_Tex_Env_Tex_Func (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Fixed.Textures.Texture_Function); pragma Import (StdCall, Get_Tex_Env_Tex_Func, "glGetTexEnviv"); procedure Get_Tex_Env_Combine_Func (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Fixed.Textures.Combine_Function); pragma Import (StdCall, Get_Tex_Env_Combine_Func, "glGetTexEnviv"); procedure Get_Tex_Env_Source (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Fixed.Textures.Source_Kind); pragma Import (StdCall, Get_Tex_Env_Source, "glGetTexEnviv"); procedure Get_Tex_Env_Arr (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : in out Low_Level.Single_Array); pragma Import (StdCall, Get_Tex_Env_Arr, "glGetTexEnvfv"); procedure Get_Tex_Env_Bool (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Low_Level.Bool); pragma Import (StdCall, Get_Tex_Env_Bool, "glGetTexEnviv"); Active_Texture : T105; Generate_Mipmap : T106; Invalidate_Tex_Image : T107; Invalidate_Tex_Sub_Image : T108; Gen_Buffers : T109; Gen_Transform_Feedbacks : T109; Delete_Buffers : T110; Delete_Transform_Feedbacks : T110; Bind_Buffer : T111; Bind_Transform_Feedback : T111; Bind_Buffer_Base : T112; Buffer_Data : T113; Texture_Buffer_Data : T114; Map_Buffer : T115; Map_Buffer_Range : T116; Buffer_Pointer : T117; Buffer_Sub_Data : T118; Get_Buffer_Sub_Data : T118; Unmap_Buffer : T119; Get_Buffer_Parameter_Access_Kind : T120; Get_Buffer_Parameter_Bool : T121; Get_Buffer_Parameter_Size : T122; Get_Buffer_Parameter_Usage : T123; Invalidate_Buffer_Data : T124; Invalidate_Buffer_Sub_Data : T125; Flush_Mapped_Buffer_Range : T126; Gen_Vertex_Arrays : T127; Delete_Vertex_Arrays : T128; Bind_Vertex_Array : T129; Gen_Renderbuffers : T130; Delete_Renderbuffers : T131; Renderbuffer_Storage : T132; Renderbuffer_Storage_Multisample : T133; Bind_Renderbuffer : T134; Get_Renderbuffer_Parameter_Int : T135; Get_Renderbuffer_Parameter_Internal_Format : T136; procedure Read_Pixels (X, Y : Int; Width, Height : Size; Format : Pixels.Framebuffer_Format; Data_Type : Pixels.Data_Type; Data : System.Address); pragma Import (StdCall, Read_Pixels, "glReadPixels"); procedure Logic_Op (Value : Framebuffer.Logic_Op); pragma Import (StdCall, Logic_Op, "glLogicOp"); Clamp_Color : T137; procedure Read_Buffer (Value : Framebuffer.Read_Buffer_Selector); pragma Import (StdCall, Read_Buffer, "glReadBuffer"); Gen_Framebuffers : T138; Delete_Framebuffers : T139; Bind_Framebuffer : T140; Check_Framebuffer_Status : T141; Framebuffer_Renderbuffer : T142; Framebuffer_Texture : T143; Framebuffer_Texture_Layer : T144; Blit_Framebuffer : T145; Invalidate_Framebuffer : T146; Invalidate_Sub_Framebuffer : T147; Framebuffer_Parameter_Size : T148; Framebuffer_Parameter_Bool : T149; Get_Framebuffer_Parameter_Size : T150; Get_Framebuffer_Parameter_Bool : T151; Gen_Queries : T152; Delete_Queries : T153; Is_Query : T154; Get_Query_Object : T155; Begin_Query : T156; End_Query : T157; Begin_Query_Indexed : T158; End_Query_Indexed : T159; Query_Counter : T160; Get_Shader_Param : T161; Get_Shader_Type : T162; Create_Shader : T163; Delete_Shader : T164; Shader_Source : T165; Get_Shader_Source : T166; Compile_Shader : T164; Release_Shader_Compiler : T167; Get_Shader_Info_Log : T166; Create_Program : T168; Delete_Program : T169; Get_Program_Param : T170; Attach_Shader : T171; Link_Program : T169; Get_Program_Info_Log : T172; Get_Program_Stage : T173; Get_Subroutine_Index : T174; Get_Subroutine_Uniform_Location : T175; Use_Program : T169; Validate_Program : T169; Get_Uniform_Location : T176; Bind_Attrib_Location : T177; Get_Attrib_Location : T178; Vertex_Attrib_Pointer : T179; Vertex_AttribI_Pointer : T180; Vertex_AttribL_Pointer : T180; Enable_Vertex_Attrib_Array : T181; Disable_Vertex_Attrib_Array : T181; Get_Attached_Shaders : T182; Bind_Frag_Data_Location : T183; Get_Frag_Data_Location : T184; Begin_Transform_Feedback : T185; End_Transform_Feedback : T167; Get_Transform_Feedback_Varying : T186; Transform_Feedback_Varyings : T187; Set_Patch_Parameter_Int : T188; Set_Patch_Parameter_Float_Array : T189; procedure Depth_Range (Near, Far : Double); pragma Import (StdCall, Depth_Range, "glDepthRange"); procedure Viewport (X, Y : Int; Width, Height : Size); pragma Import (StdCall, Viewport, "glViewport"); end GL.API;
12053
-- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" -- Autogenerated by Generate, do not edit with GL.Attributes; with GL.Blending; with GL.Buffers; with GL.Culling; with GL.Enums.Getter; with GL.Enums.Textures; with GL.Errors; with GL.Fixed.Textures; with GL.Fixed.Lighting; with GL.Framebuffer; with GL.Low_Level.Enums; with GL.Objects.Textures; with GL.Objects.Buffers; with GL.Objects.Framebuffers; with GL.Objects.Programs; with GL.Objects.Shaders; with GL.Pixels; with GL.Rasterization; with GL.Toggles; with GL.Types.Colors; with GL.Uniforms; with Interfaces.C.Strings; with System; private package GL.API is pragma Preelaborate; use GL.Types; type T1 is access procedure (P1 : Attributes.Attribute; P2 : Double); pragma Convention (StdCall, T1); type T2 is access procedure (P1 : Attributes.Attribute; P2, P3 : Double); pragma Convention (StdCall, T2); type T3 is access procedure (P1 : Attributes.Attribute; P2 : Types.Doubles.Vector2); pragma Convention (StdCall, T3); type T4 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : Double); pragma Convention (StdCall, T4); type T5 is access procedure (P1 : Attributes.Attribute; P2 : Types.Doubles.Vector3); pragma Convention (StdCall, T5); type T6 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : Double); pragma Convention (StdCall, T6); type T7 is access procedure (P1 : Attributes.Attribute; P2 : Types.Doubles.Vector4); pragma Convention (StdCall, T7); type T8 is access procedure (P1 : Uniforms.Uniform; P2 : Int); pragma Convention (StdCall, T8); type T9 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Int_Array); pragma Convention (StdCall, T9); type T10 is access procedure (P1 : Uniforms.Uniform; P2, P3 : Int); pragma Convention (StdCall, T10); type T11 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Ints.Vector2_Array); pragma Convention (StdCall, T11); type T12 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4 : Int); pragma Convention (StdCall, T12); type T13 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Ints.Vector3_Array); pragma Convention (StdCall, T13); type T14 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4, P5 : Int); pragma Convention (StdCall, T14); type T15 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Ints.Vector4_Array); pragma Convention (StdCall, T15); type T16 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Ints.Matrix2_Array); pragma Convention (StdCall, T16); type T17 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Ints.Matrix3_Array); pragma Convention (StdCall, T17); type T18 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Ints.Matrix4_Array); pragma Convention (StdCall, T18); type T19 is access procedure (P1 : Attributes.Attribute; P2 : Int); pragma Convention (StdCall, T19); type T20 is access procedure (P1 : Attributes.Attribute; P2, P3 : Int); pragma Convention (StdCall, T20); type T21 is access procedure (P1 : Attributes.Attribute; P2 : Types.Ints.Vector2); pragma Convention (StdCall, T21); type T22 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : Int); pragma Convention (StdCall, T22); type T23 is access procedure (P1 : Attributes.Attribute; P2 : Types.Ints.Vector3); pragma Convention (StdCall, T23); type T24 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : Int); pragma Convention (StdCall, T24); type T25 is access procedure (P1 : Attributes.Attribute; P2 : Types.Ints.Vector4); pragma Convention (StdCall, T25); type T26 is access procedure (P1 : Attributes.Attribute; P2 : Short); pragma Convention (StdCall, T26); type T27 is access procedure (P1 : Attributes.Attribute; P2, P3 : Short); pragma Convention (StdCall, T27); type T28 is access procedure (P1 : Attributes.Attribute; P2 : Shorts.Vector2); pragma Convention (StdCall, T28); type T29 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : Short); pragma Convention (StdCall, T29); type T30 is access procedure (P1 : Attributes.Attribute; P2 : Shorts.Vector3); pragma Convention (StdCall, T30); type T31 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : Short); pragma Convention (StdCall, T31); type T32 is access procedure (P1 : Attributes.Attribute; P2 : Shorts.Vector4); pragma Convention (StdCall, T32); type T33 is access procedure (P1 : Uniforms.Uniform; P2 : Single); pragma Convention (StdCall, T33); type T34 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Single_Array); pragma Convention (StdCall, T34); type T35 is access procedure (P1 : Uniforms.Uniform; P2, P3 : Single); pragma Convention (StdCall, T35); type T36 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Singles.Vector2_Array); pragma Convention (StdCall, T36); type T37 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4 : Single); pragma Convention (StdCall, T37); type T38 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Singles.Vector3_Array); pragma Convention (StdCall, T38); type T39 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4, P5 : Single); pragma Convention (StdCall, T39); type T40 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Singles.Vector4_Array); pragma Convention (StdCall, T40); type T41 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Singles.Matrix2_Array); pragma Convention (StdCall, T41); type T42 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Singles.Matrix3_Array); pragma Convention (StdCall, T42); type T43 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Singles.Matrix4_Array); pragma Convention (StdCall, T43); type T44 is access procedure (P1 : Attributes.Attribute; P2 : Single); pragma Convention (StdCall, T44); type T45 is access procedure (P1 : Attributes.Attribute; P2, P3 : Single); pragma Convention (StdCall, T45); type T46 is access procedure (P1 : Attributes.Attribute; P2 : Types.Singles.Vector2); pragma Convention (StdCall, T46); type T47 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : Single); pragma Convention (StdCall, T47); type T48 is access procedure (P1 : Attributes.Attribute; P2 : Types.Singles.Vector3); pragma Convention (StdCall, T48); type T49 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : Single); pragma Convention (StdCall, T49); type T50 is access procedure (P1 : Attributes.Attribute; P2 : Types.Singles.Vector4); pragma Convention (StdCall, T50); type T51 is access procedure (P1 : Uniforms.Uniform; P2 : UInt); pragma Convention (StdCall, T51); type T52 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : UInt_Array); pragma Convention (StdCall, T52); type T53 is access procedure (P1 : Uniforms.Uniform; P2, P3 : UInt); pragma Convention (StdCall, T53); type T54 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : UInts.Vector2_Array); pragma Convention (StdCall, T54); type T55 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4 : UInt); pragma Convention (StdCall, T55); type T56 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : UInts.Vector3_Array); pragma Convention (StdCall, T56); type T57 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4, P5 : UInt); pragma Convention (StdCall, T57); type T58 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : UInts.Vector4_Array); pragma Convention (StdCall, T58); type T59 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : UInts.Matrix2_Array); pragma Convention (StdCall, T59); type T60 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : UInts.Matrix3_Array); pragma Convention (StdCall, T60); type T61 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : UInts.Matrix4_Array); pragma Convention (StdCall, T61); type T62 is access procedure (P1 : Attributes.Attribute; P2 : UInt); pragma Convention (StdCall, T62); type T63 is access procedure (P1 : Attributes.Attribute; P2, P3 : UInt); pragma Convention (StdCall, T63); type T64 is access procedure (P1 : Attributes.Attribute; P2 : UInts.Vector2); pragma Convention (StdCall, T64); type T65 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : UInt); pragma Convention (StdCall, T65); type T66 is access procedure (P1 : Attributes.Attribute; P2 : UInts.Vector3); pragma Convention (StdCall, T66); type T67 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : UInt); pragma Convention (StdCall, T67); type T68 is access procedure (P1 : Attributes.Attribute; P2 : UInts.Vector4); pragma Convention (StdCall, T68); type T69 is access function (P1 : Enums.Getter.String_Parameter; P2 : UInt) return C.Strings.chars_ptr; pragma Convention (StdCall, T69); type T70 is access procedure (P1 : Colors.Color); pragma Convention (StdCall, T70); type T71 is access procedure (P1 : Double); pragma Convention (StdCall, T71); type T72 is access procedure (P1 : Connection_Mode; P2 : Size; P3 : Size; P4 : Size); pragma Convention (StdCall, T72); type T73 is access procedure (P1 : Connection_Mode; P2 : Size; P3 : Unsigned_Numeric_Type; P4 : Low_Level.IntPtr; P5 : Size); pragma Convention (StdCall, T73); type T74 is access procedure (P1 : Connection_Mode; P2 : UInt; P3 : Unsigned_Numeric_Type; P4 : UInt; P5 : Int); pragma Convention (StdCall, T74); type T75 is access procedure (P1 : Connection_Mode; P2 : UInt); pragma Convention (StdCall, T75); type T76 is access procedure (P1 : Connection_Mode; P2 : UInt; P3 : UInt); pragma Convention (StdCall, T76); type T77 is access procedure (P1 : UInt); pragma Convention (StdCall, T77); type T78 is access procedure (P1 : GL.Attributes.Attribute; P2 : UInt); pragma Convention (StdCall, T78); type T79 is access procedure (P1 : Buffers.Draw_Buffer_Index; P2, P3 : Blending.Blend_Factor); pragma Convention (StdCall, T79); type T80 is access procedure (P1, P2, P3, P4 : Blending.Blend_Factor); pragma Convention (StdCall, T80); type T81 is access procedure (P1 : Buffers.Draw_Buffer_Index; P2, P3, P4, P5 : Blending.Blend_Factor); pragma Convention (StdCall, T81); type T82 is access procedure (P1, P2, P3, P4 : Colors.Component); pragma Convention (StdCall, T82); type T83 is access procedure (P1 : Blending.Equation); pragma Convention (StdCall, T83); type T84 is access procedure (P1 : Buffers.Draw_Buffer_Index; P2 : Blending.Equation); pragma Convention (StdCall, T84); type T85 is access procedure (P1, P2 : Blending.Equation); pragma Convention (StdCall, T85); type T86 is access procedure (P1 : Buffers.Draw_Buffer_Index; P2, P3 : Blending.Equation); pragma Convention (StdCall, T86); type T87 is access procedure (P1 : Enums.Point_Param; P2 : Single); pragma Convention (StdCall, T87); type T88 is access procedure (P1 : UInt; P2 : Buffers.Explicit_Color_Buffer_List); pragma Convention (StdCall, T88); type T89 is access procedure (P1 : Buffers.Color_Buffer_Selector; P2 : Low_Level.Zero; P3 : Colors.Color); pragma Convention (StdCall, T89); type T90 is access procedure (P1 : Low_Level.Enums.Only_Color_Buffer; P2 : Buffers.Draw_Buffer_Index; P3 : Colors.Color); pragma Convention (StdCall, T90); type T91 is access procedure (P1 : Low_Level.Enums.Only_Depth_Buffer; P2 : Low_Level.Zero; P3 : access constant Buffers.Depth); pragma Convention (StdCall, T91); type T92 is access procedure (P1 : Low_Level.Enums.Only_Stencil_Buffer; P2 : Low_Level.Zero; P3 : access constant Buffers.Stencil_Index); pragma Convention (StdCall, T92); type T93 is access procedure (P1 : Low_Level.Enums.Only_Depth_Stencil_Buffer; P2 : Low_Level.Zero; P3 : Buffers.Depth; P4 : Buffers.Stencil_Index); pragma Convention (StdCall, T93); type T94 is access procedure (P1 : Culling.Face_Selector; P2 : Compare_Function; P3 : Int; P4 : UInt); pragma Convention (StdCall, T94); type T95 is access procedure (P1 : Culling.Face_Selector; P2, P3, P4 : Buffers.Stencil_Action); pragma Convention (StdCall, T95); type T96 is access procedure (P1 : Culling.Face_Selector; P2 : UInt); pragma Convention (StdCall, T96); type T97 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4 : Size; P5 : Low_Level.Zero; P6 : Size; P7 : Objects.Textures.Image_Source); pragma Convention (StdCall, T97); type T98 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3, P4 : Int; P5, P6 : Size; P7 : Pixels.Data_Format; P8 : Pixels.Data_Type; P9 : Objects.Textures.Image_Source); pragma Convention (StdCall, T98); type T99 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4 : Size); pragma Convention (StdCall, T99); type T100 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5 : Size; P6 : Low_Level.Zero; P7 : Size; P8 : Objects.Textures.Image_Source); pragma Convention (StdCall, T100); type T101 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5 : Size); pragma Convention (StdCall, T101); type T102 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5, P6 : Size; P7 : Low_Level.Zero; P8 : Pixels.Data_Format; P9 : Pixels.Data_Type; P10 : Objects.Textures.Image_Source); pragma Convention (StdCall, T102); type T103 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5, P6 : Size; P7 : Low_Level.Zero; P8 : Size; P9 : Objects.Textures.Image_Source); pragma Convention (StdCall, T103); type T104 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5, P6 : Size); pragma Convention (StdCall, T104); type T105 is access procedure (P1 : Int); pragma Convention (StdCall, T105); type T106 is access procedure (P1 : Low_Level.Enums.Texture_Kind); pragma Convention (StdCall, T106); type T107 is access procedure (P1 : UInt; P2 : Objects.Textures.Mipmap_Level); pragma Convention (StdCall, T107); type T108 is access procedure (P1 : UInt; P2 : Objects.Textures.Mipmap_Level; P3, P4, P5 : Int; P6, P7, P8 : Size); pragma Convention (StdCall, T108); type T109 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T109); type T110 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T110); type T111 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : UInt); pragma Convention (StdCall, T111); type T112 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : UInt; P3 : UInt); pragma Convention (StdCall, T112); type T113 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Low_Level.SizeIPtr; P3 : System.Address; P4 : Objects.Buffers.Buffer_Usage); pragma Convention (StdCall, T113); type T114 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Pixels.Internal_Format; P3 : UInt); pragma Convention (StdCall, T114); type T115 is access function (P1 : Low_Level.Enums.Buffer_Kind; P2 : Objects.Access_Kind) return System.Address; pragma Convention (StdCall, T115); type T116 is access function (P1 : Low_Level.Enums.Buffer_Kind; P2 : Low_Level.IntPtr; P3 : Low_Level.SizeIPtr; P4 : Low_Level.Bitfield) return System.Address; pragma Convention (StdCall, T116); type T117 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Pointer_Param; P3 : out System.Address); pragma Convention (StdCall, T117); type T118 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Low_Level.IntPtr; P3 : Low_Level.SizeIPtr; P4 : System.Address); pragma Convention (StdCall, T118); type T119 is access procedure (P1 : Low_Level.Enums.Buffer_Kind); pragma Convention (StdCall, T119); type T120 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Param; P3 : out Objects.Access_Kind); pragma Convention (StdCall, T120); type T121 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Param; P3 : out Low_Level.Bool); pragma Convention (StdCall, T121); type T122 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Param; P3 : out Size); pragma Convention (StdCall, T122); type T123 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Param; P3 : out Objects.Buffers.Buffer_Usage); pragma Convention (StdCall, T123); type T124 is access procedure (P1 : UInt); pragma Convention (StdCall, T124); type T125 is access procedure (P1 : UInt; P2 : Low_Level.IntPtr; P3 : Low_Level.SizeIPtr); pragma Convention (StdCall, T125); type T126 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Low_Level.IntPtr; P3 : Low_Level.SizeIPtr); pragma Convention (StdCall, T126); type T127 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T127); type T128 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T128); type T129 is access procedure (P1 : UInt); pragma Convention (StdCall, T129); type T130 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T130); type T131 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T131); type T132 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : Pixels.Internal_Format; P3, P4 : Size); pragma Convention (StdCall, T132); type T133 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : Size; P3 : Pixels.Internal_Format; P4, P5 : Size); pragma Convention (StdCall, T133); type T134 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : UInt); pragma Convention (StdCall, T134); type T135 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : Enums.Getter.Renderbuffer_Parameter; P3 : out Int); pragma Convention (StdCall, T135); type T136 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : Enums.Getter.Renderbuffer_Parameter; P3 : out Pixels.Internal_Format); pragma Convention (StdCall, T136); type T137 is access procedure (P1 : Enums.Clamp_Color_Param; P2 : Low_Level.Bool); pragma Convention (StdCall, T137); type T138 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T138); type T139 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T139); type T140 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : UInt); pragma Convention (StdCall, T140); type T141 is access function (P1 : Low_Level.Enums.Framebuffer_Kind) return Objects.Framebuffers.Framebuffer_Status; pragma Convention (StdCall, T141); type T142 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Objects.Framebuffers.Attachment_Point; P3 : Low_Level.Enums.Renderbuffer_Kind; P4 : UInt); pragma Convention (StdCall, T142); type T143 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Objects.Framebuffers.Attachment_Point; P3 : UInt; P4 : Objects.Textures.Mipmap_Level); pragma Convention (StdCall, T143); type T144 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Objects.Framebuffers.Attachment_Point; P3 : UInt; P4 : Objects.Textures.Mipmap_Level; P5 : Int); pragma Convention (StdCall, T144); type T145 is access procedure (P1, P2, P3, P4, P5, P6, P7, P8 : Int; P9 : Low_Level.Bitfield; P10 : Objects.Textures.Magnifying_Function); pragma Convention (StdCall, T145); type T146 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Size; P3 : Objects.Framebuffers.Attachment_List); pragma Convention (StdCall, T146); type T147 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Size; P3 : Objects.Framebuffers.Attachment_List; P4, P5 : Int; P6, P7 : Size); pragma Convention (StdCall, T147); type T148 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Enums.Framebuffer_Param; P3 : Size); pragma Convention (StdCall, T148); type T149 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Enums.Framebuffer_Param; P3 : Low_Level.Bool); pragma Convention (StdCall, T149); type T150 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Enums.Framebuffer_Param; P3 : out Size); pragma Convention (StdCall, T150); type T151 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Enums.Framebuffer_Param; P3 : out Low_Level.Bool); pragma Convention (StdCall, T151); type T152 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T152); type T153 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T153); type T154 is access function (P1 : UInt) return Boolean; pragma Convention (StdCall, T154); type T155 is access procedure (P1 : UInt; P2 : Low_Level.Enums.Query_Results; P3 : out UInt); pragma Convention (StdCall, T155); type T156 is access procedure (P1 : Low_Level.Enums.Query_Param; P2 : UInt); pragma Convention (StdCall, T156); type T157 is access procedure (P1 : Low_Level.Enums.Query_Param); pragma Convention (StdCall, T157); type T158 is access procedure (P1 : Low_Level.Enums.Query_Param; P2, P3 : UInt); pragma Convention (StdCall, T158); type T159 is access procedure (P1 : Low_Level.Enums.Query_Param; P2 : UInt); pragma Convention (StdCall, T159); type T160 is access procedure (P1 : UInt; P2 : Low_Level.Enums.Query_Param); pragma Convention (StdCall, T160); type T161 is access procedure (P1 : UInt; P2 : Enums.Shader_Param; P3 : out Int); pragma Convention (StdCall, T161); type T162 is access procedure (P1 : UInt; P2 : Enums.Shader_Param; P3 : out Objects.Shaders.Shader_Type); pragma Convention (StdCall, T162); type T163 is access function (P1 : Objects.Shaders.Shader_Type) return UInt; pragma Convention (StdCall, T163); type T164 is access procedure (P1 : UInt); pragma Convention (StdCall, T164); type T165 is access procedure (P1 : UInt; P2 : Size; P3 : Low_Level.Char_Access_Array; P4 : Low_Level.Int_Array); pragma Convention (StdCall, T165); type T166 is access procedure (P1 : UInt; P2 : Size; P3 : out Size; P4 : in out String); pragma Convention (StdCall, T166); type T167 is access procedure; pragma Convention (StdCall, T167); type T168 is access function return UInt; pragma Convention (StdCall, T168); type T169 is access procedure (P1 : UInt); pragma Convention (StdCall, T169); type T170 is access procedure (P1 : UInt; P2 : Enums.Program_Param; P3 : out Int); pragma Convention (StdCall, T170); type T171 is access procedure (P1, P2 : UInt); pragma Convention (StdCall, T171); type T172 is access procedure (P1 : UInt; P2 : Size; P3 : out Size; P4 : in out String); pragma Convention (StdCall, T172); type T173 is access procedure (P1 : UInt; P2 : Objects.Shaders.Shader_Type; P3 : Enums.Program_Stage_Param; P4 : out Size); pragma Convention (StdCall, T173); type T174 is access function (P1 : UInt; P2 : Objects.Shaders.Shader_Type; P3 : Interfaces.C.char_array) return Objects.Programs.Subroutine_Index_Type; pragma Convention (StdCall, T174); type T175 is access function (P1 : UInt; P2 : Objects.Shaders.Shader_Type; P3 : Interfaces.C.char_array) return Objects.Programs.Uniform_Location_Type; pragma Convention (StdCall, T175); type T176 is access function (P1 : UInt; P2 : C.char_array) return Uniforms.Uniform; pragma Convention (StdCall, T176); type T177 is access procedure (P1 : UInt; P2 : Attributes.Attribute; P3 : C.char_array); pragma Convention (StdCall, T177); type T178 is access function (P1 : UInt; P2 : C.char_array) return Attributes.Attribute; pragma Convention (StdCall, T178); type T179 is access procedure (P1 : Attributes.Attribute; P2 : Component_Count; P3 : Numeric_Type; P4 : Low_Level.Bool; P5 : Size; P6 : Int); pragma Convention (StdCall, T179); type T180 is access procedure (P1 : Attributes.Attribute; P2 : Component_Count; P3 : Numeric_Type; P4 : Size; P5 : Int); pragma Convention (StdCall, T180); type T181 is access procedure (P1 : Attributes.Attribute); pragma Convention (StdCall, T181); type T182 is access procedure (P1 : UInt; P2 : Size; P3 : out Size; P4 : in out UInt_Array); pragma Convention (StdCall, T182); type T183 is access procedure (P1 : UInt; P2 : Buffers.Draw_Buffer_Index; P3 : Interfaces.C.char_array); pragma Convention (StdCall, T183); type T184 is access function (P1 : UInt; P2 : Interfaces.C.char_array) return Int; pragma Convention (StdCall, T184); type T185 is access procedure (P1 : Connection_Mode); pragma Convention (StdCall, T185); type T186 is access procedure (P1 : UInt; P2 : Int; P3 : Size; P4 : out Size; P5 : out Size; P6 : out GL.Objects.Programs.Active_Attribute; P7 : in out Interfaces.C.char_array); pragma Convention (StdCall, T186); type T187 is access procedure (P1 : UInt; P2 : Size; P3 : Low_Level.Char_Access_Array; P4 : GL.Objects.Programs.Buffer_Mode); pragma Convention (StdCall, T187); type T188 is access procedure (P1 : Enums.Patch_Parameter_Int; P2 : Int); pragma Convention (StdCall, T188); type T189 is access procedure (P1 : Enums.Patch_Parameter_Float_Array; P2 : Types.Single_Array); pragma Convention (StdCall, T189); function Get_Error return Errors.Error_Code; pragma Import (StdCall, Get_Error, "glGetError"); procedure Flush; pragma Import (StdCall, Flush, "glFlush"); procedure Finish; pragma Import (StdCall, Finish, "glFinish"); procedure Get_Boolean (Name : Enums.Getter.Parameter; Target : access Low_Level.Bool); pragma Import (StdCall, Get_Boolean, "glGetBooleanv"); procedure Get_Double (Name : Enums.Getter.Parameter; Target : access Double); pragma Import (StdCall, Get_Double, "glGetDoublev"); procedure Get_Double_Vec2 (Name : Enums.Getter.Parameter; Target : in out Doubles.Vector2); pragma Import (StdCall, Get_Double_Vec2, "glGetDoublev"); procedure Get_Single (Name : Enums.Getter.Parameter; Target : access Single); pragma Import (StdCall, Get_Single, "glGetFloatv"); procedure Get_Single_Vec2 (Name : Enums.Getter.Parameter; Target : in out Singles.Vector2); pragma Import (StdCall, Get_Single_Vec2, "glGetFloatv"); procedure Get_Color (Name : Enums.Getter.Parameter; Target : in out Colors.Color); pragma Import (StdCall, Get_Color, "glGetFloatv"); procedure Get_Integer (Name : Enums.Getter.Parameter; Target : access Int); pragma Import (StdCall, Get_Integer, "glGetIntegerv"); procedure Get_Int_Vec4 (Name : Enums.Getter.Parameter; Target : in out Ints.Vector4); pragma Import (StdCall, Get_Int_Vec4, "glGetIntegerv"); procedure Get_Unsigned_Integer (Name : Enums.Getter.Parameter; Target : access UInt); pragma Import (StdCall, Get_Unsigned_Integer, "glGetIntegerv"); procedure Get_Size (Name : Enums.Getter.Parameter; Target : access Size); pragma Import (StdCall, Get_Size, "glGetIntegerv"); procedure Get_Color_Control (Name : Enums.Getter.Parameter; Target : access Fixed.Lighting.Color_Control); pragma Import (StdCall, Get_Color_Control, "glGetIntegerv"); procedure Get_Shade_Model (Name : Enums.Getter.Parameter; Target : access Fixed.Lighting.Shade_Model); pragma Import (StdCall, Get_Shade_Model, "glGetIntegerv"); procedure Get_Blend_Factor (Name : Enums.Getter.Parameter; Target : access Blending.Blend_Factor); pragma Import (StdCall, Get_Blend_Factor, "glGetIntegerv"); procedure Get_Alignment (Name : Enums.Getter.Parameter; Target : access Pixels.Alignment); pragma Import (StdCall, Get_Alignment, "glGetIntegerv"); procedure Get_Blend_Equation (Name : Enums.Getter.Parameter; Target : access Blending.Equation); pragma Import (StdCall, Get_Blend_Equation, "glGetIntegerv"); procedure Get_Compare_Function (Name : Enums.Getter.Parameter; Target : access Compare_Function); pragma Import (StdCall, Get_Compare_Function, "glGetIntegerv"); procedure Get_Orientation (Name : Enums.Getter.Parameter; Target : access Orientation); pragma Import (StdCall, Get_Orientation, "glGetIntegerv"); procedure Get_Face_Selector (Name : Enums.Getter.Parameter; Target : access Culling.Face_Selector); pragma Import (StdCall, Get_Face_Selector, "glGetIntegerv"); procedure Get_Polygon_Mode (Name : Enums.Getter.Parameter; Target : access Rasterization.Polygon_Mode_Type); pragma Import (StdCall, Get_Polygon_Mode, "glGetIntegerv"); procedure Get_Logic_Op (Name : Enums.Getter.Parameter; Target : access Framebuffer.Logic_Op); pragma Import (StdCall, Get_Logic_Op, "glGetIntegerv"); procedure Get_Stencil_Action (Name : Enums.Getter.Parameter; Target : access Buffers.Stencil_Action); pragma Import (StdCall, Get_Stencil_Action, "glGetIntegerv"); procedure Get_Read_Buffer_Selector (Name : Enums.Getter.Parameter; Target : access Framebuffer.Read_Buffer_Selector); pragma Import (StdCall, Get_Read_Buffer_Selector, "glGetIntegerv"); procedure Get_Light_Color (Name : Enums.Light_Name; Pname : Enums.Light_Param; Target : in out Colors.Color); pragma Import (StdCall, Get_Light_Color, "glGetLightfv"); function Get_String (Name : Enums.Getter.String_Parameter) return C.Strings.chars_ptr; pragma Import (StdCall, Get_String, "glGetString"); Get_String_I : T69; procedure Enable (Subject : Toggles.Toggle); pragma Import (StdCall, Enable, "glEnable"); procedure Disable (Subject : Toggles.Toggle); pragma Import (StdCall, Disable, "glDisable"); function Is_Enabled (Subject : Toggles.Toggle) return Low_Level.Bool; pragma Import (StdCall, Is_Enabled, "glIsEnabled"); procedure Cull_Face (Selector : Culling.Face_Selector); pragma Import (StdCall, Cull_Face, "glCullFace"); procedure Front_Face (Face : Orientation); pragma Import (StdCall, Front_Face, "glFrontFace"); procedure Pixel_Store (Param : Enums.Pixel_Store_Param; Value : Low_Level.Bool); procedure Pixel_Store (Param : Enums.Pixel_Store_Param; Value : Size); procedure Pixel_Store (Param : Enums.Pixel_Store_Param; Value : Pixels.Alignment); pragma Import (StdCall, Pixel_Store, "glPixelStorei"); procedure Matrix_Mode (Mode : Enums.Matrix_Mode); pragma Import (StdCall, Matrix_Mode, "glMatrixMode"); procedure Frustum (Left, Right, Bottom, Top, zNear, zFar : Double); pragma Import (StdCall, Frustum, "glFrustum"); procedure Ortho (Left, Right, Bottom, Top, zNear, zFar : Double); pragma Import (StdCall, Ortho, "glOrtho"); procedure Load_Identity; pragma Import (StdCall, Load_Identity, "glLoadIdentity"); procedure Push_Matrix; pragma Import (StdCall, Push_Matrix, "glPushMatrix"); procedure Pop_Matrix; pragma Import (StdCall, Pop_Matrix, "glPopMatrix"); procedure Rotate (Angle, X, Y, Z : Double); pragma Import (StdCall, Rotate, "glRotated"); procedure Scale (X, Y, Z : Double); pragma Import (StdCall, Scale, "glScaled"); procedure Translate (X, Y, Z : Double); pragma Import (StdCall, Translate, "glTranslated"); procedure GL_Begin (Mode : Connection_Mode); pragma Import (StdCall, GL_Begin, "glBegin"); procedure GL_End; pragma Import (StdCall, GL_End, "glEnd"); procedure Color (Value : Colors.Color); pragma Import (StdCall, Color, "glColor4fv"); Secondary_Color : T70; Fog_Coord : T71; procedure Vertex_Pointer (Count : Int; Data_Type : Signed_Numeric_Type; Stride : Size; Pointer : Int); pragma Import (StdCall, Vertex_Pointer, "glVertexPointer"); procedure Index_Pointer (Data_Type : Signed_Numeric_Type; Stride : Size; Pointer : Int); pragma Import (StdCall, Index_Pointer, "glIndexPointer"); procedure Color_Pointer (Count : Int; Data_Type : Signed_Numeric_Type; Stride : Size; Pointer : Int); pragma Import (StdCall, Color_Pointer, "glColorPointer"); procedure Enable_Client_State (Cap : Fixed.Client_Side_Capability); pragma Import (StdCall, Enable_Client_State, "glEnableClientState"); procedure Disable_Client_State (Cap : Fixed.Client_Side_Capability); pragma Import (StdCall, Disable_Client_State, "glDisableClientState"); procedure Draw_Arrays (Mode : Connection_Mode; First : Int; Count : Size); pragma Import (StdCall, Draw_Arrays, "glDrawArrays"); Draw_Arrays_Instanced : T72; procedure Draw_Elements (Mode : Connection_Mode; Count : Size; Index_Type : Unsigned_Numeric_Type; Indices : Low_Level.IntPtr); pragma Import (StdCall, Draw_Elements, "glDrawElements"); Draw_Elements_Instanced : T73; Draw_Elements_Base_Vertex : T74; Draw_Transform_Feedback : T75; Draw_Transform_Feedback_Stream : T76; Primitive_Restart_Index : T77; Vertex_Attrib_Divisor : T78; procedure Load_Matrix (Value : Types.Doubles.Matrix4); pragma Import (StdCall, Load_Matrix, "glLoadMatrixd"); procedure Mult_Matrix (Factor : Types.Doubles.Matrix4); pragma Import (StdCall, Mult_Matrix, "glMultMatrixd"); procedure Vertex4 (Value : Types.Doubles.Vector4); pragma Import (StdCall, Vertex4, "glVertex4dv"); procedure Vertex3 (Value : Types.Doubles.Vector3); pragma Import (StdCall, Vertex3, "glVertex3dv"); procedure Vertex2 (Value : Types.Doubles.Vector2); pragma Import (StdCall, Vertex2, "glVertex2dv"); procedure Normal (Value : Types.Doubles.Vector3); pragma Import (StdCall, Normal, "glNormal3dv"); procedure Tex_Coord4 (Value : Types.Doubles.Vector4); pragma Import (StdCall, Tex_Coord4, "glTexCoord4dv"); procedure Tex_Coord3 (Value : Types.Doubles.Vector3); pragma Import (StdCall, Tex_Coord3, "glTexCoord3dv"); procedure Tex_Coord2 (Value : Types.Doubles.Vector2); pragma Import (StdCall, Tex_Coord2, "glTexCoord2dv"); procedure Light_Model_Color (Param : Enums.Light_Model_Ambient_Parameter; Color : Colors.Color); pragma Import (StdCall, Light_Model_Color, "glLightModelfv"); procedure Light_Model_Color_Control (Param : Enums.Light_Model_CC_Parameter; Value : access constant Fixed.Lighting.Color_Control); pragma Import (StdCall, Light_Model_Color_Control, "glLightModeliv"); procedure Light_Model_Toggles (Param : Enums.Light_Model_Toggle_Parameter; Value : access constant Int); pragma Import (StdCall, Light_Model_Toggles, "glLightModeliv"); procedure Shade_Model (Mode : Fixed.Lighting.Shade_Model); pragma Import (StdCall, Shade_Model, "glShadeModel"); procedure Light_Color (Name : Enums.Light_Name; Pname : Enums.Light_Param; Param : Colors.Color); pragma Import (StdCall, Light_Color, "glLightfv"); procedure Get_Light_Position (Name : Enums.Light_Name; Pname : Enums.Light_Param; Target : in out Types.Singles.Vector4); pragma Import (StdCall, Get_Light_Position, "glGetLightfv"); procedure Get_Light_Direction (Name : Enums.Light_Name; Pname : Enums.Light_Param; Target : in out Types.Singles.Vector3); pragma Import (StdCall, Get_Light_Direction, "glGetLightfv"); procedure Light_Position (Name : Enums.Light_Name; Pname : Enums.Light_Param; Param : Types.Singles.Vector4); pragma Import (StdCall, Light_Position, "glLightfv"); procedure Light_Direction (Name : Enums.Light_Name; Pname : Enums.Light_Param; Param : Types.Singles.Vector3); pragma Import (StdCall, Light_Direction, "glLightfv"); procedure Blend_Func (Src_Factor, Dst_Factor : Blending.Blend_Factor); pragma Import (StdCall, Blend_Func, "glBlendFunc"); Blend_Func_I : T79; Blend_Func_Separate : T80; Blend_Func_Separate_I : T81; Blend_Color : T82; Blend_Equation : T83; Blend_Equation_I : T84; Blend_Equation_Separate : T85; Blend_Equation_Separate_I : T86; procedure Line_Width (Value : Single); pragma Import (StdCall, Line_Width, "glLineWidth"); procedure Polygon_Mode (Face : Culling.Face_Selector; Value : Rasterization.Polygon_Mode_Type); pragma Import (StdCall, Polygon_Mode, "glPolygonMode"); procedure Set_Point_Size (Value : Single); pragma Import (StdCall, Set_Point_Size, "glPointSize"); Set_Point_Parameter_Single : T87; procedure Raster_Pos4 (Value : Types.Doubles.Vector4); pragma Import (StdCall, Raster_Pos4, "glRasterPos4dv"); procedure Raster_Pos3 (Value : Types.Doubles.Vector3); pragma Import (StdCall, Raster_Pos3, "glRasterPos3dv"); procedure Raster_Pos2 (Value : Types.Doubles.Vector2); pragma Import (StdCall, Raster_Pos2, "glRasterPos2dv"); procedure Set_Polygon_Offset (Factor, Units : Single); pragma Import (StdCall, Set_Polygon_Offset, "glPolygonOffset"); procedure Clear (Bits : Low_Level.Bitfield); pragma Import (StdCall, Clear, "glClear"); procedure Draw_Buffer (Mode : Buffers.Explicit_Color_Buffer_Selector); pragma Import (StdCall, Draw_Buffer, "glDrawBuffer"); Draw_Buffers : T88; procedure Clear_Color (Red, Green, Blue, Alpha : Colors.Component); pragma Import (StdCall, Clear_Color, "glClearColor"); procedure Clear_Depth (Depth : Buffers.Depth); pragma Import (StdCall, Clear_Depth, "glClearDepth"); procedure Clear_Stencil (Index : Buffers.Stencil_Index); pragma Import (StdCall, Clear_Stencil, "glClearStencil"); Clear_Accum : T82; Clear_Buffer : T89; Clear_Draw_Buffer : T90; Clear_Buffer_Depth : T91; Clear_Buffer_Stencil : T92; Clear_Buffer_Depth_Stencil : T93; procedure Depth_Mask (Value : Low_Level.Bool); pragma Import (StdCall, Depth_Mask, "glDepthMask"); procedure Depth_Func (Func : Compare_Function); pragma Import (StdCall, Depth_Func, "glDepthFunc"); Stencil_Func_Separate : T94; Stencil_Op_Separate : T95; Stencil_Mask_Separate : T96; procedure Tex_Parameter_Float (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Single); pragma Import (StdCall, Tex_Parameter_Float, "glTexParameterf"); procedure Tex_Parameter_Int (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Int); pragma Import (StdCall, Tex_Parameter_Int, "glTexParameteri"); procedure Tex_Parameter_Min_Filter (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Objects.Textures.Minifying_Function); pragma Import (StdCall, Tex_Parameter_Min_Filter, "glTexParameteri"); procedure Tex_Parameter_Mag_Filter (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Objects.Textures.Magnifying_Function); pragma Import (StdCall, Tex_Parameter_Mag_Filter, "glTexParameteri"); procedure Tex_Parameter_Wrap_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Objects.Textures.Wrapping_Mode); pragma Import (StdCall, Tex_Parameter_Wrap_Mode, "glTexParameteri"); procedure Tex_Parameter_Comp_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Enums.Textures.Compare_Kind); pragma Import (StdCall, Tex_Parameter_Comp_Mode, "glTexParameteri"); procedure Tex_Parameter_Comp_Func (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Compare_Function); pragma Import (StdCall, Tex_Parameter_Comp_Func, "glTexParameteri"); procedure Tex_Parameter_Depth_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Objects.Textures.Depth_Mode); pragma Import (StdCall, Tex_Parameter_Depth_Mode, "glTexParameteri"); procedure Tex_Parameter_Bool (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Low_Level.Bool); pragma Import (StdCall, Tex_Parameter_Bool, "glTexParameteri"); procedure Tex_Parameter_Floats (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : Low_Level.Single_Array); pragma Import (StdCall, Tex_Parameter_Floats, "glTexParameterfv"); procedure Get_Tex_Parameter_Float (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : out Single); pragma Import (StdCall, Get_Tex_Parameter_Float, "glGetTexParameterfv"); procedure Get_Tex_Parameter_Floats (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : in out Low_Level.Single_Array); pragma Import (StdCall, Get_Tex_Parameter_Floats, "glGetTexParameterfv"); procedure Get_Tex_Parameter_Int (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Int); pragma Import (StdCall, Get_Tex_Parameter_Int, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Ints (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : in out Low_Level.Int_Array); pragma Import (StdCall, Get_Tex_Parameter_Ints, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Wrap_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Objects.Textures.Wrapping_Mode); pragma Import (StdCall, Get_Tex_Parameter_Wrap_Mode, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Comp_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Enums.Textures.Compare_Kind); pragma Import (StdCall, Get_Tex_Parameter_Comp_Mode, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Comp_Func (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Compare_Function); pragma Import (StdCall, Get_Tex_Parameter_Comp_Func, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Depth_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Objects.Textures.Depth_Mode); pragma Import (StdCall, Get_Tex_Parameter_Depth_Mode, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Bool (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Low_Level.Bool); pragma Import (StdCall, Get_Tex_Parameter_Bool, "glGetTexParameteriv"); procedure Get_Tex_Level_Parameter_Size (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Param_Name : Enums.Textures.Level_Parameter; Value : out Size); pragma Import (StdCall, Get_Tex_Level_Parameter_Size, "glGetTexLevelParameteriv"); procedure Get_Tex_Level_Parameter_Format (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Param_Name : Enums.Textures.Level_Parameter; Value : out Pixels.Internal_Format); pragma Import (StdCall, Get_Tex_Level_Parameter_Format, "glGetTexLevelParameteriv"); procedure Get_Tex_Level_Parameter_Type (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Param_Name : Enums.Textures.Level_Parameter; Value : out Pixels.Channel_Data_Type); pragma Import (StdCall, Get_Tex_Level_Parameter_Type, "glGetTexLevelParameteriv"); procedure Get_Tex_Level_Parameter_Bool (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Param_Name : Enums.Textures.Level_Parameter; Value : out Low_Level.Bool); pragma Import (StdCall, Get_Tex_Level_Parameter_Bool, "glGetTexLevelParameteriv"); procedure Gen_Textures (N : Size; Textures : out UInt); pragma Import (StdCall, Gen_Textures, "glGenTextures"); procedure Bind_Texture (Target : Low_Level.Enums.Texture_Kind; Texture : UInt); pragma Import (StdCall, Bind_Texture, "glBindTexture"); procedure Delete_Textures (N : Size; Textures : Low_Level.UInt_Array); pragma Import (StdCall, Delete_Textures, "glDeleteTextures"); function Is_Texture (Texture : UInt) return Boolean; pragma Import (StdCall, Is_Texture, "glIsTexture"); procedure Tex_Image_1D (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Internal_Format : Pixels.Internal_Format; Width : Size; Border : Low_Level.Zero; Format : Pixels.Data_Format; Data_Type : Pixels.Data_Type; Data : Objects.Textures.Image_Source); pragma Import (StdCall, Tex_Image_1D, "glTexImage1D"); Compressed_Tex_Image_1D : T97; Tex_Sub_Image_1D : T98; Tex_Storage_1D : T99; procedure Tex_Image_2D (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Internal_Format : Pixels.Internal_Format; Width, Height : Size; Border : Low_Level.Zero; Format : Pixels.Data_Format; Data_Type : Pixels.Data_Type; Data : Objects.Textures.Image_Source); pragma Import (StdCall, Tex_Image_2D, "glTexImage2D"); Compressed_Tex_Image_2D : T100; procedure Tex_Sub_Image_2D (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; X_Offset, Y_Offset : Int; Width, Height : Size; Format : Pixels.Data_Format; Data_Type : Pixels.Data_Type; Data : Objects.Textures.Image_Source); pragma Import (StdCall, Tex_Sub_Image_2D, "glTexSubImage2D"); Tex_Storage_2D : T101; Tex_Image_3D : T102; Compressed_Tex_Image_3D : T103; Tex_Sub_Image_3D : T98; Tex_Storage_3D : T104; procedure Tex_Env_Float (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Single); pragma Import (StdCall, Tex_Env_Float, "glTexEnvf"); procedure Tex_Env_Int (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Int); pragma Import (StdCall, Tex_Env_Int, "glTexEnvi"); procedure Tex_Env_Tex_Func (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Fixed.Textures.Texture_Function); pragma Import (StdCall, Tex_Env_Tex_Func, "glTexEnvi"); procedure Tex_Env_Combine_Func (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Fixed.Textures.Combine_Function); pragma Import (StdCall, Tex_Env_Combine_Func, "glTexEnvi"); procedure Tex_Env_Source (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Fixed.Textures.Source_Kind); pragma Import (StdCall, Tex_Env_Source, "glTexEnvi"); procedure Tex_Env_Arr (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Low_Level.Single_Array); pragma Import (StdCall, Tex_Env_Arr, "glTexEnvfv"); procedure Tex_Env_Bool (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Low_Level.Bool); pragma Import (StdCall, Tex_Env_Bool, "glTexEnvi"); procedure Get_Tex_Env_Float (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Single); pragma Import (StdCall, Get_Tex_Env_Float, "glGetTexEnvfv"); procedure Get_Tex_Env_Tex_Func (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Fixed.Textures.Texture_Function); pragma Import (StdCall, Get_Tex_Env_Tex_Func, "glGetTexEnviv"); procedure Get_Tex_Env_Combine_Func (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Fixed.Textures.Combine_Function); pragma Import (StdCall, Get_Tex_Env_Combine_Func, "glGetTexEnviv"); procedure Get_Tex_Env_Source (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Fixed.Textures.Source_Kind); pragma Import (StdCall, Get_Tex_Env_Source, "glGetTexEnviv"); procedure Get_Tex_Env_Arr (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : in out Low_Level.Single_Array); pragma Import (StdCall, Get_Tex_Env_Arr, "glGetTexEnvfv"); procedure Get_Tex_Env_Bool (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Low_Level.Bool); pragma Import (StdCall, Get_Tex_Env_Bool, "glGetTexEnviv"); Active_Texture : T105; Generate_Mipmap : T106; Invalidate_Tex_Image : T107; Invalidate_Tex_Sub_Image : T108; Gen_Buffers : T109; Gen_Transform_Feedbacks : T109; Delete_Buffers : T110; Delete_Transform_Feedbacks : T110; Bind_Buffer : T111; Bind_Transform_Feedback : T111; Bind_Buffer_Base : T112; Buffer_Data : T113; Texture_Buffer_Data : T114; Map_Buffer : T115; Map_Buffer_Range : T116; Buffer_Pointer : T117; Buffer_Sub_Data : T118; Get_Buffer_Sub_Data : T118; Unmap_Buffer : T119; Get_Buffer_Parameter_Access_Kind : T120; Get_Buffer_Parameter_Bool : T121; Get_Buffer_Parameter_Size : T122; Get_Buffer_Parameter_Usage : T123; Invalidate_Buffer_Data : T124; Invalidate_Buffer_Sub_Data : T125; Flush_Mapped_Buffer_Range : T126; Gen_Vertex_Arrays : T127; Delete_Vertex_Arrays : T128; Bind_Vertex_Array : T129; Gen_Renderbuffers : T130; Delete_Renderbuffers : T131; Renderbuffer_Storage : T132; Renderbuffer_Storage_Multisample : T133; Bind_Renderbuffer : T134; Get_Renderbuffer_Parameter_Int : T135; Get_Renderbuffer_Parameter_Internal_Format : T136; procedure Read_Pixels (X, Y : Int; Width, Height : Size; Format : Pixels.Framebuffer_Format; Data_Type : Pixels.Data_Type; Data : System.Address); pragma Import (StdCall, Read_Pixels, "glReadPixels"); procedure Logic_Op (Value : Framebuffer.Logic_Op); pragma Import (StdCall, Logic_Op, "glLogicOp"); Clamp_Color : T137; procedure Read_Buffer (Value : Framebuffer.Read_Buffer_Selector); pragma Import (StdCall, Read_Buffer, "glReadBuffer"); Gen_Framebuffers : T138; Delete_Framebuffers : T139; Bind_Framebuffer : T140; Check_Framebuffer_Status : T141; Framebuffer_Renderbuffer : T142; Framebuffer_Texture : T143; Framebuffer_Texture_Layer : T144; Blit_Framebuffer : T145; Invalidate_Framebuffer : T146; Invalidate_Sub_Framebuffer : T147; Framebuffer_Parameter_Size : T148; Framebuffer_Parameter_Bool : T149; Get_Framebuffer_Parameter_Size : T150; Get_Framebuffer_Parameter_Bool : T151; Gen_Queries : T152; Delete_Queries : T153; Is_Query : T154; Get_Query_Object : T155; Begin_Query : T156; End_Query : T157; Begin_Query_Indexed : T158; End_Query_Indexed : T159; Query_Counter : T160; Get_Shader_Param : T161; Get_Shader_Type : T162; Create_Shader : T163; Delete_Shader : T164; Shader_Source : T165; Get_Shader_Source : T166; Compile_Shader : T164; Release_Shader_Compiler : T167; Get_Shader_Info_Log : T166; Create_Program : T168; Delete_Program : T169; Get_Program_Param : T170; Attach_Shader : T171; Link_Program : T169; Get_Program_Info_Log : T172; Get_Program_Stage : T173; Get_Subroutine_Index : T174; Get_Subroutine_Uniform_Location : T175; Use_Program : T169; Validate_Program : T169; Get_Uniform_Location : T176; Bind_Attrib_Location : T177; Get_Attrib_Location : T178; Vertex_Attrib_Pointer : T179; Vertex_AttribI_Pointer : T180; Vertex_AttribL_Pointer : T180; Enable_Vertex_Attrib_Array : T181; Disable_Vertex_Attrib_Array : T181; Get_Attached_Shaders : T182; Bind_Frag_Data_Location : T183; Get_Frag_Data_Location : T184; Begin_Transform_Feedback : T185; End_Transform_Feedback : T167; Get_Transform_Feedback_Varying : T186; Transform_Feedback_Varyings : T187; Set_Patch_Parameter_Int : T188; Set_Patch_Parameter_Float_Array : T189; procedure Depth_Range (Near, Far : Double); pragma Import (StdCall, Depth_Range, "glDepthRange"); procedure Viewport (X, Y : Int; Width, Height : Size); pragma Import (StdCall, Viewport, "glViewport"); end GL.API;
true
-- part of OpenGLAda, (c) 2017 PI:NAME:<NAME>END_PI -- released under the terms of the MIT license, see the file "COPYING" -- Autogenerated by Generate, do not edit with GL.Attributes; with GL.Blending; with GL.Buffers; with GL.Culling; with GL.Enums.Getter; with GL.Enums.Textures; with GL.Errors; with GL.Fixed.Textures; with GL.Fixed.Lighting; with GL.Framebuffer; with GL.Low_Level.Enums; with GL.Objects.Textures; with GL.Objects.Buffers; with GL.Objects.Framebuffers; with GL.Objects.Programs; with GL.Objects.Shaders; with GL.Pixels; with GL.Rasterization; with GL.Toggles; with GL.Types.Colors; with GL.Uniforms; with Interfaces.C.Strings; with System; private package GL.API is pragma Preelaborate; use GL.Types; type T1 is access procedure (P1 : Attributes.Attribute; P2 : Double); pragma Convention (StdCall, T1); type T2 is access procedure (P1 : Attributes.Attribute; P2, P3 : Double); pragma Convention (StdCall, T2); type T3 is access procedure (P1 : Attributes.Attribute; P2 : Types.Doubles.Vector2); pragma Convention (StdCall, T3); type T4 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : Double); pragma Convention (StdCall, T4); type T5 is access procedure (P1 : Attributes.Attribute; P2 : Types.Doubles.Vector3); pragma Convention (StdCall, T5); type T6 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : Double); pragma Convention (StdCall, T6); type T7 is access procedure (P1 : Attributes.Attribute; P2 : Types.Doubles.Vector4); pragma Convention (StdCall, T7); type T8 is access procedure (P1 : Uniforms.Uniform; P2 : Int); pragma Convention (StdCall, T8); type T9 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Int_Array); pragma Convention (StdCall, T9); type T10 is access procedure (P1 : Uniforms.Uniform; P2, P3 : Int); pragma Convention (StdCall, T10); type T11 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Ints.Vector2_Array); pragma Convention (StdCall, T11); type T12 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4 : Int); pragma Convention (StdCall, T12); type T13 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Ints.Vector3_Array); pragma Convention (StdCall, T13); type T14 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4, P5 : Int); pragma Convention (StdCall, T14); type T15 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Ints.Vector4_Array); pragma Convention (StdCall, T15); type T16 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Ints.Matrix2_Array); pragma Convention (StdCall, T16); type T17 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Ints.Matrix3_Array); pragma Convention (StdCall, T17); type T18 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Ints.Matrix4_Array); pragma Convention (StdCall, T18); type T19 is access procedure (P1 : Attributes.Attribute; P2 : Int); pragma Convention (StdCall, T19); type T20 is access procedure (P1 : Attributes.Attribute; P2, P3 : Int); pragma Convention (StdCall, T20); type T21 is access procedure (P1 : Attributes.Attribute; P2 : Types.Ints.Vector2); pragma Convention (StdCall, T21); type T22 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : Int); pragma Convention (StdCall, T22); type T23 is access procedure (P1 : Attributes.Attribute; P2 : Types.Ints.Vector3); pragma Convention (StdCall, T23); type T24 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : Int); pragma Convention (StdCall, T24); type T25 is access procedure (P1 : Attributes.Attribute; P2 : Types.Ints.Vector4); pragma Convention (StdCall, T25); type T26 is access procedure (P1 : Attributes.Attribute; P2 : Short); pragma Convention (StdCall, T26); type T27 is access procedure (P1 : Attributes.Attribute; P2, P3 : Short); pragma Convention (StdCall, T27); type T28 is access procedure (P1 : Attributes.Attribute; P2 : Shorts.Vector2); pragma Convention (StdCall, T28); type T29 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : Short); pragma Convention (StdCall, T29); type T30 is access procedure (P1 : Attributes.Attribute; P2 : Shorts.Vector3); pragma Convention (StdCall, T30); type T31 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : Short); pragma Convention (StdCall, T31); type T32 is access procedure (P1 : Attributes.Attribute; P2 : Shorts.Vector4); pragma Convention (StdCall, T32); type T33 is access procedure (P1 : Uniforms.Uniform; P2 : Single); pragma Convention (StdCall, T33); type T34 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Single_Array); pragma Convention (StdCall, T34); type T35 is access procedure (P1 : Uniforms.Uniform; P2, P3 : Single); pragma Convention (StdCall, T35); type T36 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Singles.Vector2_Array); pragma Convention (StdCall, T36); type T37 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4 : Single); pragma Convention (StdCall, T37); type T38 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Singles.Vector3_Array); pragma Convention (StdCall, T38); type T39 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4, P5 : Single); pragma Convention (StdCall, T39); type T40 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Types.Singles.Vector4_Array); pragma Convention (StdCall, T40); type T41 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Singles.Matrix2_Array); pragma Convention (StdCall, T41); type T42 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Singles.Matrix3_Array); pragma Convention (StdCall, T42); type T43 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : Types.Singles.Matrix4_Array); pragma Convention (StdCall, T43); type T44 is access procedure (P1 : Attributes.Attribute; P2 : Single); pragma Convention (StdCall, T44); type T45 is access procedure (P1 : Attributes.Attribute; P2, P3 : Single); pragma Convention (StdCall, T45); type T46 is access procedure (P1 : Attributes.Attribute; P2 : Types.Singles.Vector2); pragma Convention (StdCall, T46); type T47 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : Single); pragma Convention (StdCall, T47); type T48 is access procedure (P1 : Attributes.Attribute; P2 : Types.Singles.Vector3); pragma Convention (StdCall, T48); type T49 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : Single); pragma Convention (StdCall, T49); type T50 is access procedure (P1 : Attributes.Attribute; P2 : Types.Singles.Vector4); pragma Convention (StdCall, T50); type T51 is access procedure (P1 : Uniforms.Uniform; P2 : UInt); pragma Convention (StdCall, T51); type T52 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : UInt_Array); pragma Convention (StdCall, T52); type T53 is access procedure (P1 : Uniforms.Uniform; P2, P3 : UInt); pragma Convention (StdCall, T53); type T54 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : UInts.Vector2_Array); pragma Convention (StdCall, T54); type T55 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4 : UInt); pragma Convention (StdCall, T55); type T56 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : UInts.Vector3_Array); pragma Convention (StdCall, T56); type T57 is access procedure (P1 : Uniforms.Uniform; P2, P3, P4, P5 : UInt); pragma Convention (StdCall, T57); type T58 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : UInts.Vector4_Array); pragma Convention (StdCall, T58); type T59 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : UInts.Matrix2_Array); pragma Convention (StdCall, T59); type T60 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : UInts.Matrix3_Array); pragma Convention (StdCall, T60); type T61 is access procedure (P1 : Uniforms.Uniform; P2 : Size; P3 : Low_Level.Bool; P4 : UInts.Matrix4_Array); pragma Convention (StdCall, T61); type T62 is access procedure (P1 : Attributes.Attribute; P2 : UInt); pragma Convention (StdCall, T62); type T63 is access procedure (P1 : Attributes.Attribute; P2, P3 : UInt); pragma Convention (StdCall, T63); type T64 is access procedure (P1 : Attributes.Attribute; P2 : UInts.Vector2); pragma Convention (StdCall, T64); type T65 is access procedure (P1 : Attributes.Attribute; P2, P3, P4 : UInt); pragma Convention (StdCall, T65); type T66 is access procedure (P1 : Attributes.Attribute; P2 : UInts.Vector3); pragma Convention (StdCall, T66); type T67 is access procedure (P1 : Attributes.Attribute; P2, P3, P4, P5 : UInt); pragma Convention (StdCall, T67); type T68 is access procedure (P1 : Attributes.Attribute; P2 : UInts.Vector4); pragma Convention (StdCall, T68); type T69 is access function (P1 : Enums.Getter.String_Parameter; P2 : UInt) return C.Strings.chars_ptr; pragma Convention (StdCall, T69); type T70 is access procedure (P1 : Colors.Color); pragma Convention (StdCall, T70); type T71 is access procedure (P1 : Double); pragma Convention (StdCall, T71); type T72 is access procedure (P1 : Connection_Mode; P2 : Size; P3 : Size; P4 : Size); pragma Convention (StdCall, T72); type T73 is access procedure (P1 : Connection_Mode; P2 : Size; P3 : Unsigned_Numeric_Type; P4 : Low_Level.IntPtr; P5 : Size); pragma Convention (StdCall, T73); type T74 is access procedure (P1 : Connection_Mode; P2 : UInt; P3 : Unsigned_Numeric_Type; P4 : UInt; P5 : Int); pragma Convention (StdCall, T74); type T75 is access procedure (P1 : Connection_Mode; P2 : UInt); pragma Convention (StdCall, T75); type T76 is access procedure (P1 : Connection_Mode; P2 : UInt; P3 : UInt); pragma Convention (StdCall, T76); type T77 is access procedure (P1 : UInt); pragma Convention (StdCall, T77); type T78 is access procedure (P1 : GL.Attributes.Attribute; P2 : UInt); pragma Convention (StdCall, T78); type T79 is access procedure (P1 : Buffers.Draw_Buffer_Index; P2, P3 : Blending.Blend_Factor); pragma Convention (StdCall, T79); type T80 is access procedure (P1, P2, P3, P4 : Blending.Blend_Factor); pragma Convention (StdCall, T80); type T81 is access procedure (P1 : Buffers.Draw_Buffer_Index; P2, P3, P4, P5 : Blending.Blend_Factor); pragma Convention (StdCall, T81); type T82 is access procedure (P1, P2, P3, P4 : Colors.Component); pragma Convention (StdCall, T82); type T83 is access procedure (P1 : Blending.Equation); pragma Convention (StdCall, T83); type T84 is access procedure (P1 : Buffers.Draw_Buffer_Index; P2 : Blending.Equation); pragma Convention (StdCall, T84); type T85 is access procedure (P1, P2 : Blending.Equation); pragma Convention (StdCall, T85); type T86 is access procedure (P1 : Buffers.Draw_Buffer_Index; P2, P3 : Blending.Equation); pragma Convention (StdCall, T86); type T87 is access procedure (P1 : Enums.Point_Param; P2 : Single); pragma Convention (StdCall, T87); type T88 is access procedure (P1 : UInt; P2 : Buffers.Explicit_Color_Buffer_List); pragma Convention (StdCall, T88); type T89 is access procedure (P1 : Buffers.Color_Buffer_Selector; P2 : Low_Level.Zero; P3 : Colors.Color); pragma Convention (StdCall, T89); type T90 is access procedure (P1 : Low_Level.Enums.Only_Color_Buffer; P2 : Buffers.Draw_Buffer_Index; P3 : Colors.Color); pragma Convention (StdCall, T90); type T91 is access procedure (P1 : Low_Level.Enums.Only_Depth_Buffer; P2 : Low_Level.Zero; P3 : access constant Buffers.Depth); pragma Convention (StdCall, T91); type T92 is access procedure (P1 : Low_Level.Enums.Only_Stencil_Buffer; P2 : Low_Level.Zero; P3 : access constant Buffers.Stencil_Index); pragma Convention (StdCall, T92); type T93 is access procedure (P1 : Low_Level.Enums.Only_Depth_Stencil_Buffer; P2 : Low_Level.Zero; P3 : Buffers.Depth; P4 : Buffers.Stencil_Index); pragma Convention (StdCall, T93); type T94 is access procedure (P1 : Culling.Face_Selector; P2 : Compare_Function; P3 : Int; P4 : UInt); pragma Convention (StdCall, T94); type T95 is access procedure (P1 : Culling.Face_Selector; P2, P3, P4 : Buffers.Stencil_Action); pragma Convention (StdCall, T95); type T96 is access procedure (P1 : Culling.Face_Selector; P2 : UInt); pragma Convention (StdCall, T96); type T97 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4 : Size; P5 : Low_Level.Zero; P6 : Size; P7 : Objects.Textures.Image_Source); pragma Convention (StdCall, T97); type T98 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3, P4 : Int; P5, P6 : Size; P7 : Pixels.Data_Format; P8 : Pixels.Data_Type; P9 : Objects.Textures.Image_Source); pragma Convention (StdCall, T98); type T99 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4 : Size); pragma Convention (StdCall, T99); type T100 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5 : Size; P6 : Low_Level.Zero; P7 : Size; P8 : Objects.Textures.Image_Source); pragma Convention (StdCall, T100); type T101 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5 : Size); pragma Convention (StdCall, T101); type T102 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5, P6 : Size; P7 : Low_Level.Zero; P8 : Pixels.Data_Format; P9 : Pixels.Data_Type; P10 : Objects.Textures.Image_Source); pragma Convention (StdCall, T102); type T103 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5, P6 : Size; P7 : Low_Level.Zero; P8 : Size; P9 : Objects.Textures.Image_Source); pragma Convention (StdCall, T103); type T104 is access procedure (P1 : Low_Level.Enums.Texture_Kind; P2 : Objects.Textures.Mipmap_Level; P3 : Pixels.Internal_Format; P4, P5, P6 : Size); pragma Convention (StdCall, T104); type T105 is access procedure (P1 : Int); pragma Convention (StdCall, T105); type T106 is access procedure (P1 : Low_Level.Enums.Texture_Kind); pragma Convention (StdCall, T106); type T107 is access procedure (P1 : UInt; P2 : Objects.Textures.Mipmap_Level); pragma Convention (StdCall, T107); type T108 is access procedure (P1 : UInt; P2 : Objects.Textures.Mipmap_Level; P3, P4, P5 : Int; P6, P7, P8 : Size); pragma Convention (StdCall, T108); type T109 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T109); type T110 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T110); type T111 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : UInt); pragma Convention (StdCall, T111); type T112 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : UInt; P3 : UInt); pragma Convention (StdCall, T112); type T113 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Low_Level.SizeIPtr; P3 : System.Address; P4 : Objects.Buffers.Buffer_Usage); pragma Convention (StdCall, T113); type T114 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Pixels.Internal_Format; P3 : UInt); pragma Convention (StdCall, T114); type T115 is access function (P1 : Low_Level.Enums.Buffer_Kind; P2 : Objects.Access_Kind) return System.Address; pragma Convention (StdCall, T115); type T116 is access function (P1 : Low_Level.Enums.Buffer_Kind; P2 : Low_Level.IntPtr; P3 : Low_Level.SizeIPtr; P4 : Low_Level.Bitfield) return System.Address; pragma Convention (StdCall, T116); type T117 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Pointer_Param; P3 : out System.Address); pragma Convention (StdCall, T117); type T118 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Low_Level.IntPtr; P3 : Low_Level.SizeIPtr; P4 : System.Address); pragma Convention (StdCall, T118); type T119 is access procedure (P1 : Low_Level.Enums.Buffer_Kind); pragma Convention (StdCall, T119); type T120 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Param; P3 : out Objects.Access_Kind); pragma Convention (StdCall, T120); type T121 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Param; P3 : out Low_Level.Bool); pragma Convention (StdCall, T121); type T122 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Param; P3 : out Size); pragma Convention (StdCall, T122); type T123 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Enums.Buffer_Param; P3 : out Objects.Buffers.Buffer_Usage); pragma Convention (StdCall, T123); type T124 is access procedure (P1 : UInt); pragma Convention (StdCall, T124); type T125 is access procedure (P1 : UInt; P2 : Low_Level.IntPtr; P3 : Low_Level.SizeIPtr); pragma Convention (StdCall, T125); type T126 is access procedure (P1 : Low_Level.Enums.Buffer_Kind; P2 : Low_Level.IntPtr; P3 : Low_Level.SizeIPtr); pragma Convention (StdCall, T126); type T127 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T127); type T128 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T128); type T129 is access procedure (P1 : UInt); pragma Convention (StdCall, T129); type T130 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T130); type T131 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T131); type T132 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : Pixels.Internal_Format; P3, P4 : Size); pragma Convention (StdCall, T132); type T133 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : Size; P3 : Pixels.Internal_Format; P4, P5 : Size); pragma Convention (StdCall, T133); type T134 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : UInt); pragma Convention (StdCall, T134); type T135 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : Enums.Getter.Renderbuffer_Parameter; P3 : out Int); pragma Convention (StdCall, T135); type T136 is access procedure (P1 : Low_Level.Enums.Renderbuffer_Kind; P2 : Enums.Getter.Renderbuffer_Parameter; P3 : out Pixels.Internal_Format); pragma Convention (StdCall, T136); type T137 is access procedure (P1 : Enums.Clamp_Color_Param; P2 : Low_Level.Bool); pragma Convention (StdCall, T137); type T138 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T138); type T139 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T139); type T140 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : UInt); pragma Convention (StdCall, T140); type T141 is access function (P1 : Low_Level.Enums.Framebuffer_Kind) return Objects.Framebuffers.Framebuffer_Status; pragma Convention (StdCall, T141); type T142 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Objects.Framebuffers.Attachment_Point; P3 : Low_Level.Enums.Renderbuffer_Kind; P4 : UInt); pragma Convention (StdCall, T142); type T143 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Objects.Framebuffers.Attachment_Point; P3 : UInt; P4 : Objects.Textures.Mipmap_Level); pragma Convention (StdCall, T143); type T144 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Objects.Framebuffers.Attachment_Point; P3 : UInt; P4 : Objects.Textures.Mipmap_Level; P5 : Int); pragma Convention (StdCall, T144); type T145 is access procedure (P1, P2, P3, P4, P5, P6, P7, P8 : Int; P9 : Low_Level.Bitfield; P10 : Objects.Textures.Magnifying_Function); pragma Convention (StdCall, T145); type T146 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Size; P3 : Objects.Framebuffers.Attachment_List); pragma Convention (StdCall, T146); type T147 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Size; P3 : Objects.Framebuffers.Attachment_List; P4, P5 : Int; P6, P7 : Size); pragma Convention (StdCall, T147); type T148 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Enums.Framebuffer_Param; P3 : Size); pragma Convention (StdCall, T148); type T149 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Enums.Framebuffer_Param; P3 : Low_Level.Bool); pragma Convention (StdCall, T149); type T150 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Enums.Framebuffer_Param; P3 : out Size); pragma Convention (StdCall, T150); type T151 is access procedure (P1 : Low_Level.Enums.Framebuffer_Kind; P2 : Enums.Framebuffer_Param; P3 : out Low_Level.Bool); pragma Convention (StdCall, T151); type T152 is access procedure (P1 : Size; P2 : out UInt); pragma Convention (StdCall, T152); type T153 is access procedure (P1 : Size; P2 : Low_Level.UInt_Array); pragma Convention (StdCall, T153); type T154 is access function (P1 : UInt) return Boolean; pragma Convention (StdCall, T154); type T155 is access procedure (P1 : UInt; P2 : Low_Level.Enums.Query_Results; P3 : out UInt); pragma Convention (StdCall, T155); type T156 is access procedure (P1 : Low_Level.Enums.Query_Param; P2 : UInt); pragma Convention (StdCall, T156); type T157 is access procedure (P1 : Low_Level.Enums.Query_Param); pragma Convention (StdCall, T157); type T158 is access procedure (P1 : Low_Level.Enums.Query_Param; P2, P3 : UInt); pragma Convention (StdCall, T158); type T159 is access procedure (P1 : Low_Level.Enums.Query_Param; P2 : UInt); pragma Convention (StdCall, T159); type T160 is access procedure (P1 : UInt; P2 : Low_Level.Enums.Query_Param); pragma Convention (StdCall, T160); type T161 is access procedure (P1 : UInt; P2 : Enums.Shader_Param; P3 : out Int); pragma Convention (StdCall, T161); type T162 is access procedure (P1 : UInt; P2 : Enums.Shader_Param; P3 : out Objects.Shaders.Shader_Type); pragma Convention (StdCall, T162); type T163 is access function (P1 : Objects.Shaders.Shader_Type) return UInt; pragma Convention (StdCall, T163); type T164 is access procedure (P1 : UInt); pragma Convention (StdCall, T164); type T165 is access procedure (P1 : UInt; P2 : Size; P3 : Low_Level.Char_Access_Array; P4 : Low_Level.Int_Array); pragma Convention (StdCall, T165); type T166 is access procedure (P1 : UInt; P2 : Size; P3 : out Size; P4 : in out String); pragma Convention (StdCall, T166); type T167 is access procedure; pragma Convention (StdCall, T167); type T168 is access function return UInt; pragma Convention (StdCall, T168); type T169 is access procedure (P1 : UInt); pragma Convention (StdCall, T169); type T170 is access procedure (P1 : UInt; P2 : Enums.Program_Param; P3 : out Int); pragma Convention (StdCall, T170); type T171 is access procedure (P1, P2 : UInt); pragma Convention (StdCall, T171); type T172 is access procedure (P1 : UInt; P2 : Size; P3 : out Size; P4 : in out String); pragma Convention (StdCall, T172); type T173 is access procedure (P1 : UInt; P2 : Objects.Shaders.Shader_Type; P3 : Enums.Program_Stage_Param; P4 : out Size); pragma Convention (StdCall, T173); type T174 is access function (P1 : UInt; P2 : Objects.Shaders.Shader_Type; P3 : Interfaces.C.char_array) return Objects.Programs.Subroutine_Index_Type; pragma Convention (StdCall, T174); type T175 is access function (P1 : UInt; P2 : Objects.Shaders.Shader_Type; P3 : Interfaces.C.char_array) return Objects.Programs.Uniform_Location_Type; pragma Convention (StdCall, T175); type T176 is access function (P1 : UInt; P2 : C.char_array) return Uniforms.Uniform; pragma Convention (StdCall, T176); type T177 is access procedure (P1 : UInt; P2 : Attributes.Attribute; P3 : C.char_array); pragma Convention (StdCall, T177); type T178 is access function (P1 : UInt; P2 : C.char_array) return Attributes.Attribute; pragma Convention (StdCall, T178); type T179 is access procedure (P1 : Attributes.Attribute; P2 : Component_Count; P3 : Numeric_Type; P4 : Low_Level.Bool; P5 : Size; P6 : Int); pragma Convention (StdCall, T179); type T180 is access procedure (P1 : Attributes.Attribute; P2 : Component_Count; P3 : Numeric_Type; P4 : Size; P5 : Int); pragma Convention (StdCall, T180); type T181 is access procedure (P1 : Attributes.Attribute); pragma Convention (StdCall, T181); type T182 is access procedure (P1 : UInt; P2 : Size; P3 : out Size; P4 : in out UInt_Array); pragma Convention (StdCall, T182); type T183 is access procedure (P1 : UInt; P2 : Buffers.Draw_Buffer_Index; P3 : Interfaces.C.char_array); pragma Convention (StdCall, T183); type T184 is access function (P1 : UInt; P2 : Interfaces.C.char_array) return Int; pragma Convention (StdCall, T184); type T185 is access procedure (P1 : Connection_Mode); pragma Convention (StdCall, T185); type T186 is access procedure (P1 : UInt; P2 : Int; P3 : Size; P4 : out Size; P5 : out Size; P6 : out GL.Objects.Programs.Active_Attribute; P7 : in out Interfaces.C.char_array); pragma Convention (StdCall, T186); type T187 is access procedure (P1 : UInt; P2 : Size; P3 : Low_Level.Char_Access_Array; P4 : GL.Objects.Programs.Buffer_Mode); pragma Convention (StdCall, T187); type T188 is access procedure (P1 : Enums.Patch_Parameter_Int; P2 : Int); pragma Convention (StdCall, T188); type T189 is access procedure (P1 : Enums.Patch_Parameter_Float_Array; P2 : Types.Single_Array); pragma Convention (StdCall, T189); function Get_Error return Errors.Error_Code; pragma Import (StdCall, Get_Error, "glGetError"); procedure Flush; pragma Import (StdCall, Flush, "glFlush"); procedure Finish; pragma Import (StdCall, Finish, "glFinish"); procedure Get_Boolean (Name : Enums.Getter.Parameter; Target : access Low_Level.Bool); pragma Import (StdCall, Get_Boolean, "glGetBooleanv"); procedure Get_Double (Name : Enums.Getter.Parameter; Target : access Double); pragma Import (StdCall, Get_Double, "glGetDoublev"); procedure Get_Double_Vec2 (Name : Enums.Getter.Parameter; Target : in out Doubles.Vector2); pragma Import (StdCall, Get_Double_Vec2, "glGetDoublev"); procedure Get_Single (Name : Enums.Getter.Parameter; Target : access Single); pragma Import (StdCall, Get_Single, "glGetFloatv"); procedure Get_Single_Vec2 (Name : Enums.Getter.Parameter; Target : in out Singles.Vector2); pragma Import (StdCall, Get_Single_Vec2, "glGetFloatv"); procedure Get_Color (Name : Enums.Getter.Parameter; Target : in out Colors.Color); pragma Import (StdCall, Get_Color, "glGetFloatv"); procedure Get_Integer (Name : Enums.Getter.Parameter; Target : access Int); pragma Import (StdCall, Get_Integer, "glGetIntegerv"); procedure Get_Int_Vec4 (Name : Enums.Getter.Parameter; Target : in out Ints.Vector4); pragma Import (StdCall, Get_Int_Vec4, "glGetIntegerv"); procedure Get_Unsigned_Integer (Name : Enums.Getter.Parameter; Target : access UInt); pragma Import (StdCall, Get_Unsigned_Integer, "glGetIntegerv"); procedure Get_Size (Name : Enums.Getter.Parameter; Target : access Size); pragma Import (StdCall, Get_Size, "glGetIntegerv"); procedure Get_Color_Control (Name : Enums.Getter.Parameter; Target : access Fixed.Lighting.Color_Control); pragma Import (StdCall, Get_Color_Control, "glGetIntegerv"); procedure Get_Shade_Model (Name : Enums.Getter.Parameter; Target : access Fixed.Lighting.Shade_Model); pragma Import (StdCall, Get_Shade_Model, "glGetIntegerv"); procedure Get_Blend_Factor (Name : Enums.Getter.Parameter; Target : access Blending.Blend_Factor); pragma Import (StdCall, Get_Blend_Factor, "glGetIntegerv"); procedure Get_Alignment (Name : Enums.Getter.Parameter; Target : access Pixels.Alignment); pragma Import (StdCall, Get_Alignment, "glGetIntegerv"); procedure Get_Blend_Equation (Name : Enums.Getter.Parameter; Target : access Blending.Equation); pragma Import (StdCall, Get_Blend_Equation, "glGetIntegerv"); procedure Get_Compare_Function (Name : Enums.Getter.Parameter; Target : access Compare_Function); pragma Import (StdCall, Get_Compare_Function, "glGetIntegerv"); procedure Get_Orientation (Name : Enums.Getter.Parameter; Target : access Orientation); pragma Import (StdCall, Get_Orientation, "glGetIntegerv"); procedure Get_Face_Selector (Name : Enums.Getter.Parameter; Target : access Culling.Face_Selector); pragma Import (StdCall, Get_Face_Selector, "glGetIntegerv"); procedure Get_Polygon_Mode (Name : Enums.Getter.Parameter; Target : access Rasterization.Polygon_Mode_Type); pragma Import (StdCall, Get_Polygon_Mode, "glGetIntegerv"); procedure Get_Logic_Op (Name : Enums.Getter.Parameter; Target : access Framebuffer.Logic_Op); pragma Import (StdCall, Get_Logic_Op, "glGetIntegerv"); procedure Get_Stencil_Action (Name : Enums.Getter.Parameter; Target : access Buffers.Stencil_Action); pragma Import (StdCall, Get_Stencil_Action, "glGetIntegerv"); procedure Get_Read_Buffer_Selector (Name : Enums.Getter.Parameter; Target : access Framebuffer.Read_Buffer_Selector); pragma Import (StdCall, Get_Read_Buffer_Selector, "glGetIntegerv"); procedure Get_Light_Color (Name : Enums.Light_Name; Pname : Enums.Light_Param; Target : in out Colors.Color); pragma Import (StdCall, Get_Light_Color, "glGetLightfv"); function Get_String (Name : Enums.Getter.String_Parameter) return C.Strings.chars_ptr; pragma Import (StdCall, Get_String, "glGetString"); Get_String_I : T69; procedure Enable (Subject : Toggles.Toggle); pragma Import (StdCall, Enable, "glEnable"); procedure Disable (Subject : Toggles.Toggle); pragma Import (StdCall, Disable, "glDisable"); function Is_Enabled (Subject : Toggles.Toggle) return Low_Level.Bool; pragma Import (StdCall, Is_Enabled, "glIsEnabled"); procedure Cull_Face (Selector : Culling.Face_Selector); pragma Import (StdCall, Cull_Face, "glCullFace"); procedure Front_Face (Face : Orientation); pragma Import (StdCall, Front_Face, "glFrontFace"); procedure Pixel_Store (Param : Enums.Pixel_Store_Param; Value : Low_Level.Bool); procedure Pixel_Store (Param : Enums.Pixel_Store_Param; Value : Size); procedure Pixel_Store (Param : Enums.Pixel_Store_Param; Value : Pixels.Alignment); pragma Import (StdCall, Pixel_Store, "glPixelStorei"); procedure Matrix_Mode (Mode : Enums.Matrix_Mode); pragma Import (StdCall, Matrix_Mode, "glMatrixMode"); procedure Frustum (Left, Right, Bottom, Top, zNear, zFar : Double); pragma Import (StdCall, Frustum, "glFrustum"); procedure Ortho (Left, Right, Bottom, Top, zNear, zFar : Double); pragma Import (StdCall, Ortho, "glOrtho"); procedure Load_Identity; pragma Import (StdCall, Load_Identity, "glLoadIdentity"); procedure Push_Matrix; pragma Import (StdCall, Push_Matrix, "glPushMatrix"); procedure Pop_Matrix; pragma Import (StdCall, Pop_Matrix, "glPopMatrix"); procedure Rotate (Angle, X, Y, Z : Double); pragma Import (StdCall, Rotate, "glRotated"); procedure Scale (X, Y, Z : Double); pragma Import (StdCall, Scale, "glScaled"); procedure Translate (X, Y, Z : Double); pragma Import (StdCall, Translate, "glTranslated"); procedure GL_Begin (Mode : Connection_Mode); pragma Import (StdCall, GL_Begin, "glBegin"); procedure GL_End; pragma Import (StdCall, GL_End, "glEnd"); procedure Color (Value : Colors.Color); pragma Import (StdCall, Color, "glColor4fv"); Secondary_Color : T70; Fog_Coord : T71; procedure Vertex_Pointer (Count : Int; Data_Type : Signed_Numeric_Type; Stride : Size; Pointer : Int); pragma Import (StdCall, Vertex_Pointer, "glVertexPointer"); procedure Index_Pointer (Data_Type : Signed_Numeric_Type; Stride : Size; Pointer : Int); pragma Import (StdCall, Index_Pointer, "glIndexPointer"); procedure Color_Pointer (Count : Int; Data_Type : Signed_Numeric_Type; Stride : Size; Pointer : Int); pragma Import (StdCall, Color_Pointer, "glColorPointer"); procedure Enable_Client_State (Cap : Fixed.Client_Side_Capability); pragma Import (StdCall, Enable_Client_State, "glEnableClientState"); procedure Disable_Client_State (Cap : Fixed.Client_Side_Capability); pragma Import (StdCall, Disable_Client_State, "glDisableClientState"); procedure Draw_Arrays (Mode : Connection_Mode; First : Int; Count : Size); pragma Import (StdCall, Draw_Arrays, "glDrawArrays"); Draw_Arrays_Instanced : T72; procedure Draw_Elements (Mode : Connection_Mode; Count : Size; Index_Type : Unsigned_Numeric_Type; Indices : Low_Level.IntPtr); pragma Import (StdCall, Draw_Elements, "glDrawElements"); Draw_Elements_Instanced : T73; Draw_Elements_Base_Vertex : T74; Draw_Transform_Feedback : T75; Draw_Transform_Feedback_Stream : T76; Primitive_Restart_Index : T77; Vertex_Attrib_Divisor : T78; procedure Load_Matrix (Value : Types.Doubles.Matrix4); pragma Import (StdCall, Load_Matrix, "glLoadMatrixd"); procedure Mult_Matrix (Factor : Types.Doubles.Matrix4); pragma Import (StdCall, Mult_Matrix, "glMultMatrixd"); procedure Vertex4 (Value : Types.Doubles.Vector4); pragma Import (StdCall, Vertex4, "glVertex4dv"); procedure Vertex3 (Value : Types.Doubles.Vector3); pragma Import (StdCall, Vertex3, "glVertex3dv"); procedure Vertex2 (Value : Types.Doubles.Vector2); pragma Import (StdCall, Vertex2, "glVertex2dv"); procedure Normal (Value : Types.Doubles.Vector3); pragma Import (StdCall, Normal, "glNormal3dv"); procedure Tex_Coord4 (Value : Types.Doubles.Vector4); pragma Import (StdCall, Tex_Coord4, "glTexCoord4dv"); procedure Tex_Coord3 (Value : Types.Doubles.Vector3); pragma Import (StdCall, Tex_Coord3, "glTexCoord3dv"); procedure Tex_Coord2 (Value : Types.Doubles.Vector2); pragma Import (StdCall, Tex_Coord2, "glTexCoord2dv"); procedure Light_Model_Color (Param : Enums.Light_Model_Ambient_Parameter; Color : Colors.Color); pragma Import (StdCall, Light_Model_Color, "glLightModelfv"); procedure Light_Model_Color_Control (Param : Enums.Light_Model_CC_Parameter; Value : access constant Fixed.Lighting.Color_Control); pragma Import (StdCall, Light_Model_Color_Control, "glLightModeliv"); procedure Light_Model_Toggles (Param : Enums.Light_Model_Toggle_Parameter; Value : access constant Int); pragma Import (StdCall, Light_Model_Toggles, "glLightModeliv"); procedure Shade_Model (Mode : Fixed.Lighting.Shade_Model); pragma Import (StdCall, Shade_Model, "glShadeModel"); procedure Light_Color (Name : Enums.Light_Name; Pname : Enums.Light_Param; Param : Colors.Color); pragma Import (StdCall, Light_Color, "glLightfv"); procedure Get_Light_Position (Name : Enums.Light_Name; Pname : Enums.Light_Param; Target : in out Types.Singles.Vector4); pragma Import (StdCall, Get_Light_Position, "glGetLightfv"); procedure Get_Light_Direction (Name : Enums.Light_Name; Pname : Enums.Light_Param; Target : in out Types.Singles.Vector3); pragma Import (StdCall, Get_Light_Direction, "glGetLightfv"); procedure Light_Position (Name : Enums.Light_Name; Pname : Enums.Light_Param; Param : Types.Singles.Vector4); pragma Import (StdCall, Light_Position, "glLightfv"); procedure Light_Direction (Name : Enums.Light_Name; Pname : Enums.Light_Param; Param : Types.Singles.Vector3); pragma Import (StdCall, Light_Direction, "glLightfv"); procedure Blend_Func (Src_Factor, Dst_Factor : Blending.Blend_Factor); pragma Import (StdCall, Blend_Func, "glBlendFunc"); Blend_Func_I : T79; Blend_Func_Separate : T80; Blend_Func_Separate_I : T81; Blend_Color : T82; Blend_Equation : T83; Blend_Equation_I : T84; Blend_Equation_Separate : T85; Blend_Equation_Separate_I : T86; procedure Line_Width (Value : Single); pragma Import (StdCall, Line_Width, "glLineWidth"); procedure Polygon_Mode (Face : Culling.Face_Selector; Value : Rasterization.Polygon_Mode_Type); pragma Import (StdCall, Polygon_Mode, "glPolygonMode"); procedure Set_Point_Size (Value : Single); pragma Import (StdCall, Set_Point_Size, "glPointSize"); Set_Point_Parameter_Single : T87; procedure Raster_Pos4 (Value : Types.Doubles.Vector4); pragma Import (StdCall, Raster_Pos4, "glRasterPos4dv"); procedure Raster_Pos3 (Value : Types.Doubles.Vector3); pragma Import (StdCall, Raster_Pos3, "glRasterPos3dv"); procedure Raster_Pos2 (Value : Types.Doubles.Vector2); pragma Import (StdCall, Raster_Pos2, "glRasterPos2dv"); procedure Set_Polygon_Offset (Factor, Units : Single); pragma Import (StdCall, Set_Polygon_Offset, "glPolygonOffset"); procedure Clear (Bits : Low_Level.Bitfield); pragma Import (StdCall, Clear, "glClear"); procedure Draw_Buffer (Mode : Buffers.Explicit_Color_Buffer_Selector); pragma Import (StdCall, Draw_Buffer, "glDrawBuffer"); Draw_Buffers : T88; procedure Clear_Color (Red, Green, Blue, Alpha : Colors.Component); pragma Import (StdCall, Clear_Color, "glClearColor"); procedure Clear_Depth (Depth : Buffers.Depth); pragma Import (StdCall, Clear_Depth, "glClearDepth"); procedure Clear_Stencil (Index : Buffers.Stencil_Index); pragma Import (StdCall, Clear_Stencil, "glClearStencil"); Clear_Accum : T82; Clear_Buffer : T89; Clear_Draw_Buffer : T90; Clear_Buffer_Depth : T91; Clear_Buffer_Stencil : T92; Clear_Buffer_Depth_Stencil : T93; procedure Depth_Mask (Value : Low_Level.Bool); pragma Import (StdCall, Depth_Mask, "glDepthMask"); procedure Depth_Func (Func : Compare_Function); pragma Import (StdCall, Depth_Func, "glDepthFunc"); Stencil_Func_Separate : T94; Stencil_Op_Separate : T95; Stencil_Mask_Separate : T96; procedure Tex_Parameter_Float (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Single); pragma Import (StdCall, Tex_Parameter_Float, "glTexParameterf"); procedure Tex_Parameter_Int (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Int); pragma Import (StdCall, Tex_Parameter_Int, "glTexParameteri"); procedure Tex_Parameter_Min_Filter (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Objects.Textures.Minifying_Function); pragma Import (StdCall, Tex_Parameter_Min_Filter, "glTexParameteri"); procedure Tex_Parameter_Mag_Filter (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Objects.Textures.Magnifying_Function); pragma Import (StdCall, Tex_Parameter_Mag_Filter, "glTexParameteri"); procedure Tex_Parameter_Wrap_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Objects.Textures.Wrapping_Mode); pragma Import (StdCall, Tex_Parameter_Wrap_Mode, "glTexParameteri"); procedure Tex_Parameter_Comp_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Enums.Textures.Compare_Kind); pragma Import (StdCall, Tex_Parameter_Comp_Mode, "glTexParameteri"); procedure Tex_Parameter_Comp_Func (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Compare_Function); pragma Import (StdCall, Tex_Parameter_Comp_Func, "glTexParameteri"); procedure Tex_Parameter_Depth_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Objects.Textures.Depth_Mode); pragma Import (StdCall, Tex_Parameter_Depth_Mode, "glTexParameteri"); procedure Tex_Parameter_Bool (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : Low_Level.Bool); pragma Import (StdCall, Tex_Parameter_Bool, "glTexParameteri"); procedure Tex_Parameter_Floats (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : Low_Level.Single_Array); pragma Import (StdCall, Tex_Parameter_Floats, "glTexParameterfv"); procedure Get_Tex_Parameter_Float (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Value : out Single); pragma Import (StdCall, Get_Tex_Parameter_Float, "glGetTexParameterfv"); procedure Get_Tex_Parameter_Floats (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : in out Low_Level.Single_Array); pragma Import (StdCall, Get_Tex_Parameter_Floats, "glGetTexParameterfv"); procedure Get_Tex_Parameter_Int (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Int); pragma Import (StdCall, Get_Tex_Parameter_Int, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Ints (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : in out Low_Level.Int_Array); pragma Import (StdCall, Get_Tex_Parameter_Ints, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Wrap_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Objects.Textures.Wrapping_Mode); pragma Import (StdCall, Get_Tex_Parameter_Wrap_Mode, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Comp_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Enums.Textures.Compare_Kind); pragma Import (StdCall, Get_Tex_Parameter_Comp_Mode, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Comp_Func (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Compare_Function); pragma Import (StdCall, Get_Tex_Parameter_Comp_Func, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Depth_Mode (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Objects.Textures.Depth_Mode); pragma Import (StdCall, Get_Tex_Parameter_Depth_Mode, "glGetTexParameteriv"); procedure Get_Tex_Parameter_Bool (Target : Low_Level.Enums.Texture_Kind; Param_Name : Enums.Textures.Parameter; Values : out Low_Level.Bool); pragma Import (StdCall, Get_Tex_Parameter_Bool, "glGetTexParameteriv"); procedure Get_Tex_Level_Parameter_Size (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Param_Name : Enums.Textures.Level_Parameter; Value : out Size); pragma Import (StdCall, Get_Tex_Level_Parameter_Size, "glGetTexLevelParameteriv"); procedure Get_Tex_Level_Parameter_Format (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Param_Name : Enums.Textures.Level_Parameter; Value : out Pixels.Internal_Format); pragma Import (StdCall, Get_Tex_Level_Parameter_Format, "glGetTexLevelParameteriv"); procedure Get_Tex_Level_Parameter_Type (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Param_Name : Enums.Textures.Level_Parameter; Value : out Pixels.Channel_Data_Type); pragma Import (StdCall, Get_Tex_Level_Parameter_Type, "glGetTexLevelParameteriv"); procedure Get_Tex_Level_Parameter_Bool (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Param_Name : Enums.Textures.Level_Parameter; Value : out Low_Level.Bool); pragma Import (StdCall, Get_Tex_Level_Parameter_Bool, "glGetTexLevelParameteriv"); procedure Gen_Textures (N : Size; Textures : out UInt); pragma Import (StdCall, Gen_Textures, "glGenTextures"); procedure Bind_Texture (Target : Low_Level.Enums.Texture_Kind; Texture : UInt); pragma Import (StdCall, Bind_Texture, "glBindTexture"); procedure Delete_Textures (N : Size; Textures : Low_Level.UInt_Array); pragma Import (StdCall, Delete_Textures, "glDeleteTextures"); function Is_Texture (Texture : UInt) return Boolean; pragma Import (StdCall, Is_Texture, "glIsTexture"); procedure Tex_Image_1D (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Internal_Format : Pixels.Internal_Format; Width : Size; Border : Low_Level.Zero; Format : Pixels.Data_Format; Data_Type : Pixels.Data_Type; Data : Objects.Textures.Image_Source); pragma Import (StdCall, Tex_Image_1D, "glTexImage1D"); Compressed_Tex_Image_1D : T97; Tex_Sub_Image_1D : T98; Tex_Storage_1D : T99; procedure Tex_Image_2D (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; Internal_Format : Pixels.Internal_Format; Width, Height : Size; Border : Low_Level.Zero; Format : Pixels.Data_Format; Data_Type : Pixels.Data_Type; Data : Objects.Textures.Image_Source); pragma Import (StdCall, Tex_Image_2D, "glTexImage2D"); Compressed_Tex_Image_2D : T100; procedure Tex_Sub_Image_2D (Target : Low_Level.Enums.Texture_Kind; Level : Objects.Textures.Mipmap_Level; X_Offset, Y_Offset : Int; Width, Height : Size; Format : Pixels.Data_Format; Data_Type : Pixels.Data_Type; Data : Objects.Textures.Image_Source); pragma Import (StdCall, Tex_Sub_Image_2D, "glTexSubImage2D"); Tex_Storage_2D : T101; Tex_Image_3D : T102; Compressed_Tex_Image_3D : T103; Tex_Sub_Image_3D : T98; Tex_Storage_3D : T104; procedure Tex_Env_Float (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Single); pragma Import (StdCall, Tex_Env_Float, "glTexEnvf"); procedure Tex_Env_Int (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Int); pragma Import (StdCall, Tex_Env_Int, "glTexEnvi"); procedure Tex_Env_Tex_Func (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Fixed.Textures.Texture_Function); pragma Import (StdCall, Tex_Env_Tex_Func, "glTexEnvi"); procedure Tex_Env_Combine_Func (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Fixed.Textures.Combine_Function); pragma Import (StdCall, Tex_Env_Combine_Func, "glTexEnvi"); procedure Tex_Env_Source (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Fixed.Textures.Source_Kind); pragma Import (StdCall, Tex_Env_Source, "glTexEnvi"); procedure Tex_Env_Arr (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Low_Level.Single_Array); pragma Import (StdCall, Tex_Env_Arr, "glTexEnvfv"); procedure Tex_Env_Bool (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : Low_Level.Bool); pragma Import (StdCall, Tex_Env_Bool, "glTexEnvi"); procedure Get_Tex_Env_Float (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Single); pragma Import (StdCall, Get_Tex_Env_Float, "glGetTexEnvfv"); procedure Get_Tex_Env_Tex_Func (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Fixed.Textures.Texture_Function); pragma Import (StdCall, Get_Tex_Env_Tex_Func, "glGetTexEnviv"); procedure Get_Tex_Env_Combine_Func (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Fixed.Textures.Combine_Function); pragma Import (StdCall, Get_Tex_Env_Combine_Func, "glGetTexEnviv"); procedure Get_Tex_Env_Source (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Fixed.Textures.Source_Kind); pragma Import (StdCall, Get_Tex_Env_Source, "glGetTexEnviv"); procedure Get_Tex_Env_Arr (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : in out Low_Level.Single_Array); pragma Import (StdCall, Get_Tex_Env_Arr, "glGetTexEnvfv"); procedure Get_Tex_Env_Bool (Target : Enums.Textures.Env_Target; Param_Name : Enums.Textures.Env_Parameter; Value : out Low_Level.Bool); pragma Import (StdCall, Get_Tex_Env_Bool, "glGetTexEnviv"); Active_Texture : T105; Generate_Mipmap : T106; Invalidate_Tex_Image : T107; Invalidate_Tex_Sub_Image : T108; Gen_Buffers : T109; Gen_Transform_Feedbacks : T109; Delete_Buffers : T110; Delete_Transform_Feedbacks : T110; Bind_Buffer : T111; Bind_Transform_Feedback : T111; Bind_Buffer_Base : T112; Buffer_Data : T113; Texture_Buffer_Data : T114; Map_Buffer : T115; Map_Buffer_Range : T116; Buffer_Pointer : T117; Buffer_Sub_Data : T118; Get_Buffer_Sub_Data : T118; Unmap_Buffer : T119; Get_Buffer_Parameter_Access_Kind : T120; Get_Buffer_Parameter_Bool : T121; Get_Buffer_Parameter_Size : T122; Get_Buffer_Parameter_Usage : T123; Invalidate_Buffer_Data : T124; Invalidate_Buffer_Sub_Data : T125; Flush_Mapped_Buffer_Range : T126; Gen_Vertex_Arrays : T127; Delete_Vertex_Arrays : T128; Bind_Vertex_Array : T129; Gen_Renderbuffers : T130; Delete_Renderbuffers : T131; Renderbuffer_Storage : T132; Renderbuffer_Storage_Multisample : T133; Bind_Renderbuffer : T134; Get_Renderbuffer_Parameter_Int : T135; Get_Renderbuffer_Parameter_Internal_Format : T136; procedure Read_Pixels (X, Y : Int; Width, Height : Size; Format : Pixels.Framebuffer_Format; Data_Type : Pixels.Data_Type; Data : System.Address); pragma Import (StdCall, Read_Pixels, "glReadPixels"); procedure Logic_Op (Value : Framebuffer.Logic_Op); pragma Import (StdCall, Logic_Op, "glLogicOp"); Clamp_Color : T137; procedure Read_Buffer (Value : Framebuffer.Read_Buffer_Selector); pragma Import (StdCall, Read_Buffer, "glReadBuffer"); Gen_Framebuffers : T138; Delete_Framebuffers : T139; Bind_Framebuffer : T140; Check_Framebuffer_Status : T141; Framebuffer_Renderbuffer : T142; Framebuffer_Texture : T143; Framebuffer_Texture_Layer : T144; Blit_Framebuffer : T145; Invalidate_Framebuffer : T146; Invalidate_Sub_Framebuffer : T147; Framebuffer_Parameter_Size : T148; Framebuffer_Parameter_Bool : T149; Get_Framebuffer_Parameter_Size : T150; Get_Framebuffer_Parameter_Bool : T151; Gen_Queries : T152; Delete_Queries : T153; Is_Query : T154; Get_Query_Object : T155; Begin_Query : T156; End_Query : T157; Begin_Query_Indexed : T158; End_Query_Indexed : T159; Query_Counter : T160; Get_Shader_Param : T161; Get_Shader_Type : T162; Create_Shader : T163; Delete_Shader : T164; Shader_Source : T165; Get_Shader_Source : T166; Compile_Shader : T164; Release_Shader_Compiler : T167; Get_Shader_Info_Log : T166; Create_Program : T168; Delete_Program : T169; Get_Program_Param : T170; Attach_Shader : T171; Link_Program : T169; Get_Program_Info_Log : T172; Get_Program_Stage : T173; Get_Subroutine_Index : T174; Get_Subroutine_Uniform_Location : T175; Use_Program : T169; Validate_Program : T169; Get_Uniform_Location : T176; Bind_Attrib_Location : T177; Get_Attrib_Location : T178; Vertex_Attrib_Pointer : T179; Vertex_AttribI_Pointer : T180; Vertex_AttribL_Pointer : T180; Enable_Vertex_Attrib_Array : T181; Disable_Vertex_Attrib_Array : T181; Get_Attached_Shaders : T182; Bind_Frag_Data_Location : T183; Get_Frag_Data_Location : T184; Begin_Transform_Feedback : T185; End_Transform_Feedback : T167; Get_Transform_Feedback_Varying : T186; Transform_Feedback_Varyings : T187; Set_Patch_Parameter_Int : T188; Set_Patch_Parameter_Float_Array : T189; procedure Depth_Range (Near, Far : Double); pragma Import (StdCall, Depth_Range, "glDepthRange"); procedure Viewport (X, Y : Int; Width, Height : Size); pragma Import (StdCall, Viewport, "glViewport"); end GL.API;
[ { "context": " - Mockup for faces context\n-- Copyright (C) 2013 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 168, "score": 0.9998756647109985, "start": 153, "tag": "NAME", "value": "Stephane Carrez" }, { "context": " Copyright (C) 2013 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 199, "score": 0.9998811483383179, "start": 184, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "3 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 226, "score": 0.9999231100082397, "start": 201, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
asfunit/asf-contexts-faces-mockup.adb
jquorning/ada-asf
12
----------------------------------------------------------------------- -- asf-contexts-faces-mockups - Mockup for faces context -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Tests; package body ASF.Contexts.Faces.Mockup is -- ------------------------------ -- Initialize the mockup context. -- ------------------------------ overriding procedure Initialize (Context : in out Mockup_Faces_Context) is begin Faces_Context (Context).Initialize; Context.Prev_Context := Current; Context.Request := Context.Mock_Request'Unchecked_Access; Context.Response := Context.Mock_Response'Unchecked_Access; Context.Flash := Context.Flash_Ctx'Unchecked_Access; Context.Resolver.Initialize (ASF.Tests.Get_Application, Context.Request); Context.ELContext.Set_Resolver (Context.Resolver'Unchecked_Access); Context.ELContext.Set_Variable_Mapper (Context.Variables'Unchecked_Access); Context.Set_ELContext (Context.ELContext'Unchecked_Access); Context.Set_Response_Writer (Context.Output'Unchecked_Access); Context.Output.Initialize ("text/html", "UTF-8", Context.Response.Get_Output_Stream); Set_Current (Context => Context'Unchecked_Access, Application => ASF.Tests.Get_Application.all'Access); end Initialize; -- ------------------------------ -- Release any storage held by this context. -- ------------------------------ overriding procedure Finalize (Context : in out Mockup_Faces_Context) is begin Faces_Context (Context).Finalize; Restore (Context.Prev_Context); end Finalize; -- ------------------------------ -- Set the path info -- ------------------------------ procedure Set_Path_Info (Req : in out Mockup_Faces_Context; Path : in String) is begin Req.Mock_Request.Set_Path_Info (Path); end Set_Path_Info; -- ------------------------------ -- Set the parameter -- ------------------------------ procedure Set_Parameter (Req : in out Mockup_Faces_Context; Name : in String; Value : in String) is begin Req.Mock_Request.Set_Parameter (Name, Value); end Set_Parameter; -- ------------------------------ -- Sets the HTTP method. -- ------------------------------ procedure Set_Method (Req : in out Mockup_Faces_Context; Method : in String) is begin Req.Mock_Request.Set_Method (Method); end Set_Method; -- ------------------------------ -- Sets the protocol version -- ------------------------------ procedure Set_Protocol (Req : in out Mockup_Faces_Context; Protocol : in String) is begin Req.Mock_Request.Set_Protocol (Protocol); end Set_Protocol; -- ------------------------------ -- Set the request URI. -- ------------------------------ procedure Set_Request_URI (Req : in out Mockup_Faces_Context; URI : in String) is begin Req.Mock_Request.Set_Request_URI (URI); end Set_Request_URI; -- ------------------------------ -- Sets the peer address -- ------------------------------ procedure Set_Remote_Addr (Req : in out Mockup_Faces_Context; Addr : in String) is begin Req.Mock_Request.Set_Remote_Addr (Addr); end Set_Remote_Addr; -- ------------------------------ -- Set the request cookie by using the cookie returned in the response. -- ------------------------------ procedure Set_Cookie (Req : in out Mockup_Faces_Context; From : in ASF.Responses.Mockup.Response'Class) is begin Req.Mock_Request.Set_Cookie (From); end Set_Cookie; -- ------------------------------ -- Get the content written to the mockup output stream. -- ------------------------------ procedure Read_Response (Resp : in out Mockup_Faces_Context; Into : out Ada.Strings.Unbounded.Unbounded_String) is begin Resp.Mock_Response.Read_Content (Into); end Read_Response; end ASF.Contexts.Faces.Mockup;
23775
----------------------------------------------------------------------- -- asf-contexts-faces-mockups - Mockup for faces context -- Copyright (C) 2013 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Tests; package body ASF.Contexts.Faces.Mockup is -- ------------------------------ -- Initialize the mockup context. -- ------------------------------ overriding procedure Initialize (Context : in out Mockup_Faces_Context) is begin Faces_Context (Context).Initialize; Context.Prev_Context := Current; Context.Request := Context.Mock_Request'Unchecked_Access; Context.Response := Context.Mock_Response'Unchecked_Access; Context.Flash := Context.Flash_Ctx'Unchecked_Access; Context.Resolver.Initialize (ASF.Tests.Get_Application, Context.Request); Context.ELContext.Set_Resolver (Context.Resolver'Unchecked_Access); Context.ELContext.Set_Variable_Mapper (Context.Variables'Unchecked_Access); Context.Set_ELContext (Context.ELContext'Unchecked_Access); Context.Set_Response_Writer (Context.Output'Unchecked_Access); Context.Output.Initialize ("text/html", "UTF-8", Context.Response.Get_Output_Stream); Set_Current (Context => Context'Unchecked_Access, Application => ASF.Tests.Get_Application.all'Access); end Initialize; -- ------------------------------ -- Release any storage held by this context. -- ------------------------------ overriding procedure Finalize (Context : in out Mockup_Faces_Context) is begin Faces_Context (Context).Finalize; Restore (Context.Prev_Context); end Finalize; -- ------------------------------ -- Set the path info -- ------------------------------ procedure Set_Path_Info (Req : in out Mockup_Faces_Context; Path : in String) is begin Req.Mock_Request.Set_Path_Info (Path); end Set_Path_Info; -- ------------------------------ -- Set the parameter -- ------------------------------ procedure Set_Parameter (Req : in out Mockup_Faces_Context; Name : in String; Value : in String) is begin Req.Mock_Request.Set_Parameter (Name, Value); end Set_Parameter; -- ------------------------------ -- Sets the HTTP method. -- ------------------------------ procedure Set_Method (Req : in out Mockup_Faces_Context; Method : in String) is begin Req.Mock_Request.Set_Method (Method); end Set_Method; -- ------------------------------ -- Sets the protocol version -- ------------------------------ procedure Set_Protocol (Req : in out Mockup_Faces_Context; Protocol : in String) is begin Req.Mock_Request.Set_Protocol (Protocol); end Set_Protocol; -- ------------------------------ -- Set the request URI. -- ------------------------------ procedure Set_Request_URI (Req : in out Mockup_Faces_Context; URI : in String) is begin Req.Mock_Request.Set_Request_URI (URI); end Set_Request_URI; -- ------------------------------ -- Sets the peer address -- ------------------------------ procedure Set_Remote_Addr (Req : in out Mockup_Faces_Context; Addr : in String) is begin Req.Mock_Request.Set_Remote_Addr (Addr); end Set_Remote_Addr; -- ------------------------------ -- Set the request cookie by using the cookie returned in the response. -- ------------------------------ procedure Set_Cookie (Req : in out Mockup_Faces_Context; From : in ASF.Responses.Mockup.Response'Class) is begin Req.Mock_Request.Set_Cookie (From); end Set_Cookie; -- ------------------------------ -- Get the content written to the mockup output stream. -- ------------------------------ procedure Read_Response (Resp : in out Mockup_Faces_Context; Into : out Ada.Strings.Unbounded.Unbounded_String) is begin Resp.Mock_Response.Read_Content (Into); end Read_Response; end ASF.Contexts.Faces.Mockup;
true
----------------------------------------------------------------------- -- asf-contexts-faces-mockups - Mockup for faces context -- Copyright (C) 2013 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Tests; package body ASF.Contexts.Faces.Mockup is -- ------------------------------ -- Initialize the mockup context. -- ------------------------------ overriding procedure Initialize (Context : in out Mockup_Faces_Context) is begin Faces_Context (Context).Initialize; Context.Prev_Context := Current; Context.Request := Context.Mock_Request'Unchecked_Access; Context.Response := Context.Mock_Response'Unchecked_Access; Context.Flash := Context.Flash_Ctx'Unchecked_Access; Context.Resolver.Initialize (ASF.Tests.Get_Application, Context.Request); Context.ELContext.Set_Resolver (Context.Resolver'Unchecked_Access); Context.ELContext.Set_Variable_Mapper (Context.Variables'Unchecked_Access); Context.Set_ELContext (Context.ELContext'Unchecked_Access); Context.Set_Response_Writer (Context.Output'Unchecked_Access); Context.Output.Initialize ("text/html", "UTF-8", Context.Response.Get_Output_Stream); Set_Current (Context => Context'Unchecked_Access, Application => ASF.Tests.Get_Application.all'Access); end Initialize; -- ------------------------------ -- Release any storage held by this context. -- ------------------------------ overriding procedure Finalize (Context : in out Mockup_Faces_Context) is begin Faces_Context (Context).Finalize; Restore (Context.Prev_Context); end Finalize; -- ------------------------------ -- Set the path info -- ------------------------------ procedure Set_Path_Info (Req : in out Mockup_Faces_Context; Path : in String) is begin Req.Mock_Request.Set_Path_Info (Path); end Set_Path_Info; -- ------------------------------ -- Set the parameter -- ------------------------------ procedure Set_Parameter (Req : in out Mockup_Faces_Context; Name : in String; Value : in String) is begin Req.Mock_Request.Set_Parameter (Name, Value); end Set_Parameter; -- ------------------------------ -- Sets the HTTP method. -- ------------------------------ procedure Set_Method (Req : in out Mockup_Faces_Context; Method : in String) is begin Req.Mock_Request.Set_Method (Method); end Set_Method; -- ------------------------------ -- Sets the protocol version -- ------------------------------ procedure Set_Protocol (Req : in out Mockup_Faces_Context; Protocol : in String) is begin Req.Mock_Request.Set_Protocol (Protocol); end Set_Protocol; -- ------------------------------ -- Set the request URI. -- ------------------------------ procedure Set_Request_URI (Req : in out Mockup_Faces_Context; URI : in String) is begin Req.Mock_Request.Set_Request_URI (URI); end Set_Request_URI; -- ------------------------------ -- Sets the peer address -- ------------------------------ procedure Set_Remote_Addr (Req : in out Mockup_Faces_Context; Addr : in String) is begin Req.Mock_Request.Set_Remote_Addr (Addr); end Set_Remote_Addr; -- ------------------------------ -- Set the request cookie by using the cookie returned in the response. -- ------------------------------ procedure Set_Cookie (Req : in out Mockup_Faces_Context; From : in ASF.Responses.Mockup.Response'Class) is begin Req.Mock_Request.Set_Cookie (From); end Set_Cookie; -- ------------------------------ -- Get the content written to the mockup output stream. -- ------------------------------ procedure Read_Response (Resp : in out Mockup_Faces_Context; Into : out Ada.Strings.Unbounded.Unbounded_String) is begin Resp.Mock_Response.Read_Content (Into); end Read_Response; end ASF.Contexts.Faces.Mockup;
[ { "context": "-- Global types\n-- Copyright (C) 2014, 2015, 2019 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 152, "score": 0.9998852610588074, "start": 137, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "C) 2014, 2015, 2019 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 183, "score": 0.9998895525932312, "start": 168, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "9 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 210, "score": 0.9999260902404785, "start": 185, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
mat/src/mat-types.adb
stcarrez/mat
7
----------------------------------------------------------------------- -- mat-types -- Global types -- Copyright (C) 2014, 2015, 2019 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Strings; package body MAT.Types is -- ------------------------------ -- Return an hexadecimal string representation of the value. -- ------------------------------ function Hex_Image (Value : in Uint32; Length : in Positive := 8) return String is use type Interfaces.Unsigned_32; Conversion : constant String (1 .. 16) := "0123456789ABCDEF"; S : String (1 .. Length) := (others => '0'); P : Uint32 := Value; N : Uint32; I : Positive := Length; begin while P /= 0 loop N := P mod 16; P := P / 16; S (I) := Conversion (Natural (N + 1)); exit when I = 1; I := I - 1; end loop; return S; end Hex_Image; -- ------------------------------ -- Return an hexadecimal string representation of the value. -- ------------------------------ function Hex_Image (Value : in Uint64; Length : in Positive := 16) return String is use type Interfaces.Unsigned_64; Conversion : constant String (1 .. 16) := "0123456789ABCDEF"; S : String (1 .. Length) := (others => '0'); P : Uint64 := Value; N : Uint64; I : Positive := Length; begin while P /= 0 loop N := P mod 16; P := P / 16; S (I) := Conversion (Natural (N + 1)); exit when I = 1; I := I - 1; end loop; return S; end Hex_Image; -- ------------------------------ -- Format the target time to a printable representation. -- ------------------------------ function Tick_Image (Value : in Target_Tick_Ref) return String is use Interfaces; Sec : constant Unsigned_32 := Unsigned_32 (Interfaces.Shift_Right (Uint64 (Value), 32)); Usec : constant Unsigned_32 := Interfaces.Unsigned_32 (Value and 16#0ffffffff#); Frac : constant String := Interfaces.Unsigned_32'Image (Usec); Img : String (1 .. 6) := (others => '0'); begin Img (Img'Last - Frac'Length + 2 .. Img'Last) := Frac (Frac'First + 1 .. Frac'Last); return Interfaces.Unsigned_32'Image (Sec) & "." & Img; end Tick_Image; -- ------------------------------ -- Convert the string in the form NN.MM into a tick value. -- ------------------------------ function Tick_Value (Value : in String) return Target_Tick_Ref is use Interfaces; Pos : constant Natural := Util.Strings.Index (Value, '.'); Frac : Uint64; Val : Uint64; begin if Pos > 0 then Frac := Uint64'Value (Value (Pos + 1 .. Value'Last)); for I in 1 .. 6 - (Value'Last - Pos) loop Frac := Frac * 10; end loop; if Pos > Value'First then Val := Uint64'Value (Value (Value'First .. Pos - 1)); else Val := 0; end if; else Frac := 0; Val := Uint64'Value (Value); end if; return Target_Tick_Ref (Val * 1_000_000 + Frac); end Tick_Value; -- ------------------------------ -- Convert the hexadecimal string into an unsigned integer. -- ------------------------------ function Hex_Value (Value : in String) return Uint64 is use type Interfaces.Unsigned_64; Result : Uint64 := 0; begin if Value'Length = 0 then raise Constraint_Error with "Empty string"; end if; for I in Value'Range loop declare C : constant Character := Value (I); begin if C >= '0' and C <= '9' then Result := (Result * 16) + (Character'Pos (C) - Character'Pos ('0')); elsif C >= 'A' and C <= 'F' then Result := (Result * 16) + (Character'Pos (C) - Character'Pos ('A') + 10); elsif C >= 'a' and C <= 'f' then Result := (Result * 16) + (Character'Pos (C) - Character'Pos ('a') + 10); else raise Constraint_Error with "Invalid character: " & C; end if; end; end loop; return Result; end Hex_Value; end MAT.Types;
22598
----------------------------------------------------------------------- -- mat-types -- Global types -- Copyright (C) 2014, 2015, 2019 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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.Strings; package body MAT.Types is -- ------------------------------ -- Return an hexadecimal string representation of the value. -- ------------------------------ function Hex_Image (Value : in Uint32; Length : in Positive := 8) return String is use type Interfaces.Unsigned_32; Conversion : constant String (1 .. 16) := "0123456789ABCDEF"; S : String (1 .. Length) := (others => '0'); P : Uint32 := Value; N : Uint32; I : Positive := Length; begin while P /= 0 loop N := P mod 16; P := P / 16; S (I) := Conversion (Natural (N + 1)); exit when I = 1; I := I - 1; end loop; return S; end Hex_Image; -- ------------------------------ -- Return an hexadecimal string representation of the value. -- ------------------------------ function Hex_Image (Value : in Uint64; Length : in Positive := 16) return String is use type Interfaces.Unsigned_64; Conversion : constant String (1 .. 16) := "0123456789ABCDEF"; S : String (1 .. Length) := (others => '0'); P : Uint64 := Value; N : Uint64; I : Positive := Length; begin while P /= 0 loop N := P mod 16; P := P / 16; S (I) := Conversion (Natural (N + 1)); exit when I = 1; I := I - 1; end loop; return S; end Hex_Image; -- ------------------------------ -- Format the target time to a printable representation. -- ------------------------------ function Tick_Image (Value : in Target_Tick_Ref) return String is use Interfaces; Sec : constant Unsigned_32 := Unsigned_32 (Interfaces.Shift_Right (Uint64 (Value), 32)); Usec : constant Unsigned_32 := Interfaces.Unsigned_32 (Value and 16#0ffffffff#); Frac : constant String := Interfaces.Unsigned_32'Image (Usec); Img : String (1 .. 6) := (others => '0'); begin Img (Img'Last - Frac'Length + 2 .. Img'Last) := Frac (Frac'First + 1 .. Frac'Last); return Interfaces.Unsigned_32'Image (Sec) & "." & Img; end Tick_Image; -- ------------------------------ -- Convert the string in the form NN.MM into a tick value. -- ------------------------------ function Tick_Value (Value : in String) return Target_Tick_Ref is use Interfaces; Pos : constant Natural := Util.Strings.Index (Value, '.'); Frac : Uint64; Val : Uint64; begin if Pos > 0 then Frac := Uint64'Value (Value (Pos + 1 .. Value'Last)); for I in 1 .. 6 - (Value'Last - Pos) loop Frac := Frac * 10; end loop; if Pos > Value'First then Val := Uint64'Value (Value (Value'First .. Pos - 1)); else Val := 0; end if; else Frac := 0; Val := Uint64'Value (Value); end if; return Target_Tick_Ref (Val * 1_000_000 + Frac); end Tick_Value; -- ------------------------------ -- Convert the hexadecimal string into an unsigned integer. -- ------------------------------ function Hex_Value (Value : in String) return Uint64 is use type Interfaces.Unsigned_64; Result : Uint64 := 0; begin if Value'Length = 0 then raise Constraint_Error with "Empty string"; end if; for I in Value'Range loop declare C : constant Character := Value (I); begin if C >= '0' and C <= '9' then Result := (Result * 16) + (Character'Pos (C) - Character'Pos ('0')); elsif C >= 'A' and C <= 'F' then Result := (Result * 16) + (Character'Pos (C) - Character'Pos ('A') + 10); elsif C >= 'a' and C <= 'f' then Result := (Result * 16) + (Character'Pos (C) - Character'Pos ('a') + 10); else raise Constraint_Error with "Invalid character: " & C; end if; end; end loop; return Result; end Hex_Value; end MAT.Types;
true
----------------------------------------------------------------------- -- mat-types -- Global types -- Copyright (C) 2014, 2015, 2019 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- 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.Strings; package body MAT.Types is -- ------------------------------ -- Return an hexadecimal string representation of the value. -- ------------------------------ function Hex_Image (Value : in Uint32; Length : in Positive := 8) return String is use type Interfaces.Unsigned_32; Conversion : constant String (1 .. 16) := "0123456789ABCDEF"; S : String (1 .. Length) := (others => '0'); P : Uint32 := Value; N : Uint32; I : Positive := Length; begin while P /= 0 loop N := P mod 16; P := P / 16; S (I) := Conversion (Natural (N + 1)); exit when I = 1; I := I - 1; end loop; return S; end Hex_Image; -- ------------------------------ -- Return an hexadecimal string representation of the value. -- ------------------------------ function Hex_Image (Value : in Uint64; Length : in Positive := 16) return String is use type Interfaces.Unsigned_64; Conversion : constant String (1 .. 16) := "0123456789ABCDEF"; S : String (1 .. Length) := (others => '0'); P : Uint64 := Value; N : Uint64; I : Positive := Length; begin while P /= 0 loop N := P mod 16; P := P / 16; S (I) := Conversion (Natural (N + 1)); exit when I = 1; I := I - 1; end loop; return S; end Hex_Image; -- ------------------------------ -- Format the target time to a printable representation. -- ------------------------------ function Tick_Image (Value : in Target_Tick_Ref) return String is use Interfaces; Sec : constant Unsigned_32 := Unsigned_32 (Interfaces.Shift_Right (Uint64 (Value), 32)); Usec : constant Unsigned_32 := Interfaces.Unsigned_32 (Value and 16#0ffffffff#); Frac : constant String := Interfaces.Unsigned_32'Image (Usec); Img : String (1 .. 6) := (others => '0'); begin Img (Img'Last - Frac'Length + 2 .. Img'Last) := Frac (Frac'First + 1 .. Frac'Last); return Interfaces.Unsigned_32'Image (Sec) & "." & Img; end Tick_Image; -- ------------------------------ -- Convert the string in the form NN.MM into a tick value. -- ------------------------------ function Tick_Value (Value : in String) return Target_Tick_Ref is use Interfaces; Pos : constant Natural := Util.Strings.Index (Value, '.'); Frac : Uint64; Val : Uint64; begin if Pos > 0 then Frac := Uint64'Value (Value (Pos + 1 .. Value'Last)); for I in 1 .. 6 - (Value'Last - Pos) loop Frac := Frac * 10; end loop; if Pos > Value'First then Val := Uint64'Value (Value (Value'First .. Pos - 1)); else Val := 0; end if; else Frac := 0; Val := Uint64'Value (Value); end if; return Target_Tick_Ref (Val * 1_000_000 + Frac); end Tick_Value; -- ------------------------------ -- Convert the hexadecimal string into an unsigned integer. -- ------------------------------ function Hex_Value (Value : in String) return Uint64 is use type Interfaces.Unsigned_64; Result : Uint64 := 0; begin if Value'Length = 0 then raise Constraint_Error with "Empty string"; end if; for I in Value'Range loop declare C : constant Character := Value (I); begin if C >= '0' and C <= '9' then Result := (Result * 16) + (Character'Pos (C) - Character'Pos ('0')); elsif C >= 'A' and C <= 'F' then Result := (Result * 16) + (Character'Pos (C) - Character'Pos ('A') + 10); elsif C >= 'a' and C <= 'f' then Result := (Result * 16) + (Character'Pos (C) - Character'Pos ('a') + 10); else raise Constraint_Error with "Invalid character: " & C; end if; end; end loop; return Result; end Hex_Value; end MAT.Types;
[ { "context": "package body Givens_Rotation\n-- Copyright (C) 2018 Jonathan S. Parker.\n--\n-- Permission to use, copy, modify, and/or di", "end": 149, "score": 0.9998719096183777, "start": 131, "tag": "NAME", "value": "Jonathan S. Parker" } ]
linear_algebra/givens_rotation.adb
jscparker/math_packages
30
--------------------------------------------------------------------------- -- package body Givens_Rotation -- Copyright (C) 2018 Jonathan S. Parker. -- -- 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 Hypot; package body Givens_Rotation is package Hypotenuse is new Hypot (Real); use Hypotenuse; Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; ----------------------------------- -- Get_Rotation_That_Zeros_Out_L -- ----------------------------------- -- P = Pivot, L = Low. -- -- cos = P/r, sin = L/r, Hypot = r = sqrt(P*P + L*L) -- -- clockwise rotation: notice all rotations are centered on the diagonal -- -- 1 0 0 0 0 0 0 -- 0 c s 0 0 P r -- 0 -s c 0 0 x L = 0 -- 0 0 0 1 0 0 0 -- 0 0 0 0 1 0 0 -- -- -- if |L| >= |P| then t = P/L <= 1 -- if |P| > |L| then t = L/P < 1 -- -- -- let t = smaller / larger -- -- let u = 1/sqrt(1+t*t) and w = sqrt(t*t/(1+t*t)) with -- -- use (1 - 1/sqrt(1+t*t)) * (1 + 1/sqrt(1+t*t)) = t*t / (1 + t*t) -- -- 1/sqrt(1+t*t) - 1 = - t*t/(sqrt(1+t*t) + 1+t*t) -- = -(t/(sqrt(1+t*t))*(t/(1 + Sqrt(1+t*t))) -- = - Abs (w) * Abs (t)/(1+ sqrt(1+t*t)) -- = u_lo -- -- u_hi = 1 => u_lo + u_hi = 1/sqrt(1+t*t) = u = Abs (cs) if a<b -- -- hypot = |L| * sqrt(1+t*t) = |L| * (1 + t*t/(1+sqrt(1+t*t)) = hi + lo if t<1 -- -- P : Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot -- L : Real := A(Low_Row, Pivot_Col); procedure Get_Rotation_That_Zeros_Out_Low (Pivot, Low : in Real; sn, cs : out Real; cs_minus_1 : out Real; sn_minus_1 : out Real; hypot : out Real; P_bigger_than_L : out Boolean; Skip_Rotation : out Boolean) is Emax : constant Integer := Real'Machine_Emax; Emin : constant Integer := Real'Machine_Emin; P, L, Abs_P, Abs_L : Real; min_arg_over_hypot, max_arg_over_hypot_minus_1 : Real; begin if (not Low'Valid) or (not Pivot'Valid) then raise Constraint_Error with "Invalid input data in Get_Rotation..."; end if; P := Pivot; L := Low; Abs_P := Abs (P); Abs_L := Abs (L); -- default: no rotation is performed. sn := Zero; cs := One; sn_minus_1 := -One; cs_minus_1 := Zero; hypot := Abs_P; P_bigger_than_L := True; Skip_Rotation := True; if Abs_L < Two**Emin then Skip_Rotation := True; -- use defaults return; end if; if Abs_P < Two**Emin then if Abs_L > Two**Emin then sn := One; cs := Zero; sn_minus_1 := Zero; cs_minus_1 := -One; hypot := Abs_L; P_bigger_than_L := False; Skip_Rotation := False; return; else Skip_Rotation := True; -- use defaults return; end if; end if; -- if the Low val is too small compared to the pivot, then -- it contributes nothing to pivot after rotation ... but the row -- still might contribute elsewhere. if Abs_L < Two**(Emax - Emax/10 - Real'Machine_Radix - 1) and then Abs_L * Two**(Emax/10 + Real'Machine_Radix) < Abs_P then Skip_Rotation := True; return; -- use defaults, Skip_Rotation. end if; -- essential optimisation. if Abs_P > Abs_L then -- |s| <= |c| Skip_Rotation := False; P_bigger_than_L := True; -- Want P>0 always, (for efficiency, since we use cos = P/R = 1 + (cos-1)), -- so if P<0 then flip signs of both P and L -- to ensure zero'd out element. if P < Zero then P := -P; L := -L; end if; Get_Hypotenuse (P, L, hypot, min_arg_over_hypot, max_arg_over_hypot_minus_1); --cs := P / hypot; -- normally unused; set to default sn := Real'Copy_Sign (min_arg_over_hypot, L); --sn := L / hypot; cs_minus_1 := max_arg_over_hypot_minus_1; --cs_minus_1 := -Abs (sn) * Abs_L / hypot_plus_max_arg; --cs_minus_1_over_sn := -L / hypot_plus_max_arg; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1: NOTICE <= ! Skip_Rotation := False; P_bigger_than_L := False; -- Want L>0 always. If L<0 then flip signs of both P and L -- to ensure zero'd out element. if L < Zero then P := -P; L := -L; end if; Get_Hypotenuse (P, L, hypot, min_arg_over_hypot, max_arg_over_hypot_minus_1); --sn := L / hypot; -- set to default; unused cs := Real'Copy_Sign (min_arg_over_hypot, P); --cs := P / hypot; sn_minus_1 := max_arg_over_hypot_minus_1; --sn_minus_1 := -Abs (cs) * Abs_P / hypot_plus_max_arg; --sn_minus_1_over_cs := -P / hypot_plus_max_arg; end if; end Get_Rotation_That_Zeros_Out_Low; end Givens_Rotation;
18754
--------------------------------------------------------------------------- -- package body Givens_Rotation -- Copyright (C) 2018 <NAME>. -- -- 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 Hypot; package body Givens_Rotation is package Hypotenuse is new Hypot (Real); use Hypotenuse; Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; ----------------------------------- -- Get_Rotation_That_Zeros_Out_L -- ----------------------------------- -- P = Pivot, L = Low. -- -- cos = P/r, sin = L/r, Hypot = r = sqrt(P*P + L*L) -- -- clockwise rotation: notice all rotations are centered on the diagonal -- -- 1 0 0 0 0 0 0 -- 0 c s 0 0 P r -- 0 -s c 0 0 x L = 0 -- 0 0 0 1 0 0 0 -- 0 0 0 0 1 0 0 -- -- -- if |L| >= |P| then t = P/L <= 1 -- if |P| > |L| then t = L/P < 1 -- -- -- let t = smaller / larger -- -- let u = 1/sqrt(1+t*t) and w = sqrt(t*t/(1+t*t)) with -- -- use (1 - 1/sqrt(1+t*t)) * (1 + 1/sqrt(1+t*t)) = t*t / (1 + t*t) -- -- 1/sqrt(1+t*t) - 1 = - t*t/(sqrt(1+t*t) + 1+t*t) -- = -(t/(sqrt(1+t*t))*(t/(1 + Sqrt(1+t*t))) -- = - Abs (w) * Abs (t)/(1+ sqrt(1+t*t)) -- = u_lo -- -- u_hi = 1 => u_lo + u_hi = 1/sqrt(1+t*t) = u = Abs (cs) if a<b -- -- hypot = |L| * sqrt(1+t*t) = |L| * (1 + t*t/(1+sqrt(1+t*t)) = hi + lo if t<1 -- -- P : Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot -- L : Real := A(Low_Row, Pivot_Col); procedure Get_Rotation_That_Zeros_Out_Low (Pivot, Low : in Real; sn, cs : out Real; cs_minus_1 : out Real; sn_minus_1 : out Real; hypot : out Real; P_bigger_than_L : out Boolean; Skip_Rotation : out Boolean) is Emax : constant Integer := Real'Machine_Emax; Emin : constant Integer := Real'Machine_Emin; P, L, Abs_P, Abs_L : Real; min_arg_over_hypot, max_arg_over_hypot_minus_1 : Real; begin if (not Low'Valid) or (not Pivot'Valid) then raise Constraint_Error with "Invalid input data in Get_Rotation..."; end if; P := Pivot; L := Low; Abs_P := Abs (P); Abs_L := Abs (L); -- default: no rotation is performed. sn := Zero; cs := One; sn_minus_1 := -One; cs_minus_1 := Zero; hypot := Abs_P; P_bigger_than_L := True; Skip_Rotation := True; if Abs_L < Two**Emin then Skip_Rotation := True; -- use defaults return; end if; if Abs_P < Two**Emin then if Abs_L > Two**Emin then sn := One; cs := Zero; sn_minus_1 := Zero; cs_minus_1 := -One; hypot := Abs_L; P_bigger_than_L := False; Skip_Rotation := False; return; else Skip_Rotation := True; -- use defaults return; end if; end if; -- if the Low val is too small compared to the pivot, then -- it contributes nothing to pivot after rotation ... but the row -- still might contribute elsewhere. if Abs_L < Two**(Emax - Emax/10 - Real'Machine_Radix - 1) and then Abs_L * Two**(Emax/10 + Real'Machine_Radix) < Abs_P then Skip_Rotation := True; return; -- use defaults, Skip_Rotation. end if; -- essential optimisation. if Abs_P > Abs_L then -- |s| <= |c| Skip_Rotation := False; P_bigger_than_L := True; -- Want P>0 always, (for efficiency, since we use cos = P/R = 1 + (cos-1)), -- so if P<0 then flip signs of both P and L -- to ensure zero'd out element. if P < Zero then P := -P; L := -L; end if; Get_Hypotenuse (P, L, hypot, min_arg_over_hypot, max_arg_over_hypot_minus_1); --cs := P / hypot; -- normally unused; set to default sn := Real'Copy_Sign (min_arg_over_hypot, L); --sn := L / hypot; cs_minus_1 := max_arg_over_hypot_minus_1; --cs_minus_1 := -Abs (sn) * Abs_L / hypot_plus_max_arg; --cs_minus_1_over_sn := -L / hypot_plus_max_arg; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1: NOTICE <= ! Skip_Rotation := False; P_bigger_than_L := False; -- Want L>0 always. If L<0 then flip signs of both P and L -- to ensure zero'd out element. if L < Zero then P := -P; L := -L; end if; Get_Hypotenuse (P, L, hypot, min_arg_over_hypot, max_arg_over_hypot_minus_1); --sn := L / hypot; -- set to default; unused cs := Real'Copy_Sign (min_arg_over_hypot, P); --cs := P / hypot; sn_minus_1 := max_arg_over_hypot_minus_1; --sn_minus_1 := -Abs (cs) * Abs_P / hypot_plus_max_arg; --sn_minus_1_over_cs := -P / hypot_plus_max_arg; end if; end Get_Rotation_That_Zeros_Out_Low; end Givens_Rotation;
true
--------------------------------------------------------------------------- -- package body Givens_Rotation -- Copyright (C) 2018 PI:NAME:<NAME>END_PI. -- -- 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 Hypot; package body Givens_Rotation is package Hypotenuse is new Hypot (Real); use Hypotenuse; Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; ----------------------------------- -- Get_Rotation_That_Zeros_Out_L -- ----------------------------------- -- P = Pivot, L = Low. -- -- cos = P/r, sin = L/r, Hypot = r = sqrt(P*P + L*L) -- -- clockwise rotation: notice all rotations are centered on the diagonal -- -- 1 0 0 0 0 0 0 -- 0 c s 0 0 P r -- 0 -s c 0 0 x L = 0 -- 0 0 0 1 0 0 0 -- 0 0 0 0 1 0 0 -- -- -- if |L| >= |P| then t = P/L <= 1 -- if |P| > |L| then t = L/P < 1 -- -- -- let t = smaller / larger -- -- let u = 1/sqrt(1+t*t) and w = sqrt(t*t/(1+t*t)) with -- -- use (1 - 1/sqrt(1+t*t)) * (1 + 1/sqrt(1+t*t)) = t*t / (1 + t*t) -- -- 1/sqrt(1+t*t) - 1 = - t*t/(sqrt(1+t*t) + 1+t*t) -- = -(t/(sqrt(1+t*t))*(t/(1 + Sqrt(1+t*t))) -- = - Abs (w) * Abs (t)/(1+ sqrt(1+t*t)) -- = u_lo -- -- u_hi = 1 => u_lo + u_hi = 1/sqrt(1+t*t) = u = Abs (cs) if a<b -- -- hypot = |L| * sqrt(1+t*t) = |L| * (1 + t*t/(1+sqrt(1+t*t)) = hi + lo if t<1 -- -- P : Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot -- L : Real := A(Low_Row, Pivot_Col); procedure Get_Rotation_That_Zeros_Out_Low (Pivot, Low : in Real; sn, cs : out Real; cs_minus_1 : out Real; sn_minus_1 : out Real; hypot : out Real; P_bigger_than_L : out Boolean; Skip_Rotation : out Boolean) is Emax : constant Integer := Real'Machine_Emax; Emin : constant Integer := Real'Machine_Emin; P, L, Abs_P, Abs_L : Real; min_arg_over_hypot, max_arg_over_hypot_minus_1 : Real; begin if (not Low'Valid) or (not Pivot'Valid) then raise Constraint_Error with "Invalid input data in Get_Rotation..."; end if; P := Pivot; L := Low; Abs_P := Abs (P); Abs_L := Abs (L); -- default: no rotation is performed. sn := Zero; cs := One; sn_minus_1 := -One; cs_minus_1 := Zero; hypot := Abs_P; P_bigger_than_L := True; Skip_Rotation := True; if Abs_L < Two**Emin then Skip_Rotation := True; -- use defaults return; end if; if Abs_P < Two**Emin then if Abs_L > Two**Emin then sn := One; cs := Zero; sn_minus_1 := Zero; cs_minus_1 := -One; hypot := Abs_L; P_bigger_than_L := False; Skip_Rotation := False; return; else Skip_Rotation := True; -- use defaults return; end if; end if; -- if the Low val is too small compared to the pivot, then -- it contributes nothing to pivot after rotation ... but the row -- still might contribute elsewhere. if Abs_L < Two**(Emax - Emax/10 - Real'Machine_Radix - 1) and then Abs_L * Two**(Emax/10 + Real'Machine_Radix) < Abs_P then Skip_Rotation := True; return; -- use defaults, Skip_Rotation. end if; -- essential optimisation. if Abs_P > Abs_L then -- |s| <= |c| Skip_Rotation := False; P_bigger_than_L := True; -- Want P>0 always, (for efficiency, since we use cos = P/R = 1 + (cos-1)), -- so if P<0 then flip signs of both P and L -- to ensure zero'd out element. if P < Zero then P := -P; L := -L; end if; Get_Hypotenuse (P, L, hypot, min_arg_over_hypot, max_arg_over_hypot_minus_1); --cs := P / hypot; -- normally unused; set to default sn := Real'Copy_Sign (min_arg_over_hypot, L); --sn := L / hypot; cs_minus_1 := max_arg_over_hypot_minus_1; --cs_minus_1 := -Abs (sn) * Abs_L / hypot_plus_max_arg; --cs_minus_1_over_sn := -L / hypot_plus_max_arg; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1: NOTICE <= ! Skip_Rotation := False; P_bigger_than_L := False; -- Want L>0 always. If L<0 then flip signs of both P and L -- to ensure zero'd out element. if L < Zero then P := -P; L := -L; end if; Get_Hypotenuse (P, L, hypot, min_arg_over_hypot, max_arg_over_hypot_minus_1); --sn := L / hypot; -- set to default; unused cs := Real'Copy_Sign (min_arg_over_hypot, P); --cs := P / hypot; sn_minus_1 := max_arg_over_hypot_minus_1; --sn_minus_1 := -Abs (cs) * Abs_P / hypot_plus_max_arg; --sn_minus_1_over_cs := -P / hypot_plus_max_arg; end if; end Get_Rotation_That_Zeros_Out_Low; end Givens_Rotation;
[ { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --\n-- All rig", "end": 829, "score": 0.9998877644538879, "start": 816, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --\n-- All rights reserved. ", "end": 849, "score": 0.9999328851699829, "start": 831, "tag": "EMAIL", "value": "vgodunko@gmail.com" } ]
source/amf/uml/amf-internals-uml_final_states.adb
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Elements; with AMF.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.UML_Attributes; with AMF.Visitors.UML_Iterators; with AMF.Visitors.UML_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.UML_Final_States is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Final_State_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Final_State (AMF.UML.Final_States.UML_Final_State_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Final_State_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Final_State (AMF.UML.Final_States.UML_Final_State_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Final_State_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.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Final_State (Visitor, AMF.UML.Final_States.UML_Final_State_Access (Self), Control); end if; end Visit_Element; -------------------- -- Get_Connection -- -------------------- overriding function Get_Connection (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Connection_Point_References.Collections.Set_Of_UML_Connection_Point_Reference is begin return AMF.UML.Connection_Point_References.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Connection (Self.Element))); end Get_Connection; -------------------------- -- Get_Connection_Point -- -------------------------- overriding function Get_Connection_Point (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Pseudostates.Collections.Set_Of_UML_Pseudostate is begin return AMF.UML.Pseudostates.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Connection_Point (Self.Element))); end Get_Connection_Point; ---------------------------- -- Get_Deferrable_Trigger -- ---------------------------- overriding function Get_Deferrable_Trigger (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Triggers.Collections.Set_Of_UML_Trigger is begin return AMF.UML.Triggers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Deferrable_Trigger (Self.Element))); end Get_Deferrable_Trigger; --------------------- -- Get_Do_Activity -- --------------------- overriding function Get_Do_Activity (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Do_Activity (Self.Element))); end Get_Do_Activity; --------------------- -- Set_Do_Activity -- --------------------- overriding procedure Set_Do_Activity (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Do_Activity (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Do_Activity; --------------- -- Get_Entry -- --------------- overriding function Get_Entry (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Entry (Self.Element))); end Get_Entry; --------------- -- Set_Entry -- --------------- overriding procedure Set_Entry (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Entry (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Entry; -------------- -- Get_Exit -- -------------- overriding function Get_Exit (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Exit (Self.Element))); end Get_Exit; -------------- -- Set_Exit -- -------------- overriding procedure Set_Exit (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Exit (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Exit; ---------------------- -- Get_Is_Composite -- ---------------------- overriding function Get_Is_Composite (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Composite (Self.Element); end Get_Is_Composite; ----------------------- -- Get_Is_Orthogonal -- ----------------------- overriding function Get_Is_Orthogonal (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Orthogonal (Self.Element); end Get_Is_Orthogonal; ------------------- -- Get_Is_Simple -- ------------------- overriding function Get_Is_Simple (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Simple (Self.Element); end Get_Is_Simple; ----------------------------- -- Get_Is_Submachine_State -- ----------------------------- overriding function Get_Is_Submachine_State (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Submachine_State (Self.Element); end Get_Is_Submachine_State; ------------------------- -- Get_Redefined_State -- ------------------------- overriding function Get_Redefined_State (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.States.UML_State_Access is begin return AMF.UML.States.UML_State_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_State (Self.Element))); end Get_Redefined_State; ------------------------- -- Set_Redefined_State -- ------------------------- overriding procedure Set_Redefined_State (Self : not null access UML_Final_State_Proxy; To : AMF.UML.States.UML_State_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Redefined_State (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Redefined_State; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin raise Program_Error; return Get_Redefinition_Context (Self); end Get_Redefinition_Context; ---------------- -- Get_Region -- ---------------- overriding function Get_Region (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Regions.Collections.Set_Of_UML_Region is begin return AMF.UML.Regions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Region (Self.Element))); end Get_Region; ------------------------- -- Get_State_Invariant -- ------------------------- overriding function Get_State_Invariant (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Constraints.UML_Constraint_Access is begin return AMF.UML.Constraints.UML_Constraint_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_State_Invariant (Self.Element))); end Get_State_Invariant; ------------------------- -- Set_State_Invariant -- ------------------------- overriding procedure Set_State_Invariant (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Constraints.UML_Constraint_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_State_Invariant (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_State_Invariant; -------------------- -- Get_Submachine -- -------------------- overriding function Get_Submachine (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.State_Machines.UML_State_Machine_Access is begin return AMF.UML.State_Machines.UML_State_Machine_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Submachine (Self.Element))); end Get_Submachine; -------------------- -- Set_Submachine -- -------------------- overriding procedure Set_Submachine (Self : not null access UML_Final_State_Proxy; To : AMF.UML.State_Machines.UML_State_Machine_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Submachine (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Submachine; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access UML_Final_State_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_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 UML_Final_State_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.UML_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Final_State_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.UML_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 UML_Final_State_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.UML_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Final_State_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.UML_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_Element_Import -- ------------------------ overriding function Get_Element_Import (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Element_Import (Self.Element))); end Get_Element_Import; ------------------------- -- Get_Imported_Member -- ------------------------- overriding function Get_Imported_Member (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Imported_Member (Self.Element))); end Get_Imported_Member; ---------------- -- Get_Member -- ---------------- overriding function Get_Member (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Member (Self.Element))); end Get_Member; ---------------------- -- Get_Owned_Member -- ---------------------- overriding function Get_Owned_Member (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Owned_Member (Self.Element))); end Get_Owned_Member; -------------------- -- Get_Owned_Rule -- -------------------- overriding function Get_Owned_Rule (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Owned_Rule (Self.Element))); end Get_Owned_Rule; ------------------------ -- Get_Package_Import -- ------------------------ overriding function Get_Package_Import (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Package_Import (Self.Element))); end Get_Package_Import; ------------------- -- Get_Container -- ------------------- overriding function Get_Container (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Regions.UML_Region_Access is begin return AMF.UML.Regions.UML_Region_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Container (Self.Element))); end Get_Container; ------------------- -- Set_Container -- ------------------- overriding procedure Set_Container (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Regions.UML_Region_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Container (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Container; ------------------ -- Get_Incoming -- ------------------ overriding function Get_Incoming (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin return AMF.UML.Transitions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming (Self.Element))); end Get_Incoming; ------------------ -- Get_Outgoing -- ------------------ overriding function Get_Outgoing (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin return AMF.UML.Transitions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing (Self.Element))); end Get_Outgoing; ------------------------------ -- Containing_State_Machine -- ------------------------------ overriding function Containing_State_Machine (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.State_Machines.UML_State_Machine_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Containing_State_Machine unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Containing_State_Machine"; return Containing_State_Machine (Self); end Containing_State_Machine; ------------------ -- Is_Composite -- ------------------ overriding function Is_Composite (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Composite unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Composite"; return Is_Composite (Self); end Is_Composite; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ------------------- -- Is_Orthogonal -- ------------------- overriding function Is_Orthogonal (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Orthogonal unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Orthogonal"; return Is_Orthogonal (Self); end Is_Orthogonal; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Final_State_Proxy; Redefined : AMF.UML.States.UML_State_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 UML_Final_State_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; --------------- -- Is_Simple -- --------------- overriding function Is_Simple (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Simple unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Simple"; return Is_Simple (Self); end Is_Simple; ------------------------- -- Is_Submachine_State -- ------------------------- overriding function Is_Submachine_State (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Submachine_State unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Submachine_State"; return Is_Submachine_State (Self); end Is_Submachine_State; -------------------------- -- Redefinition_Context -- -------------------------- overriding function Redefinition_Context (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Redefinition_Context unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Redefinition_Context"; return Redefinition_Context (Self); end Redefinition_Context; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Final_State_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 UML_Final_State_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 UML_Final_State_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 UML_Final_State_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Namespace"; return Namespace (Self); end Namespace; ------------------------ -- Exclude_Collisions -- ------------------------ overriding function Exclude_Collisions (Self : not null access constant UML_Final_State_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 UML_Final_State_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 UML_Final_State_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 UML_Final_State_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 UML_Final_State_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 UML_Final_State_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Members_Are_Distinguishable"; return Members_Are_Distinguishable (Self); end Members_Are_Distinguishable; ------------------ -- Owned_Member -- ------------------ overriding function Owned_Member (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; -------------- -- Incoming -- -------------- overriding function Incoming (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Incoming unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Incoming"; return Incoming (Self); end Incoming; -------------- -- Outgoing -- -------------- overriding function Outgoing (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Outgoing unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Outgoing"; return Outgoing (Self); end Outgoing; end AMF.Internals.UML_Final_States;
14033
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- 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.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.UML_Attributes; with AMF.Visitors.UML_Iterators; with AMF.Visitors.UML_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.UML_Final_States is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Final_State_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Final_State (AMF.UML.Final_States.UML_Final_State_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Final_State_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Final_State (AMF.UML.Final_States.UML_Final_State_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Final_State_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.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Final_State (Visitor, AMF.UML.Final_States.UML_Final_State_Access (Self), Control); end if; end Visit_Element; -------------------- -- Get_Connection -- -------------------- overriding function Get_Connection (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Connection_Point_References.Collections.Set_Of_UML_Connection_Point_Reference is begin return AMF.UML.Connection_Point_References.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Connection (Self.Element))); end Get_Connection; -------------------------- -- Get_Connection_Point -- -------------------------- overriding function Get_Connection_Point (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Pseudostates.Collections.Set_Of_UML_Pseudostate is begin return AMF.UML.Pseudostates.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Connection_Point (Self.Element))); end Get_Connection_Point; ---------------------------- -- Get_Deferrable_Trigger -- ---------------------------- overriding function Get_Deferrable_Trigger (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Triggers.Collections.Set_Of_UML_Trigger is begin return AMF.UML.Triggers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Deferrable_Trigger (Self.Element))); end Get_Deferrable_Trigger; --------------------- -- Get_Do_Activity -- --------------------- overriding function Get_Do_Activity (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Do_Activity (Self.Element))); end Get_Do_Activity; --------------------- -- Set_Do_Activity -- --------------------- overriding procedure Set_Do_Activity (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Do_Activity (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Do_Activity; --------------- -- Get_Entry -- --------------- overriding function Get_Entry (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Entry (Self.Element))); end Get_Entry; --------------- -- Set_Entry -- --------------- overriding procedure Set_Entry (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Entry (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Entry; -------------- -- Get_Exit -- -------------- overriding function Get_Exit (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Exit (Self.Element))); end Get_Exit; -------------- -- Set_Exit -- -------------- overriding procedure Set_Exit (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Exit (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Exit; ---------------------- -- Get_Is_Composite -- ---------------------- overriding function Get_Is_Composite (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Composite (Self.Element); end Get_Is_Composite; ----------------------- -- Get_Is_Orthogonal -- ----------------------- overriding function Get_Is_Orthogonal (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Orthogonal (Self.Element); end Get_Is_Orthogonal; ------------------- -- Get_Is_Simple -- ------------------- overriding function Get_Is_Simple (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Simple (Self.Element); end Get_Is_Simple; ----------------------------- -- Get_Is_Submachine_State -- ----------------------------- overriding function Get_Is_Submachine_State (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Submachine_State (Self.Element); end Get_Is_Submachine_State; ------------------------- -- Get_Redefined_State -- ------------------------- overriding function Get_Redefined_State (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.States.UML_State_Access is begin return AMF.UML.States.UML_State_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_State (Self.Element))); end Get_Redefined_State; ------------------------- -- Set_Redefined_State -- ------------------------- overriding procedure Set_Redefined_State (Self : not null access UML_Final_State_Proxy; To : AMF.UML.States.UML_State_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Redefined_State (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Redefined_State; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin raise Program_Error; return Get_Redefinition_Context (Self); end Get_Redefinition_Context; ---------------- -- Get_Region -- ---------------- overriding function Get_Region (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Regions.Collections.Set_Of_UML_Region is begin return AMF.UML.Regions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Region (Self.Element))); end Get_Region; ------------------------- -- Get_State_Invariant -- ------------------------- overriding function Get_State_Invariant (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Constraints.UML_Constraint_Access is begin return AMF.UML.Constraints.UML_Constraint_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_State_Invariant (Self.Element))); end Get_State_Invariant; ------------------------- -- Set_State_Invariant -- ------------------------- overriding procedure Set_State_Invariant (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Constraints.UML_Constraint_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_State_Invariant (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_State_Invariant; -------------------- -- Get_Submachine -- -------------------- overriding function Get_Submachine (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.State_Machines.UML_State_Machine_Access is begin return AMF.UML.State_Machines.UML_State_Machine_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Submachine (Self.Element))); end Get_Submachine; -------------------- -- Set_Submachine -- -------------------- overriding procedure Set_Submachine (Self : not null access UML_Final_State_Proxy; To : AMF.UML.State_Machines.UML_State_Machine_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Submachine (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Submachine; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access UML_Final_State_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_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 UML_Final_State_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.UML_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Final_State_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.UML_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 UML_Final_State_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.UML_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Final_State_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.UML_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_Element_Import -- ------------------------ overriding function Get_Element_Import (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Element_Import (Self.Element))); end Get_Element_Import; ------------------------- -- Get_Imported_Member -- ------------------------- overriding function Get_Imported_Member (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Imported_Member (Self.Element))); end Get_Imported_Member; ---------------- -- Get_Member -- ---------------- overriding function Get_Member (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Member (Self.Element))); end Get_Member; ---------------------- -- Get_Owned_Member -- ---------------------- overriding function Get_Owned_Member (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Owned_Member (Self.Element))); end Get_Owned_Member; -------------------- -- Get_Owned_Rule -- -------------------- overriding function Get_Owned_Rule (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Owned_Rule (Self.Element))); end Get_Owned_Rule; ------------------------ -- Get_Package_Import -- ------------------------ overriding function Get_Package_Import (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Package_Import (Self.Element))); end Get_Package_Import; ------------------- -- Get_Container -- ------------------- overriding function Get_Container (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Regions.UML_Region_Access is begin return AMF.UML.Regions.UML_Region_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Container (Self.Element))); end Get_Container; ------------------- -- Set_Container -- ------------------- overriding procedure Set_Container (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Regions.UML_Region_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Container (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Container; ------------------ -- Get_Incoming -- ------------------ overriding function Get_Incoming (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin return AMF.UML.Transitions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming (Self.Element))); end Get_Incoming; ------------------ -- Get_Outgoing -- ------------------ overriding function Get_Outgoing (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin return AMF.UML.Transitions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing (Self.Element))); end Get_Outgoing; ------------------------------ -- Containing_State_Machine -- ------------------------------ overriding function Containing_State_Machine (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.State_Machines.UML_State_Machine_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Containing_State_Machine unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Containing_State_Machine"; return Containing_State_Machine (Self); end Containing_State_Machine; ------------------ -- Is_Composite -- ------------------ overriding function Is_Composite (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Composite unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Composite"; return Is_Composite (Self); end Is_Composite; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ------------------- -- Is_Orthogonal -- ------------------- overriding function Is_Orthogonal (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Orthogonal unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Orthogonal"; return Is_Orthogonal (Self); end Is_Orthogonal; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Final_State_Proxy; Redefined : AMF.UML.States.UML_State_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 UML_Final_State_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; --------------- -- Is_Simple -- --------------- overriding function Is_Simple (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Simple unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Simple"; return Is_Simple (Self); end Is_Simple; ------------------------- -- Is_Submachine_State -- ------------------------- overriding function Is_Submachine_State (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Submachine_State unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Submachine_State"; return Is_Submachine_State (Self); end Is_Submachine_State; -------------------------- -- Redefinition_Context -- -------------------------- overriding function Redefinition_Context (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Redefinition_Context unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Redefinition_Context"; return Redefinition_Context (Self); end Redefinition_Context; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Final_State_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 UML_Final_State_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 UML_Final_State_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 UML_Final_State_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Namespace"; return Namespace (Self); end Namespace; ------------------------ -- Exclude_Collisions -- ------------------------ overriding function Exclude_Collisions (Self : not null access constant UML_Final_State_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 UML_Final_State_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 UML_Final_State_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 UML_Final_State_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 UML_Final_State_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 UML_Final_State_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Members_Are_Distinguishable"; return Members_Are_Distinguishable (Self); end Members_Are_Distinguishable; ------------------ -- Owned_Member -- ------------------ overriding function Owned_Member (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; -------------- -- Incoming -- -------------- overriding function Incoming (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Incoming unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Incoming"; return Incoming (Self); end Incoming; -------------- -- Outgoing -- -------------- overriding function Outgoing (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Outgoing unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Outgoing"; return Outgoing (Self); end Outgoing; end AMF.Internals.UML_Final_States;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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.Internals.Element_Collections; with AMF.Internals.Helpers; with AMF.Internals.Tables.UML_Attributes; with AMF.Visitors.UML_Iterators; with AMF.Visitors.UML_Visitors; with League.Strings.Internals; with Matreshka.Internals.Strings; package body AMF.Internals.UML_Final_States is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Final_State_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Enter_Final_State (AMF.UML.Final_States.UML_Final_State_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Final_State_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then AMF.Visitors.UML_Visitors.UML_Visitor'Class (Visitor).Leave_Final_State (AMF.UML.Final_States.UML_Final_State_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Final_State_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.UML_Iterators.UML_Iterator'Class then AMF.Visitors.UML_Iterators.UML_Iterator'Class (Iterator).Visit_Final_State (Visitor, AMF.UML.Final_States.UML_Final_State_Access (Self), Control); end if; end Visit_Element; -------------------- -- Get_Connection -- -------------------- overriding function Get_Connection (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Connection_Point_References.Collections.Set_Of_UML_Connection_Point_Reference is begin return AMF.UML.Connection_Point_References.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Connection (Self.Element))); end Get_Connection; -------------------------- -- Get_Connection_Point -- -------------------------- overriding function Get_Connection_Point (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Pseudostates.Collections.Set_Of_UML_Pseudostate is begin return AMF.UML.Pseudostates.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Connection_Point (Self.Element))); end Get_Connection_Point; ---------------------------- -- Get_Deferrable_Trigger -- ---------------------------- overriding function Get_Deferrable_Trigger (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Triggers.Collections.Set_Of_UML_Trigger is begin return AMF.UML.Triggers.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Deferrable_Trigger (Self.Element))); end Get_Deferrable_Trigger; --------------------- -- Get_Do_Activity -- --------------------- overriding function Get_Do_Activity (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Do_Activity (Self.Element))); end Get_Do_Activity; --------------------- -- Set_Do_Activity -- --------------------- overriding procedure Set_Do_Activity (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Do_Activity (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Do_Activity; --------------- -- Get_Entry -- --------------- overriding function Get_Entry (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Entry (Self.Element))); end Get_Entry; --------------- -- Set_Entry -- --------------- overriding procedure Set_Entry (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Entry (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Entry; -------------- -- Get_Exit -- -------------- overriding function Get_Exit (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Behaviors.UML_Behavior_Access is begin return AMF.UML.Behaviors.UML_Behavior_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Exit (Self.Element))); end Get_Exit; -------------- -- Set_Exit -- -------------- overriding procedure Set_Exit (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Behaviors.UML_Behavior_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Exit (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Exit; ---------------------- -- Get_Is_Composite -- ---------------------- overriding function Get_Is_Composite (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Composite (Self.Element); end Get_Is_Composite; ----------------------- -- Get_Is_Orthogonal -- ----------------------- overriding function Get_Is_Orthogonal (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Orthogonal (Self.Element); end Get_Is_Orthogonal; ------------------- -- Get_Is_Simple -- ------------------- overriding function Get_Is_Simple (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Simple (Self.Element); end Get_Is_Simple; ----------------------------- -- Get_Is_Submachine_State -- ----------------------------- overriding function Get_Is_Submachine_State (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Submachine_State (Self.Element); end Get_Is_Submachine_State; ------------------------- -- Get_Redefined_State -- ------------------------- overriding function Get_Redefined_State (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.States.UML_State_Access is begin return AMF.UML.States.UML_State_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Redefined_State (Self.Element))); end Get_Redefined_State; ------------------------- -- Set_Redefined_State -- ------------------------- overriding procedure Set_Redefined_State (Self : not null access UML_Final_State_Proxy; To : AMF.UML.States.UML_State_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Redefined_State (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Redefined_State; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin raise Program_Error; return Get_Redefinition_Context (Self); end Get_Redefinition_Context; ---------------- -- Get_Region -- ---------------- overriding function Get_Region (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Regions.Collections.Set_Of_UML_Region is begin return AMF.UML.Regions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Region (Self.Element))); end Get_Region; ------------------------- -- Get_State_Invariant -- ------------------------- overriding function Get_State_Invariant (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Constraints.UML_Constraint_Access is begin return AMF.UML.Constraints.UML_Constraint_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_State_Invariant (Self.Element))); end Get_State_Invariant; ------------------------- -- Set_State_Invariant -- ------------------------- overriding procedure Set_State_Invariant (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Constraints.UML_Constraint_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_State_Invariant (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_State_Invariant; -------------------- -- Get_Submachine -- -------------------- overriding function Get_Submachine (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.State_Machines.UML_State_Machine_Access is begin return AMF.UML.State_Machines.UML_State_Machine_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Submachine (Self.Element))); end Get_Submachine; -------------------- -- Set_Submachine -- -------------------- overriding procedure Set_Submachine (Self : not null access UML_Final_State_Proxy; To : AMF.UML.State_Machines.UML_State_Machine_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Submachine (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Submachine; ----------------- -- Get_Is_Leaf -- ----------------- overriding function Get_Is_Leaf (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Is_Leaf (Self.Element); end Get_Is_Leaf; ----------------- -- Set_Is_Leaf -- ----------------- overriding procedure Set_Is_Leaf (Self : not null access UML_Final_State_Proxy; To : Boolean) is begin AMF.Internals.Tables.UML_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 UML_Final_State_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.UML_Attributes.Internal_Get_Redefined_Element (Self.Element))); end Get_Redefined_Element; ------------------------------ -- Get_Redefinition_Context -- ------------------------------ overriding function Get_Redefinition_Context (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Redefinition_Context (Self.Element))); end Get_Redefinition_Context; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Client_Dependency (Self.Element))); end Get_Client_Dependency; ------------------------- -- Get_Name_Expression -- ------------------------- overriding function Get_Name_Expression (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Name_Expression (Self.Element))); end Get_Name_Expression; ------------------------- -- Set_Name_Expression -- ------------------------- overriding procedure Set_Name_Expression (Self : not null access UML_Final_State_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is begin AMF.Internals.Tables.UML_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 UML_Final_State_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.UML_Attributes.Internal_Get_Namespace (Self.Element))); end Get_Namespace; ------------------------ -- Get_Qualified_Name -- ------------------------ overriding function Get_Qualified_Name (Self : not null access constant UML_Final_State_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.UML_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_Element_Import -- ------------------------ overriding function Get_Element_Import (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Element_Import (Self.Element))); end Get_Element_Import; ------------------------- -- Get_Imported_Member -- ------------------------- overriding function Get_Imported_Member (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Imported_Member (Self.Element))); end Get_Imported_Member; ---------------- -- Get_Member -- ---------------- overriding function Get_Member (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Member (Self.Element))); end Get_Member; ---------------------- -- Get_Owned_Member -- ---------------------- overriding function Get_Owned_Member (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Owned_Member (Self.Element))); end Get_Owned_Member; -------------------- -- Get_Owned_Rule -- -------------------- overriding function Get_Owned_Rule (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Owned_Rule (Self.Element))); end Get_Owned_Rule; ------------------------ -- Get_Package_Import -- ------------------------ overriding function Get_Package_Import (Self : not null access constant UML_Final_State_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.UML_Attributes.Internal_Get_Package_Import (Self.Element))); end Get_Package_Import; ------------------- -- Get_Container -- ------------------- overriding function Get_Container (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Regions.UML_Region_Access is begin return AMF.UML.Regions.UML_Region_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Container (Self.Element))); end Get_Container; ------------------- -- Set_Container -- ------------------- overriding procedure Set_Container (Self : not null access UML_Final_State_Proxy; To : AMF.UML.Regions.UML_Region_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Container (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Container; ------------------ -- Get_Incoming -- ------------------ overriding function Get_Incoming (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin return AMF.UML.Transitions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Incoming (Self.Element))); end Get_Incoming; ------------------ -- Get_Outgoing -- ------------------ overriding function Get_Outgoing (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin return AMF.UML.Transitions.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Outgoing (Self.Element))); end Get_Outgoing; ------------------------------ -- Containing_State_Machine -- ------------------------------ overriding function Containing_State_Machine (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.State_Machines.UML_State_Machine_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Containing_State_Machine unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Containing_State_Machine"; return Containing_State_Machine (Self); end Containing_State_Machine; ------------------ -- Is_Composite -- ------------------ overriding function Is_Composite (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Composite unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Composite"; return Is_Composite (Self); end Is_Composite; ------------------------ -- Is_Consistent_With -- ------------------------ overriding function Is_Consistent_With (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Is_Consistent_With"; return Is_Consistent_With (Self, Redefinee); end Is_Consistent_With; ------------------- -- Is_Orthogonal -- ------------------- overriding function Is_Orthogonal (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Orthogonal unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Orthogonal"; return Is_Orthogonal (Self); end Is_Orthogonal; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Final_State_Proxy; Redefined : AMF.UML.States.UML_State_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 UML_Final_State_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; --------------- -- Is_Simple -- --------------- overriding function Is_Simple (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Simple unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Simple"; return Is_Simple (Self); end Is_Simple; ------------------------- -- Is_Submachine_State -- ------------------------- overriding function Is_Submachine_State (Self : not null access constant UML_Final_State_Proxy) return Boolean is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Is_Submachine_State unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Is_Submachine_State"; return Is_Submachine_State (Self); end Is_Submachine_State; -------------------------- -- Redefinition_Context -- -------------------------- overriding function Redefinition_Context (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Classifiers.UML_Classifier_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Redefinition_Context unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Redefinition_Context"; return Redefinition_Context (Self); end Redefinition_Context; ----------------------------------- -- Is_Redefinition_Context_Valid -- ----------------------------------- overriding function Is_Redefinition_Context_Valid (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Is_Redefinition_Context_Valid"; return Is_Redefinition_Context_Valid (Self, Redefined); end Is_Redefinition_Context_Valid; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Final_State_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 UML_Final_State_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 UML_Final_State_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 UML_Final_State_Proxy.Is_Distinguishable_From"; return Is_Distinguishable_From (Self, N, Ns); end Is_Distinguishable_From; --------------- -- Namespace -- --------------- overriding function Namespace (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Namespace"; return Namespace (Self); end Namespace; ------------------------ -- Exclude_Collisions -- ------------------------ overriding function Exclude_Collisions (Self : not null access constant UML_Final_State_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 UML_Final_State_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 UML_Final_State_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 UML_Final_State_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 UML_Final_State_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 UML_Final_State_Proxy.Import_Members"; return Import_Members (Self, Imps); end Import_Members; --------------------- -- Imported_Member -- --------------------- overriding function Imported_Member (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Imported_Member"; return Imported_Member (Self); end Imported_Member; --------------------------------- -- Members_Are_Distinguishable -- --------------------------------- overriding function Members_Are_Distinguishable (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Members_Are_Distinguishable"; return Members_Are_Distinguishable (Self); end Members_Are_Distinguishable; ------------------ -- Owned_Member -- ------------------ overriding function Owned_Member (Self : not null access constant UML_Final_State_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 UML_Final_State_Proxy.Owned_Member"; return Owned_Member (Self); end Owned_Member; -------------- -- Incoming -- -------------- overriding function Incoming (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Incoming unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Incoming"; return Incoming (Self); end Incoming; -------------- -- Outgoing -- -------------- overriding function Outgoing (Self : not null access constant UML_Final_State_Proxy) return AMF.UML.Transitions.Collections.Set_Of_UML_Transition is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Outgoing unimplemented"); raise Program_Error with "Unimplemented procedure UML_Final_State_Proxy.Outgoing"; return Outgoing (Self); end Outgoing; end AMF.Internals.UML_Final_States;
[ { "context": "--\n-- Jan & Uwe R. Zimmer, Australia, 2013\n--\n\nwith Ada.Con", "end": 9, "score": 0.9998628497123718, "start": 6, "tag": "NAME", "value": "Jan" }, { "context": "--\n-- Jan & Uwe R. Zimmer, Australia, 2013\n--\n\nwith Ada.Containers; ", "end": 25, "score": 0.9998263120651245, "start": 12, "tag": "NAME", "value": "Uwe R. Zimmer" } ]
Sources/Swarm/swarm_control.adb
ForYouEyesOnly/Space-Convoy
1
-- -- Jan & Uwe R. Zimmer, Australia, 2013 -- with Ada.Containers; use Ada.Containers; with Ada.Numerics; use Ada.Numerics; with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random; with Ada.Real_Time; use Ada.Real_Time; with Ada.Text_IO; use Ada.Text_IO; with Graphics_Configuration; use Graphics_Configuration; with Rotations; use Rotations; with Swarm_Data; use Swarm_Data; with Vectors_Conversions; use Vectors_Conversions; with Vectors_3D_LF; use Vectors_3D_LF; with Vehicle_Message_Type; use Vehicle_Message_Type; with Vehicle_Task_Type; use Vehicle_Task_Type; package body Swarm_Control is use Real_Elementary_Functions; use Swarm_Vectors; protected body Swarm_Monitor is function Id_Task return Swarm_Element_Index is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop if Element (Swarm_State, Element_Index).Process_Id = Current_Task then return (Element_Index); end if; end loop; raise No_Such_Task; end Id_Task; function Id_Task (Id : Task_Id) return Swarm_Element_Index is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop if Element (Swarm_State, Element_Index).Process_Id = Id then return (Element_Index); end if; end loop; raise No_Such_Task; end Id_Task; function Position (Id : Task_Id) return Protected_Point_3D.Monitor_Ptr is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Position); function Velocity (Id : Task_Id) return Protected_Vector_3D.Monitor_Ptr is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Velocity); function Acceleration (Id : Task_Id) return Protected_Vector_3D.Monitor_Ptr is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Acceleration); function Controls (Id : Task_Id) return Vehicle_Controls_P is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Controls); function Comms (Id : Task_Id) return Vehicle_Comms_P is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Comms); function Charge (Id : Task_Id) return Charge_Info is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Charge); function Process_abort return Barrier_Ptr is (Element (Swarm_State, Swarm_Monitor.Id_Task).Process_abort); -- -- -- procedure Append_Random_Swarm (No_Of_Swarm_Elements : Positive := Initial_No_of_Elements; Centre : Positions := Initial_Swarm_Position; Volume_Edge_Length : Real := Initual_Edge_Length) is Random_Float : Generator; begin Reset (Random_Float); Reserve_Capacity (Swarm_State, Length (Swarm_State) + Count_Type (No_Of_Swarm_Elements)); for i in 1 .. No_Of_Swarm_Elements loop select pragma Warnings (Off, "potentially blocking operation in protected operation"); delay Tolerated_Vehicle_Activation_Delay; pragma Warnings (On, "potentially blocking operation in protected operation"); raise Vehicle_could_not_be_created; then abort declare New_Element : Swarm_Element_State := (Position => Protected_Point_3D.Allocate ((Centre (x) + (Real (Random (Random_Float)) * Volume_Edge_Length) - Volume_Edge_Length / 2.0, Centre (y) + (Real (Random (Random_Float)) * Volume_Edge_Length) - Volume_Edge_Length / 2.0, Centre (z) + (Real (Random (Random_Float)) * Volume_Edge_Length) - Volume_Edge_Length / 2.0)), Rotation => Protected_Rotation.Allocate (Zero_Rotation), Velocity => Protected_Vector_3D.Allocate (Zero_Vector_3D), Acceleration => Protected_Vector_3D.Allocate (Zero_Vector_3D), Charge => (Level => Full_Charge, Charge_Time => Protected_Time.Allocate (Clock), Charge_No => 0, Globes_Touched => No_Globes_Touched), Neighbours => new Distance_Vectors.Vector, Controls => new Vehicle_Controls, Comms => new Vehicle_Comms, Process => new Vehicle_Task, Process_abort => new Barrier, Process_Id => Null_Task_Id, Vehicle_Id => Natural'Succ (Last_Vehicle_Id), Last_Update => Clock); begin Last_Vehicle_Id := New_Element.Vehicle_Id; pragma Warnings (Off, "potentially blocking operation in protected operation"); -- Freshly created vehicle tasks need to respond to this call. select New_Element.Process.all.Identify (New_Element.Vehicle_Id, New_Element.Process_Id); or delay Tolerated_Identify_Call_Delay; raise Task_did_not_repond_to_Identfiy_Call; end select; pragma Warnings (On, "potentially blocking operation in protected operation"); Append (Swarm_State, New_Element); end; end select; end loop; end Append_Random_Swarm; -- -- -- procedure Remove_Vehicle (Element_Ix : Swarm_Element_Index) is begin if Length (Swarm_State) > 1 and then Element_Ix >= First_Index (Swarm_State) and then Element_Ix <= Last_Index (Swarm_State) then declare This_Element : Swarm_Element_State := Element (Swarm_State, Element_Ix); begin Free_Process (This_Element.Process); Free (This_Element.Process_abort); Free_Neighbours (This_Element.Neighbours); Free_Comms (This_Element.Comms); Free_Controls (This_Element.Controls); Protected_Time.Free (This_Element.Charge.Charge_Time); Protected_Point_3D.Free (This_Element.Position); Protected_Rotation.Free (This_Element.Rotation); Protected_Vector_3D.Free (This_Element.Velocity); Protected_Vector_3D.Free (This_Element.Acceleration); Delete (Swarm_State, Element_Ix); end; end if; end Remove_Vehicle; -- -- -- function Centre_Of_Gravity return Vector_3D is Acc_Positions : Vector_3D_LF := Zero_Vector_3D_LF; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Acc_Positions := Acc_Positions + To_Vector_3D_LF (Element (Swarm_State, Element_Index).Position.all.Read); end loop; return To_Vector_3D ((1.0 / Long_Float (Length (Swarm_State))) * Acc_Positions); end Centre_Of_Gravity; -- -- -- function Mean_Velocity return Vector_3D is Acc_Velocity : Vector_3D_LF := Zero_Vector_3D_LF; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Acc_Velocity := Acc_Velocity + To_Vector_3D_LF (Element (Swarm_State, Element_Index).Velocity.all.Read); end loop; return To_Vector_3D ((1.0 / Long_Float (Length (Swarm_State))) * Acc_Velocity); end Mean_Velocity; -- -- -- function Mean_Velocity return Real is Acc_Velocity : Real := 0.0; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Acc_Velocity := Acc_Velocity + Real (abs (To_Vector_3D_LF (Element (Swarm_State, Element_Index).Velocity.all.Read))); end loop; return Real (Acc_Velocity / Real (Length (Swarm_State))); end Mean_Velocity; -- -- -- function Maximal_Radius return Real is CoG : constant Vector_3D := Centre_Of_Gravity; Radius : Real := 0.0; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop declare Distance_from_CoG : constant Real := abs (CoG - Element (Swarm_State, Element_Index).Position.all.Read); begin Radius := Real'Max (Radius, Distance_from_CoG); end; end loop; return Radius; end Maximal_Radius; -- -- -- function Mean_Radius return Real is CoG : constant Vector_3D := Centre_Of_Gravity; Acc_Radius : Real := 0.0; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop declare Distance_from_CoG : constant Real := abs (CoG - Element (Swarm_State, Element_Index).Position.all.Read); begin Acc_Radius := Acc_Radius + Distance_from_CoG; end; end loop; return Real (Acc_Radius / Real (Length (Swarm_State))); end Mean_Radius; -- -- -- function Mean_Closest_Distance return Real is Acc_Distance : Real := 0.0; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop declare This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); Neighbours : constant Distance_Vectors.Vector := This_Element.Neighbours.all; begin if Distance_Vectors.Length (Neighbours) > 0 then declare Closest_Distance : constant Real := Distance_Vectors.Element (Neighbours, Distance_Vectors.First_Index (Neighbours)).Distance; begin Acc_Distance := Acc_Distance + Closest_Distance; end; end if; end; end loop; return Real (Acc_Distance / Real (Length (Swarm_State))); end Mean_Closest_Distance; -- end Swarm_Monitor; -- -- -- procedure Remove_Vehicle_in_Stages (Element_Ix : Swarm_Element_Index) is Tolerated_Termination_Time : constant Duration := To_Duration (Milliseconds (100)); begin Element (Swarm_State, Element_Ix).Process_abort.all.Open; select delay Tolerated_Termination_Time; Put_Line (Current_Error, "Warning: Vehicle task termination request ignored - attempting task abort now"); select delay Tolerated_Termination_Time; Put_Line (Current_Error, "Error: Vehicle task stuck in non-abortable code region - task abort failed"); then abort Abort_Task (Element (Swarm_State, Element_Ix).Process_Id); loop exit when Is_Terminated (Element (Swarm_State, Element_Ix).Process_Id); delay 0.0; end loop; end select; then abort loop exit when Is_Terminated (Element (Swarm_State, Element_Ix).Process_Id); delay 0.0; end loop; end select; Swarm_Monitor.Remove_Vehicle (Element_Ix); end Remove_Vehicle_in_Stages; procedure Remove_Vehicles (No_Of_Swarm_Elements : Positive := 1) is begin if Natural (Length (Swarm_State)) >= No_Of_Swarm_Elements then for Element_Index in Last_Index (Swarm_State) - No_Of_Swarm_Elements + 1 .. Last_Index (Swarm_State) loop Remove_Vehicle_in_Stages (Element_Index); end loop; end if; end Remove_Vehicles; -- -- -- procedure Sorted_Close_Distances (Close_Dist : in out Distance_Vectors.Vector; Element_Index : Swarm_Element_Index; Max_Distance : Distances) is This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); This_Position : constant Positions := This_Element.Position.all.Read; begin Distance_Vectors.Clear (Close_Dist); Distance_Vectors.Reserve_Capacity (Close_Dist, Length (Swarm_State) - 1); for Scan_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop if Element_Index /= Scan_Index then declare Test_Element : constant Swarm_Element_State := Element (Swarm_State, Scan_Index); Test_Position : constant Positions := Test_Element.Position.all.Read; Test_Direction : constant Vector_3D := This_Position - Test_Position; Test_Distance : constant Distances := abs (Test_Direction); begin if Test_Distance <= Max_Distance then Distance_Vectors.Append (Close_Dist, (Index => Scan_Index, Distance => Test_Distance, Position_Diff => Test_Direction, Velocity_Diff => This_Element.Velocity.all.Read - Test_Element.Velocity.all.Read)); end if; end; end if; end loop; Sort_Distances.Sort (Close_Dist); end Sorted_Close_Distances; -- -- -- procedure Set_Acceleration (Element_Index : Swarm_Element_Index) is This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); Acceleration : Accelerations := Zero_Vector_3D; begin Sorted_Close_Distances (This_Element.Neighbours.all, Element_Index, Detection_Range); for Distance_Index in Distance_Vectors.First_Index (This_Element.Neighbours.all) .. Distance_Vectors.Last_Index (This_Element.Neighbours.all) loop declare Distance_Entry : constant Distance_Entries := Distance_Vectors.Element (This_Element.Neighbours.all, Distance_Index); begin -- Uncontrolled vehicles if This_Element.Controls.all.Read_Throttle = 0.0 then -- Attraction and repulsion forces between vehicles Acceleration := Acceleration + Inter_Swarm_Acceleration (Distance_Entry.Distance) * Norm (Distance_Entry.Position_Diff); -- Alignment forces if Distance_Entry.Distance <= Velocity_Matching_Range then Acceleration := Acceleration + Velocity_Matching (This_Element.Velocity.all.Read, Distance_Entry.Velocity_Diff); end if; -- Controlled vehicles elsif Distance_Entry.Distance <= Unconditional_Repulse_Dist then -- Unconditional repulsion for controlled vehicles Acceleration := Acceleration + Inter_Swarm_Repulsion (Distance_Entry.Distance) * Norm (Distance_Entry.Position_Diff); end if; end; end loop; -- Controlled vehicles if This_Element.Controls.all.Read_Throttle /= 0.0 then -- Approach the set target declare Target_Vector : constant Vector_3D := This_Element.Controls.all.Read_Steering - This_Element.Position.all.Read; Norm_Target_Vector : constant Vector_3D := Norm (Target_Vector); Abs_Target_Vector : constant Real := abs (Target_Vector); Abs_Velocity : constant Real := abs (This_Element.Velocity.all.Read); Angle_Between_Target_and_Velocity : constant Real := Angle_Between (Target_Vector, This_Element.Velocity.all.Read); begin if Abs_Target_Vector < Target_Fetch_Range then -- Target reached, switch to idle throttle This_Element.Controls.all.Set_Throttle (Idle_Throttle); else -- Accelerate to constant speed towards target, dampen lateral velocities Acceleration := Acceleration + (This_Element.Controls.all.Read_Throttle * Approach_Acceleration (Abs_Velocity * Cos (Angle_Between_Target_and_Velocity)) * Norm_Target_Vector) - Norm (This_Element.Velocity.all.Read) * (Intented_Framerate / 5.0) * Abs_Velocity * Sin (Angle_Between_Target_and_Velocity); end if; end; end if; -- Friction This_Element.Acceleration.all.Write (Acceleration - Norm (This_Element.Velocity.all.Read) * (abs (This_Element.Velocity.all.Read) * Friction)**2); Replace_Element (Swarm_State, Element_Index, This_Element); end Set_Acceleration; -- -- -- procedure Set_All_Accelerations is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Set_Acceleration (Element_Index); end loop; end Set_All_Accelerations; -- -- -- procedure Forward_Messages (Element_Index : Swarm_Element_Index) is This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); Message_To_Be_Distributed : Inter_Vehicle_Messages; begin while This_Element.Comms.all.Has_Outgoing_Messages loop This_Element.Comms.all.Fetch_Message (Message_To_Be_Distributed); Check_Neighbours : for Distance_Index in Distance_Vectors.First_Index (This_Element.Neighbours.all) .. Distance_Vectors.Last_Index (This_Element.Neighbours.all) loop declare Distance_Entry : constant Distance_Entries := Distance_Vectors.Element (This_Element.Neighbours.all, Distance_Index); begin if Distance_Entry.Distance <= Comms_Range then Element (Swarm_State, Distance_Entry.Index).Comms.all.Push_Message (Message_To_Be_Distributed); else exit Check_Neighbours; end if; end; end loop Check_Neighbours; end loop; end Forward_Messages; -- -- -- procedure Forward_All_Messages is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Forward_Messages (Element_Index); end loop; end Forward_All_Messages; -- -- -- procedure Move_Element (Element_Index : Swarm_Element_Index) is This_Element : Swarm_Element_State := Element (Swarm_State, Element_Index); Interval : constant Real := Real'Min (Real (To_Duration (Clock - This_Element.Last_Update)), Max_Update_Interval); begin This_Element.Velocity.all.Write (This_Element.Velocity.all.Read + (Interval * This_Element.Acceleration.all.Read)); declare Move_Start : constant Positions := This_Element.Position.all.Read; Move_End : constant Positions := Move_Start + (Interval * This_Element.Velocity.all.Read); begin This_Element.Position.all.Write (Move_End); This_Element.Charge.Level := Vehicle_Charges (Real'Max (Real (Empty_Charge), Real'Min (Real (Full_Charge), Real (This_Element.Charge.Level) - (Interval * (Charging_Setup.Constant_Discharge_Rate_Per_Sec + Charging_Setup.Propulsion_Discharge_Rate_Per_Sec * abs (This_Element.Acceleration.all.Read)))))); for Globe_Ix in Globes'Range loop declare Globe_Pos : constant Positions := Globes (Globe_Ix).Position.all.Read; Interratio : constant Real := (Globe_Pos - Move_Start) * ((Move_End - Move_Start) / (abs (Move_End - Move_Start))); Intersection : constant Positions := Move_Start + Interratio * (Move_End - Move_Start); Touching : constant Boolean := abs (Intersection - Globe_Pos) <= Energy_Globe_Detection and then Interratio >= 0.0 and then Interratio <= 1.0; Slot_Passed : constant Boolean := Clock - This_Element.Charge.Charge_Time.all.Read > Charging_Setup.Max_Globe_Interval; begin if (not This_Element.Charge.Globes_Touched (Globe_Ix) or else Slot_Passed) and then Touching then if Slot_Passed then This_Element.Charge.Globes_Touched := No_Globes_Touched; This_Element.Charge.Charge_No := 0; end if; This_Element.Charge.Charge_No := This_Element.Charge.Charge_No + 1; This_Element.Charge.Globes_Touched (Globe_Ix) := True; This_Element.Charge.Charge_Time.all.Write (Clock); if This_Element.Charge.Charge_No = Charging_Setup.Globes_Required then This_Element.Charge.Level := Full_Charge; This_Element.Charge.Charge_No := 0; This_Element.Charge.Globes_Touched := No_Globes_Touched; end if; end if; end; end loop; end; This_Element.Last_Update := Clock; Replace_Element (Swarm_State, Element_Index, This_Element); end Move_Element; -- -- -- procedure Move_All_Elements is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Move_Element (Element_Index); end loop; end Move_All_Elements; -- -- -- procedure Update_Rotation (Element_Index : Swarm_Element_Index) is function Vector_Yaw (In_Vector : Vector_3D) return Real is (if In_Vector (x) = 0.0 and then In_Vector (z) = 0.0 then 0.0 else Arctan (In_Vector (x), In_Vector (z))); function Vector_Pitch (In_Vector : Vector_3D) return Real is ((Pi / 2.0) - Angle_Between (In_Vector, (0.0, 1.0, 0.0))); This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); Velocity : constant Vector_3D := This_Element.Velocity.all.Read; Element_Yaw : constant Real := Vector_Yaw (Velocity); Element_Pitch : constant Real := Vector_Pitch (Velocity); Rotation : constant Quaternion_Rotation := To_Rotation (0.0, -Element_Pitch, Element_Yaw + Pi); Norm_Acc : constant Vector_3D := Rotate (This_Element.Acceleration.all.Read, Rotation); Lateral_Acc : constant Real := Norm_Acc (x) * abs (Velocity); Element_Roll : constant Real := Real'Max (-Pi / 2.0, Real'Min (Pi / 2.0, Lateral_Acc * (Pi / 2.0) / Max_Assumed_Acceleration)); begin This_Element.Rotation.all.Write (To_Rotation (Element_Roll, -Element_Pitch, -Element_Yaw + Pi)); Replace_Element (Swarm_State, Element_Index, This_Element); end Update_Rotation; --- --- --- procedure Update_All_Rotations is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Update_Rotation (Element_Index); end loop; end Update_All_Rotations; -- -- -- procedure Remove_Empties is begin if Length (Swarm_State) > 1 then declare Element_Index : Swarm_Element_Index := First_Index (Swarm_State); begin while Element_Index <= Last_Index (Swarm_State) and then Length (Swarm_State) > 1 loop if Element (Swarm_State, Element_Index).Charge.Level = Empty_Charge then Remove_Vehicle_in_Stages (Element_Index); else Element_Index := Element_Index + 1; end if; end loop; end; end if; end Remove_Empties; end Swarm_Control;
22159
-- -- <NAME> & <NAME>, Australia, 2013 -- with Ada.Containers; use Ada.Containers; with Ada.Numerics; use Ada.Numerics; with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random; with Ada.Real_Time; use Ada.Real_Time; with Ada.Text_IO; use Ada.Text_IO; with Graphics_Configuration; use Graphics_Configuration; with Rotations; use Rotations; with Swarm_Data; use Swarm_Data; with Vectors_Conversions; use Vectors_Conversions; with Vectors_3D_LF; use Vectors_3D_LF; with Vehicle_Message_Type; use Vehicle_Message_Type; with Vehicle_Task_Type; use Vehicle_Task_Type; package body Swarm_Control is use Real_Elementary_Functions; use Swarm_Vectors; protected body Swarm_Monitor is function Id_Task return Swarm_Element_Index is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop if Element (Swarm_State, Element_Index).Process_Id = Current_Task then return (Element_Index); end if; end loop; raise No_Such_Task; end Id_Task; function Id_Task (Id : Task_Id) return Swarm_Element_Index is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop if Element (Swarm_State, Element_Index).Process_Id = Id then return (Element_Index); end if; end loop; raise No_Such_Task; end Id_Task; function Position (Id : Task_Id) return Protected_Point_3D.Monitor_Ptr is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Position); function Velocity (Id : Task_Id) return Protected_Vector_3D.Monitor_Ptr is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Velocity); function Acceleration (Id : Task_Id) return Protected_Vector_3D.Monitor_Ptr is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Acceleration); function Controls (Id : Task_Id) return Vehicle_Controls_P is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Controls); function Comms (Id : Task_Id) return Vehicle_Comms_P is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Comms); function Charge (Id : Task_Id) return Charge_Info is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Charge); function Process_abort return Barrier_Ptr is (Element (Swarm_State, Swarm_Monitor.Id_Task).Process_abort); -- -- -- procedure Append_Random_Swarm (No_Of_Swarm_Elements : Positive := Initial_No_of_Elements; Centre : Positions := Initial_Swarm_Position; Volume_Edge_Length : Real := Initual_Edge_Length) is Random_Float : Generator; begin Reset (Random_Float); Reserve_Capacity (Swarm_State, Length (Swarm_State) + Count_Type (No_Of_Swarm_Elements)); for i in 1 .. No_Of_Swarm_Elements loop select pragma Warnings (Off, "potentially blocking operation in protected operation"); delay Tolerated_Vehicle_Activation_Delay; pragma Warnings (On, "potentially blocking operation in protected operation"); raise Vehicle_could_not_be_created; then abort declare New_Element : Swarm_Element_State := (Position => Protected_Point_3D.Allocate ((Centre (x) + (Real (Random (Random_Float)) * Volume_Edge_Length) - Volume_Edge_Length / 2.0, Centre (y) + (Real (Random (Random_Float)) * Volume_Edge_Length) - Volume_Edge_Length / 2.0, Centre (z) + (Real (Random (Random_Float)) * Volume_Edge_Length) - Volume_Edge_Length / 2.0)), Rotation => Protected_Rotation.Allocate (Zero_Rotation), Velocity => Protected_Vector_3D.Allocate (Zero_Vector_3D), Acceleration => Protected_Vector_3D.Allocate (Zero_Vector_3D), Charge => (Level => Full_Charge, Charge_Time => Protected_Time.Allocate (Clock), Charge_No => 0, Globes_Touched => No_Globes_Touched), Neighbours => new Distance_Vectors.Vector, Controls => new Vehicle_Controls, Comms => new Vehicle_Comms, Process => new Vehicle_Task, Process_abort => new Barrier, Process_Id => Null_Task_Id, Vehicle_Id => Natural'Succ (Last_Vehicle_Id), Last_Update => Clock); begin Last_Vehicle_Id := New_Element.Vehicle_Id; pragma Warnings (Off, "potentially blocking operation in protected operation"); -- Freshly created vehicle tasks need to respond to this call. select New_Element.Process.all.Identify (New_Element.Vehicle_Id, New_Element.Process_Id); or delay Tolerated_Identify_Call_Delay; raise Task_did_not_repond_to_Identfiy_Call; end select; pragma Warnings (On, "potentially blocking operation in protected operation"); Append (Swarm_State, New_Element); end; end select; end loop; end Append_Random_Swarm; -- -- -- procedure Remove_Vehicle (Element_Ix : Swarm_Element_Index) is begin if Length (Swarm_State) > 1 and then Element_Ix >= First_Index (Swarm_State) and then Element_Ix <= Last_Index (Swarm_State) then declare This_Element : Swarm_Element_State := Element (Swarm_State, Element_Ix); begin Free_Process (This_Element.Process); Free (This_Element.Process_abort); Free_Neighbours (This_Element.Neighbours); Free_Comms (This_Element.Comms); Free_Controls (This_Element.Controls); Protected_Time.Free (This_Element.Charge.Charge_Time); Protected_Point_3D.Free (This_Element.Position); Protected_Rotation.Free (This_Element.Rotation); Protected_Vector_3D.Free (This_Element.Velocity); Protected_Vector_3D.Free (This_Element.Acceleration); Delete (Swarm_State, Element_Ix); end; end if; end Remove_Vehicle; -- -- -- function Centre_Of_Gravity return Vector_3D is Acc_Positions : Vector_3D_LF := Zero_Vector_3D_LF; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Acc_Positions := Acc_Positions + To_Vector_3D_LF (Element (Swarm_State, Element_Index).Position.all.Read); end loop; return To_Vector_3D ((1.0 / Long_Float (Length (Swarm_State))) * Acc_Positions); end Centre_Of_Gravity; -- -- -- function Mean_Velocity return Vector_3D is Acc_Velocity : Vector_3D_LF := Zero_Vector_3D_LF; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Acc_Velocity := Acc_Velocity + To_Vector_3D_LF (Element (Swarm_State, Element_Index).Velocity.all.Read); end loop; return To_Vector_3D ((1.0 / Long_Float (Length (Swarm_State))) * Acc_Velocity); end Mean_Velocity; -- -- -- function Mean_Velocity return Real is Acc_Velocity : Real := 0.0; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Acc_Velocity := Acc_Velocity + Real (abs (To_Vector_3D_LF (Element (Swarm_State, Element_Index).Velocity.all.Read))); end loop; return Real (Acc_Velocity / Real (Length (Swarm_State))); end Mean_Velocity; -- -- -- function Maximal_Radius return Real is CoG : constant Vector_3D := Centre_Of_Gravity; Radius : Real := 0.0; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop declare Distance_from_CoG : constant Real := abs (CoG - Element (Swarm_State, Element_Index).Position.all.Read); begin Radius := Real'Max (Radius, Distance_from_CoG); end; end loop; return Radius; end Maximal_Radius; -- -- -- function Mean_Radius return Real is CoG : constant Vector_3D := Centre_Of_Gravity; Acc_Radius : Real := 0.0; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop declare Distance_from_CoG : constant Real := abs (CoG - Element (Swarm_State, Element_Index).Position.all.Read); begin Acc_Radius := Acc_Radius + Distance_from_CoG; end; end loop; return Real (Acc_Radius / Real (Length (Swarm_State))); end Mean_Radius; -- -- -- function Mean_Closest_Distance return Real is Acc_Distance : Real := 0.0; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop declare This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); Neighbours : constant Distance_Vectors.Vector := This_Element.Neighbours.all; begin if Distance_Vectors.Length (Neighbours) > 0 then declare Closest_Distance : constant Real := Distance_Vectors.Element (Neighbours, Distance_Vectors.First_Index (Neighbours)).Distance; begin Acc_Distance := Acc_Distance + Closest_Distance; end; end if; end; end loop; return Real (Acc_Distance / Real (Length (Swarm_State))); end Mean_Closest_Distance; -- end Swarm_Monitor; -- -- -- procedure Remove_Vehicle_in_Stages (Element_Ix : Swarm_Element_Index) is Tolerated_Termination_Time : constant Duration := To_Duration (Milliseconds (100)); begin Element (Swarm_State, Element_Ix).Process_abort.all.Open; select delay Tolerated_Termination_Time; Put_Line (Current_Error, "Warning: Vehicle task termination request ignored - attempting task abort now"); select delay Tolerated_Termination_Time; Put_Line (Current_Error, "Error: Vehicle task stuck in non-abortable code region - task abort failed"); then abort Abort_Task (Element (Swarm_State, Element_Ix).Process_Id); loop exit when Is_Terminated (Element (Swarm_State, Element_Ix).Process_Id); delay 0.0; end loop; end select; then abort loop exit when Is_Terminated (Element (Swarm_State, Element_Ix).Process_Id); delay 0.0; end loop; end select; Swarm_Monitor.Remove_Vehicle (Element_Ix); end Remove_Vehicle_in_Stages; procedure Remove_Vehicles (No_Of_Swarm_Elements : Positive := 1) is begin if Natural (Length (Swarm_State)) >= No_Of_Swarm_Elements then for Element_Index in Last_Index (Swarm_State) - No_Of_Swarm_Elements + 1 .. Last_Index (Swarm_State) loop Remove_Vehicle_in_Stages (Element_Index); end loop; end if; end Remove_Vehicles; -- -- -- procedure Sorted_Close_Distances (Close_Dist : in out Distance_Vectors.Vector; Element_Index : Swarm_Element_Index; Max_Distance : Distances) is This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); This_Position : constant Positions := This_Element.Position.all.Read; begin Distance_Vectors.Clear (Close_Dist); Distance_Vectors.Reserve_Capacity (Close_Dist, Length (Swarm_State) - 1); for Scan_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop if Element_Index /= Scan_Index then declare Test_Element : constant Swarm_Element_State := Element (Swarm_State, Scan_Index); Test_Position : constant Positions := Test_Element.Position.all.Read; Test_Direction : constant Vector_3D := This_Position - Test_Position; Test_Distance : constant Distances := abs (Test_Direction); begin if Test_Distance <= Max_Distance then Distance_Vectors.Append (Close_Dist, (Index => Scan_Index, Distance => Test_Distance, Position_Diff => Test_Direction, Velocity_Diff => This_Element.Velocity.all.Read - Test_Element.Velocity.all.Read)); end if; end; end if; end loop; Sort_Distances.Sort (Close_Dist); end Sorted_Close_Distances; -- -- -- procedure Set_Acceleration (Element_Index : Swarm_Element_Index) is This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); Acceleration : Accelerations := Zero_Vector_3D; begin Sorted_Close_Distances (This_Element.Neighbours.all, Element_Index, Detection_Range); for Distance_Index in Distance_Vectors.First_Index (This_Element.Neighbours.all) .. Distance_Vectors.Last_Index (This_Element.Neighbours.all) loop declare Distance_Entry : constant Distance_Entries := Distance_Vectors.Element (This_Element.Neighbours.all, Distance_Index); begin -- Uncontrolled vehicles if This_Element.Controls.all.Read_Throttle = 0.0 then -- Attraction and repulsion forces between vehicles Acceleration := Acceleration + Inter_Swarm_Acceleration (Distance_Entry.Distance) * Norm (Distance_Entry.Position_Diff); -- Alignment forces if Distance_Entry.Distance <= Velocity_Matching_Range then Acceleration := Acceleration + Velocity_Matching (This_Element.Velocity.all.Read, Distance_Entry.Velocity_Diff); end if; -- Controlled vehicles elsif Distance_Entry.Distance <= Unconditional_Repulse_Dist then -- Unconditional repulsion for controlled vehicles Acceleration := Acceleration + Inter_Swarm_Repulsion (Distance_Entry.Distance) * Norm (Distance_Entry.Position_Diff); end if; end; end loop; -- Controlled vehicles if This_Element.Controls.all.Read_Throttle /= 0.0 then -- Approach the set target declare Target_Vector : constant Vector_3D := This_Element.Controls.all.Read_Steering - This_Element.Position.all.Read; Norm_Target_Vector : constant Vector_3D := Norm (Target_Vector); Abs_Target_Vector : constant Real := abs (Target_Vector); Abs_Velocity : constant Real := abs (This_Element.Velocity.all.Read); Angle_Between_Target_and_Velocity : constant Real := Angle_Between (Target_Vector, This_Element.Velocity.all.Read); begin if Abs_Target_Vector < Target_Fetch_Range then -- Target reached, switch to idle throttle This_Element.Controls.all.Set_Throttle (Idle_Throttle); else -- Accelerate to constant speed towards target, dampen lateral velocities Acceleration := Acceleration + (This_Element.Controls.all.Read_Throttle * Approach_Acceleration (Abs_Velocity * Cos (Angle_Between_Target_and_Velocity)) * Norm_Target_Vector) - Norm (This_Element.Velocity.all.Read) * (Intented_Framerate / 5.0) * Abs_Velocity * Sin (Angle_Between_Target_and_Velocity); end if; end; end if; -- Friction This_Element.Acceleration.all.Write (Acceleration - Norm (This_Element.Velocity.all.Read) * (abs (This_Element.Velocity.all.Read) * Friction)**2); Replace_Element (Swarm_State, Element_Index, This_Element); end Set_Acceleration; -- -- -- procedure Set_All_Accelerations is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Set_Acceleration (Element_Index); end loop; end Set_All_Accelerations; -- -- -- procedure Forward_Messages (Element_Index : Swarm_Element_Index) is This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); Message_To_Be_Distributed : Inter_Vehicle_Messages; begin while This_Element.Comms.all.Has_Outgoing_Messages loop This_Element.Comms.all.Fetch_Message (Message_To_Be_Distributed); Check_Neighbours : for Distance_Index in Distance_Vectors.First_Index (This_Element.Neighbours.all) .. Distance_Vectors.Last_Index (This_Element.Neighbours.all) loop declare Distance_Entry : constant Distance_Entries := Distance_Vectors.Element (This_Element.Neighbours.all, Distance_Index); begin if Distance_Entry.Distance <= Comms_Range then Element (Swarm_State, Distance_Entry.Index).Comms.all.Push_Message (Message_To_Be_Distributed); else exit Check_Neighbours; end if; end; end loop Check_Neighbours; end loop; end Forward_Messages; -- -- -- procedure Forward_All_Messages is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Forward_Messages (Element_Index); end loop; end Forward_All_Messages; -- -- -- procedure Move_Element (Element_Index : Swarm_Element_Index) is This_Element : Swarm_Element_State := Element (Swarm_State, Element_Index); Interval : constant Real := Real'Min (Real (To_Duration (Clock - This_Element.Last_Update)), Max_Update_Interval); begin This_Element.Velocity.all.Write (This_Element.Velocity.all.Read + (Interval * This_Element.Acceleration.all.Read)); declare Move_Start : constant Positions := This_Element.Position.all.Read; Move_End : constant Positions := Move_Start + (Interval * This_Element.Velocity.all.Read); begin This_Element.Position.all.Write (Move_End); This_Element.Charge.Level := Vehicle_Charges (Real'Max (Real (Empty_Charge), Real'Min (Real (Full_Charge), Real (This_Element.Charge.Level) - (Interval * (Charging_Setup.Constant_Discharge_Rate_Per_Sec + Charging_Setup.Propulsion_Discharge_Rate_Per_Sec * abs (This_Element.Acceleration.all.Read)))))); for Globe_Ix in Globes'Range loop declare Globe_Pos : constant Positions := Globes (Globe_Ix).Position.all.Read; Interratio : constant Real := (Globe_Pos - Move_Start) * ((Move_End - Move_Start) / (abs (Move_End - Move_Start))); Intersection : constant Positions := Move_Start + Interratio * (Move_End - Move_Start); Touching : constant Boolean := abs (Intersection - Globe_Pos) <= Energy_Globe_Detection and then Interratio >= 0.0 and then Interratio <= 1.0; Slot_Passed : constant Boolean := Clock - This_Element.Charge.Charge_Time.all.Read > Charging_Setup.Max_Globe_Interval; begin if (not This_Element.Charge.Globes_Touched (Globe_Ix) or else Slot_Passed) and then Touching then if Slot_Passed then This_Element.Charge.Globes_Touched := No_Globes_Touched; This_Element.Charge.Charge_No := 0; end if; This_Element.Charge.Charge_No := This_Element.Charge.Charge_No + 1; This_Element.Charge.Globes_Touched (Globe_Ix) := True; This_Element.Charge.Charge_Time.all.Write (Clock); if This_Element.Charge.Charge_No = Charging_Setup.Globes_Required then This_Element.Charge.Level := Full_Charge; This_Element.Charge.Charge_No := 0; This_Element.Charge.Globes_Touched := No_Globes_Touched; end if; end if; end; end loop; end; This_Element.Last_Update := Clock; Replace_Element (Swarm_State, Element_Index, This_Element); end Move_Element; -- -- -- procedure Move_All_Elements is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Move_Element (Element_Index); end loop; end Move_All_Elements; -- -- -- procedure Update_Rotation (Element_Index : Swarm_Element_Index) is function Vector_Yaw (In_Vector : Vector_3D) return Real is (if In_Vector (x) = 0.0 and then In_Vector (z) = 0.0 then 0.0 else Arctan (In_Vector (x), In_Vector (z))); function Vector_Pitch (In_Vector : Vector_3D) return Real is ((Pi / 2.0) - Angle_Between (In_Vector, (0.0, 1.0, 0.0))); This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); Velocity : constant Vector_3D := This_Element.Velocity.all.Read; Element_Yaw : constant Real := Vector_Yaw (Velocity); Element_Pitch : constant Real := Vector_Pitch (Velocity); Rotation : constant Quaternion_Rotation := To_Rotation (0.0, -Element_Pitch, Element_Yaw + Pi); Norm_Acc : constant Vector_3D := Rotate (This_Element.Acceleration.all.Read, Rotation); Lateral_Acc : constant Real := Norm_Acc (x) * abs (Velocity); Element_Roll : constant Real := Real'Max (-Pi / 2.0, Real'Min (Pi / 2.0, Lateral_Acc * (Pi / 2.0) / Max_Assumed_Acceleration)); begin This_Element.Rotation.all.Write (To_Rotation (Element_Roll, -Element_Pitch, -Element_Yaw + Pi)); Replace_Element (Swarm_State, Element_Index, This_Element); end Update_Rotation; --- --- --- procedure Update_All_Rotations is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Update_Rotation (Element_Index); end loop; end Update_All_Rotations; -- -- -- procedure Remove_Empties is begin if Length (Swarm_State) > 1 then declare Element_Index : Swarm_Element_Index := First_Index (Swarm_State); begin while Element_Index <= Last_Index (Swarm_State) and then Length (Swarm_State) > 1 loop if Element (Swarm_State, Element_Index).Charge.Level = Empty_Charge then Remove_Vehicle_in_Stages (Element_Index); else Element_Index := Element_Index + 1; end if; end loop; end; end if; end Remove_Empties; end Swarm_Control;
true
-- -- PI:NAME:<NAME>END_PI & PI:NAME:<NAME>END_PI, Australia, 2013 -- with Ada.Containers; use Ada.Containers; with Ada.Numerics; use Ada.Numerics; with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random; with Ada.Real_Time; use Ada.Real_Time; with Ada.Text_IO; use Ada.Text_IO; with Graphics_Configuration; use Graphics_Configuration; with Rotations; use Rotations; with Swarm_Data; use Swarm_Data; with Vectors_Conversions; use Vectors_Conversions; with Vectors_3D_LF; use Vectors_3D_LF; with Vehicle_Message_Type; use Vehicle_Message_Type; with Vehicle_Task_Type; use Vehicle_Task_Type; package body Swarm_Control is use Real_Elementary_Functions; use Swarm_Vectors; protected body Swarm_Monitor is function Id_Task return Swarm_Element_Index is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop if Element (Swarm_State, Element_Index).Process_Id = Current_Task then return (Element_Index); end if; end loop; raise No_Such_Task; end Id_Task; function Id_Task (Id : Task_Id) return Swarm_Element_Index is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop if Element (Swarm_State, Element_Index).Process_Id = Id then return (Element_Index); end if; end loop; raise No_Such_Task; end Id_Task; function Position (Id : Task_Id) return Protected_Point_3D.Monitor_Ptr is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Position); function Velocity (Id : Task_Id) return Protected_Vector_3D.Monitor_Ptr is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Velocity); function Acceleration (Id : Task_Id) return Protected_Vector_3D.Monitor_Ptr is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Acceleration); function Controls (Id : Task_Id) return Vehicle_Controls_P is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Controls); function Comms (Id : Task_Id) return Vehicle_Comms_P is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Comms); function Charge (Id : Task_Id) return Charge_Info is (Element (Swarm_State, Swarm_Monitor.Id_Task (Current_Task)).Charge); function Process_abort return Barrier_Ptr is (Element (Swarm_State, Swarm_Monitor.Id_Task).Process_abort); -- -- -- procedure Append_Random_Swarm (No_Of_Swarm_Elements : Positive := Initial_No_of_Elements; Centre : Positions := Initial_Swarm_Position; Volume_Edge_Length : Real := Initual_Edge_Length) is Random_Float : Generator; begin Reset (Random_Float); Reserve_Capacity (Swarm_State, Length (Swarm_State) + Count_Type (No_Of_Swarm_Elements)); for i in 1 .. No_Of_Swarm_Elements loop select pragma Warnings (Off, "potentially blocking operation in protected operation"); delay Tolerated_Vehicle_Activation_Delay; pragma Warnings (On, "potentially blocking operation in protected operation"); raise Vehicle_could_not_be_created; then abort declare New_Element : Swarm_Element_State := (Position => Protected_Point_3D.Allocate ((Centre (x) + (Real (Random (Random_Float)) * Volume_Edge_Length) - Volume_Edge_Length / 2.0, Centre (y) + (Real (Random (Random_Float)) * Volume_Edge_Length) - Volume_Edge_Length / 2.0, Centre (z) + (Real (Random (Random_Float)) * Volume_Edge_Length) - Volume_Edge_Length / 2.0)), Rotation => Protected_Rotation.Allocate (Zero_Rotation), Velocity => Protected_Vector_3D.Allocate (Zero_Vector_3D), Acceleration => Protected_Vector_3D.Allocate (Zero_Vector_3D), Charge => (Level => Full_Charge, Charge_Time => Protected_Time.Allocate (Clock), Charge_No => 0, Globes_Touched => No_Globes_Touched), Neighbours => new Distance_Vectors.Vector, Controls => new Vehicle_Controls, Comms => new Vehicle_Comms, Process => new Vehicle_Task, Process_abort => new Barrier, Process_Id => Null_Task_Id, Vehicle_Id => Natural'Succ (Last_Vehicle_Id), Last_Update => Clock); begin Last_Vehicle_Id := New_Element.Vehicle_Id; pragma Warnings (Off, "potentially blocking operation in protected operation"); -- Freshly created vehicle tasks need to respond to this call. select New_Element.Process.all.Identify (New_Element.Vehicle_Id, New_Element.Process_Id); or delay Tolerated_Identify_Call_Delay; raise Task_did_not_repond_to_Identfiy_Call; end select; pragma Warnings (On, "potentially blocking operation in protected operation"); Append (Swarm_State, New_Element); end; end select; end loop; end Append_Random_Swarm; -- -- -- procedure Remove_Vehicle (Element_Ix : Swarm_Element_Index) is begin if Length (Swarm_State) > 1 and then Element_Ix >= First_Index (Swarm_State) and then Element_Ix <= Last_Index (Swarm_State) then declare This_Element : Swarm_Element_State := Element (Swarm_State, Element_Ix); begin Free_Process (This_Element.Process); Free (This_Element.Process_abort); Free_Neighbours (This_Element.Neighbours); Free_Comms (This_Element.Comms); Free_Controls (This_Element.Controls); Protected_Time.Free (This_Element.Charge.Charge_Time); Protected_Point_3D.Free (This_Element.Position); Protected_Rotation.Free (This_Element.Rotation); Protected_Vector_3D.Free (This_Element.Velocity); Protected_Vector_3D.Free (This_Element.Acceleration); Delete (Swarm_State, Element_Ix); end; end if; end Remove_Vehicle; -- -- -- function Centre_Of_Gravity return Vector_3D is Acc_Positions : Vector_3D_LF := Zero_Vector_3D_LF; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Acc_Positions := Acc_Positions + To_Vector_3D_LF (Element (Swarm_State, Element_Index).Position.all.Read); end loop; return To_Vector_3D ((1.0 / Long_Float (Length (Swarm_State))) * Acc_Positions); end Centre_Of_Gravity; -- -- -- function Mean_Velocity return Vector_3D is Acc_Velocity : Vector_3D_LF := Zero_Vector_3D_LF; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Acc_Velocity := Acc_Velocity + To_Vector_3D_LF (Element (Swarm_State, Element_Index).Velocity.all.Read); end loop; return To_Vector_3D ((1.0 / Long_Float (Length (Swarm_State))) * Acc_Velocity); end Mean_Velocity; -- -- -- function Mean_Velocity return Real is Acc_Velocity : Real := 0.0; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Acc_Velocity := Acc_Velocity + Real (abs (To_Vector_3D_LF (Element (Swarm_State, Element_Index).Velocity.all.Read))); end loop; return Real (Acc_Velocity / Real (Length (Swarm_State))); end Mean_Velocity; -- -- -- function Maximal_Radius return Real is CoG : constant Vector_3D := Centre_Of_Gravity; Radius : Real := 0.0; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop declare Distance_from_CoG : constant Real := abs (CoG - Element (Swarm_State, Element_Index).Position.all.Read); begin Radius := Real'Max (Radius, Distance_from_CoG); end; end loop; return Radius; end Maximal_Radius; -- -- -- function Mean_Radius return Real is CoG : constant Vector_3D := Centre_Of_Gravity; Acc_Radius : Real := 0.0; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop declare Distance_from_CoG : constant Real := abs (CoG - Element (Swarm_State, Element_Index).Position.all.Read); begin Acc_Radius := Acc_Radius + Distance_from_CoG; end; end loop; return Real (Acc_Radius / Real (Length (Swarm_State))); end Mean_Radius; -- -- -- function Mean_Closest_Distance return Real is Acc_Distance : Real := 0.0; begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop declare This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); Neighbours : constant Distance_Vectors.Vector := This_Element.Neighbours.all; begin if Distance_Vectors.Length (Neighbours) > 0 then declare Closest_Distance : constant Real := Distance_Vectors.Element (Neighbours, Distance_Vectors.First_Index (Neighbours)).Distance; begin Acc_Distance := Acc_Distance + Closest_Distance; end; end if; end; end loop; return Real (Acc_Distance / Real (Length (Swarm_State))); end Mean_Closest_Distance; -- end Swarm_Monitor; -- -- -- procedure Remove_Vehicle_in_Stages (Element_Ix : Swarm_Element_Index) is Tolerated_Termination_Time : constant Duration := To_Duration (Milliseconds (100)); begin Element (Swarm_State, Element_Ix).Process_abort.all.Open; select delay Tolerated_Termination_Time; Put_Line (Current_Error, "Warning: Vehicle task termination request ignored - attempting task abort now"); select delay Tolerated_Termination_Time; Put_Line (Current_Error, "Error: Vehicle task stuck in non-abortable code region - task abort failed"); then abort Abort_Task (Element (Swarm_State, Element_Ix).Process_Id); loop exit when Is_Terminated (Element (Swarm_State, Element_Ix).Process_Id); delay 0.0; end loop; end select; then abort loop exit when Is_Terminated (Element (Swarm_State, Element_Ix).Process_Id); delay 0.0; end loop; end select; Swarm_Monitor.Remove_Vehicle (Element_Ix); end Remove_Vehicle_in_Stages; procedure Remove_Vehicles (No_Of_Swarm_Elements : Positive := 1) is begin if Natural (Length (Swarm_State)) >= No_Of_Swarm_Elements then for Element_Index in Last_Index (Swarm_State) - No_Of_Swarm_Elements + 1 .. Last_Index (Swarm_State) loop Remove_Vehicle_in_Stages (Element_Index); end loop; end if; end Remove_Vehicles; -- -- -- procedure Sorted_Close_Distances (Close_Dist : in out Distance_Vectors.Vector; Element_Index : Swarm_Element_Index; Max_Distance : Distances) is This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); This_Position : constant Positions := This_Element.Position.all.Read; begin Distance_Vectors.Clear (Close_Dist); Distance_Vectors.Reserve_Capacity (Close_Dist, Length (Swarm_State) - 1); for Scan_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop if Element_Index /= Scan_Index then declare Test_Element : constant Swarm_Element_State := Element (Swarm_State, Scan_Index); Test_Position : constant Positions := Test_Element.Position.all.Read; Test_Direction : constant Vector_3D := This_Position - Test_Position; Test_Distance : constant Distances := abs (Test_Direction); begin if Test_Distance <= Max_Distance then Distance_Vectors.Append (Close_Dist, (Index => Scan_Index, Distance => Test_Distance, Position_Diff => Test_Direction, Velocity_Diff => This_Element.Velocity.all.Read - Test_Element.Velocity.all.Read)); end if; end; end if; end loop; Sort_Distances.Sort (Close_Dist); end Sorted_Close_Distances; -- -- -- procedure Set_Acceleration (Element_Index : Swarm_Element_Index) is This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); Acceleration : Accelerations := Zero_Vector_3D; begin Sorted_Close_Distances (This_Element.Neighbours.all, Element_Index, Detection_Range); for Distance_Index in Distance_Vectors.First_Index (This_Element.Neighbours.all) .. Distance_Vectors.Last_Index (This_Element.Neighbours.all) loop declare Distance_Entry : constant Distance_Entries := Distance_Vectors.Element (This_Element.Neighbours.all, Distance_Index); begin -- Uncontrolled vehicles if This_Element.Controls.all.Read_Throttle = 0.0 then -- Attraction and repulsion forces between vehicles Acceleration := Acceleration + Inter_Swarm_Acceleration (Distance_Entry.Distance) * Norm (Distance_Entry.Position_Diff); -- Alignment forces if Distance_Entry.Distance <= Velocity_Matching_Range then Acceleration := Acceleration + Velocity_Matching (This_Element.Velocity.all.Read, Distance_Entry.Velocity_Diff); end if; -- Controlled vehicles elsif Distance_Entry.Distance <= Unconditional_Repulse_Dist then -- Unconditional repulsion for controlled vehicles Acceleration := Acceleration + Inter_Swarm_Repulsion (Distance_Entry.Distance) * Norm (Distance_Entry.Position_Diff); end if; end; end loop; -- Controlled vehicles if This_Element.Controls.all.Read_Throttle /= 0.0 then -- Approach the set target declare Target_Vector : constant Vector_3D := This_Element.Controls.all.Read_Steering - This_Element.Position.all.Read; Norm_Target_Vector : constant Vector_3D := Norm (Target_Vector); Abs_Target_Vector : constant Real := abs (Target_Vector); Abs_Velocity : constant Real := abs (This_Element.Velocity.all.Read); Angle_Between_Target_and_Velocity : constant Real := Angle_Between (Target_Vector, This_Element.Velocity.all.Read); begin if Abs_Target_Vector < Target_Fetch_Range then -- Target reached, switch to idle throttle This_Element.Controls.all.Set_Throttle (Idle_Throttle); else -- Accelerate to constant speed towards target, dampen lateral velocities Acceleration := Acceleration + (This_Element.Controls.all.Read_Throttle * Approach_Acceleration (Abs_Velocity * Cos (Angle_Between_Target_and_Velocity)) * Norm_Target_Vector) - Norm (This_Element.Velocity.all.Read) * (Intented_Framerate / 5.0) * Abs_Velocity * Sin (Angle_Between_Target_and_Velocity); end if; end; end if; -- Friction This_Element.Acceleration.all.Write (Acceleration - Norm (This_Element.Velocity.all.Read) * (abs (This_Element.Velocity.all.Read) * Friction)**2); Replace_Element (Swarm_State, Element_Index, This_Element); end Set_Acceleration; -- -- -- procedure Set_All_Accelerations is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Set_Acceleration (Element_Index); end loop; end Set_All_Accelerations; -- -- -- procedure Forward_Messages (Element_Index : Swarm_Element_Index) is This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); Message_To_Be_Distributed : Inter_Vehicle_Messages; begin while This_Element.Comms.all.Has_Outgoing_Messages loop This_Element.Comms.all.Fetch_Message (Message_To_Be_Distributed); Check_Neighbours : for Distance_Index in Distance_Vectors.First_Index (This_Element.Neighbours.all) .. Distance_Vectors.Last_Index (This_Element.Neighbours.all) loop declare Distance_Entry : constant Distance_Entries := Distance_Vectors.Element (This_Element.Neighbours.all, Distance_Index); begin if Distance_Entry.Distance <= Comms_Range then Element (Swarm_State, Distance_Entry.Index).Comms.all.Push_Message (Message_To_Be_Distributed); else exit Check_Neighbours; end if; end; end loop Check_Neighbours; end loop; end Forward_Messages; -- -- -- procedure Forward_All_Messages is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Forward_Messages (Element_Index); end loop; end Forward_All_Messages; -- -- -- procedure Move_Element (Element_Index : Swarm_Element_Index) is This_Element : Swarm_Element_State := Element (Swarm_State, Element_Index); Interval : constant Real := Real'Min (Real (To_Duration (Clock - This_Element.Last_Update)), Max_Update_Interval); begin This_Element.Velocity.all.Write (This_Element.Velocity.all.Read + (Interval * This_Element.Acceleration.all.Read)); declare Move_Start : constant Positions := This_Element.Position.all.Read; Move_End : constant Positions := Move_Start + (Interval * This_Element.Velocity.all.Read); begin This_Element.Position.all.Write (Move_End); This_Element.Charge.Level := Vehicle_Charges (Real'Max (Real (Empty_Charge), Real'Min (Real (Full_Charge), Real (This_Element.Charge.Level) - (Interval * (Charging_Setup.Constant_Discharge_Rate_Per_Sec + Charging_Setup.Propulsion_Discharge_Rate_Per_Sec * abs (This_Element.Acceleration.all.Read)))))); for Globe_Ix in Globes'Range loop declare Globe_Pos : constant Positions := Globes (Globe_Ix).Position.all.Read; Interratio : constant Real := (Globe_Pos - Move_Start) * ((Move_End - Move_Start) / (abs (Move_End - Move_Start))); Intersection : constant Positions := Move_Start + Interratio * (Move_End - Move_Start); Touching : constant Boolean := abs (Intersection - Globe_Pos) <= Energy_Globe_Detection and then Interratio >= 0.0 and then Interratio <= 1.0; Slot_Passed : constant Boolean := Clock - This_Element.Charge.Charge_Time.all.Read > Charging_Setup.Max_Globe_Interval; begin if (not This_Element.Charge.Globes_Touched (Globe_Ix) or else Slot_Passed) and then Touching then if Slot_Passed then This_Element.Charge.Globes_Touched := No_Globes_Touched; This_Element.Charge.Charge_No := 0; end if; This_Element.Charge.Charge_No := This_Element.Charge.Charge_No + 1; This_Element.Charge.Globes_Touched (Globe_Ix) := True; This_Element.Charge.Charge_Time.all.Write (Clock); if This_Element.Charge.Charge_No = Charging_Setup.Globes_Required then This_Element.Charge.Level := Full_Charge; This_Element.Charge.Charge_No := 0; This_Element.Charge.Globes_Touched := No_Globes_Touched; end if; end if; end; end loop; end; This_Element.Last_Update := Clock; Replace_Element (Swarm_State, Element_Index, This_Element); end Move_Element; -- -- -- procedure Move_All_Elements is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Move_Element (Element_Index); end loop; end Move_All_Elements; -- -- -- procedure Update_Rotation (Element_Index : Swarm_Element_Index) is function Vector_Yaw (In_Vector : Vector_3D) return Real is (if In_Vector (x) = 0.0 and then In_Vector (z) = 0.0 then 0.0 else Arctan (In_Vector (x), In_Vector (z))); function Vector_Pitch (In_Vector : Vector_3D) return Real is ((Pi / 2.0) - Angle_Between (In_Vector, (0.0, 1.0, 0.0))); This_Element : constant Swarm_Element_State := Element (Swarm_State, Element_Index); Velocity : constant Vector_3D := This_Element.Velocity.all.Read; Element_Yaw : constant Real := Vector_Yaw (Velocity); Element_Pitch : constant Real := Vector_Pitch (Velocity); Rotation : constant Quaternion_Rotation := To_Rotation (0.0, -Element_Pitch, Element_Yaw + Pi); Norm_Acc : constant Vector_3D := Rotate (This_Element.Acceleration.all.Read, Rotation); Lateral_Acc : constant Real := Norm_Acc (x) * abs (Velocity); Element_Roll : constant Real := Real'Max (-Pi / 2.0, Real'Min (Pi / 2.0, Lateral_Acc * (Pi / 2.0) / Max_Assumed_Acceleration)); begin This_Element.Rotation.all.Write (To_Rotation (Element_Roll, -Element_Pitch, -Element_Yaw + Pi)); Replace_Element (Swarm_State, Element_Index, This_Element); end Update_Rotation; --- --- --- procedure Update_All_Rotations is begin for Element_Index in First_Index (Swarm_State) .. Last_Index (Swarm_State) loop Update_Rotation (Element_Index); end loop; end Update_All_Rotations; -- -- -- procedure Remove_Empties is begin if Length (Swarm_State) > 1 then declare Element_Index : Swarm_Element_Index := First_Index (Swarm_State); begin while Element_Index <= Last_Index (Swarm_State) and then Length (Swarm_State) > 1 loop if Element (Swarm_State, Element_Index).Charge.Level = Empty_Charge then Remove_Vehicle_in_Stages (Element_Index); else Element_Index := Element_Index + 1; end if; end loop; end; end if; end Remove_Empties; end Swarm_Control;
[ { "context": "-- Copyright (c) 2020 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 35, "score": 0.9998680949211121, "start": 23, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2020 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 55, "score": 0.9999318718910217, "start": 37, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
source/torrent-logs.ads
reznikmm/torrent
4
-- Copyright (c) 2020 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with League.Strings; package Torrent.Logs is Enabled : Boolean := False; procedure Initialize (Output : League.Strings.Universal_String); procedure Print (Text : String); end Torrent.Logs;
16588
-- Copyright (c) 2020 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with League.Strings; package Torrent.Logs is Enabled : Boolean := False; procedure Initialize (Output : League.Strings.Universal_String); procedure Print (Text : String); end Torrent.Logs;
true
-- Copyright (c) 2020 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with League.Strings; package Torrent.Logs is Enabled : Boolean := False; procedure Initialize (Output : League.Strings.Universal_String); procedure Print (Text : String); end Torrent.Logs;
[ { "context": " --\n-- Copyright (C) 2018 Fabien Chouteau --\n-- ", "end": 372, "score": 0.9998418688774109, "start": 357, "tag": "NAME", "value": "Fabien Chouteau" } ]
src/tcg-tile_layers.adb
Fabien-Chouteau/tiled-code-gen
1
------------------------------------------------------------------------------ -- -- -- tiled-code-gen -- -- -- -- Copyright (C) 2018 Fabien Chouteau -- -- -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Text_IO; use Ada.Text_IO; with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Maps; use Ada.Strings.Maps; with Ada.Strings.Maps.Constants; with DOM.Core; use DOM.Core; with DOM.Core.Nodes; use DOM.Core.Nodes; with DOM.Core.Elements; use DOM.Core.Elements; with TCG.Utils; use TCG.Utils; with TCG.Tilesets; use TCG.Tilesets; package body TCG.Tile_Layers is function Create (N : Node) return Tile_Layer; procedure Load_Data (L : Tile_Layer; N : Node) with Pre => L /= No_Layer; Whitespace : constant Ada.Strings.Maps.Character_Set := not Ada.Strings.Maps.Constants.Decimal_Digit_Set; ------------ -- Create -- ------------ function Create (N : Node) return Tile_Layer is Id : Natural; Width : constant Natural := Item_As_Natural (N, "width"); Height : constant Natural := Item_As_Natural (N, "height"); Name : constant String := Item_As_String (N, "name"); L : constant Tile_Layer := new Layer_Data (Width, Height); begin if Item_Exists (N, "id") then Id := Item_As_Natural (N, "id"); else -- When there is not ID it means that there is only one layer Id := 0; end if; L.Id := Tile_Layer_Id (Id); L.Name := new String'(Name); return L; end Create; --------------- -- Load_Data -- --------------- procedure Load_Data (L : Tile_Layer; N : Node) is Data : constant String := Node_Value (First_Child (N)); Cursor : Integer := Data'First; function Next_Tile return Map_Tile_Id; --------------- -- Next_Tile -- --------------- function Next_Tile return Map_Tile_Id is From : constant Integer := Cursor; To : Integer := Cursor; begin while To < Data'Last and then Data (To) /= ',' loop To := To + 1; end loop; Cursor := To + 1; return Map_Tile_Id'Value (Trim (Data (From .. To - 1), Whitespace, Whitespace)); end Next_Tile; Encoding : constant String := Item_As_String (N, "encoding"); begin if Encoding /= "csv" then raise Program_Error with "Unsupported layer encoding: " & Encoding; end if; for Y in L.Map'Range (2) loop for X in L.Map'Range (1) loop L.Map (X, Y) := Next_Tile; end loop; end loop; end Load_Data; ---------- -- Load -- ---------- function Load (Root : Node) return Tile_Layer is L : constant Tile_Layer := Create (Root); List : Node_List; begin List := Get_Elements_By_Tag_Name (Root, "data"); if Length (List) > 1 then raise Program_Error with "Too many data elements"; end if; Load_Data (L, Item (List, 0)); Free (List); return L; end Load; ---------- -- Name -- ---------- function Name (This : Tile_Layer) return String is (if This.Name /= null then This.Name.all else ""); -------- -- Id -- -------- function Id (This : Tile_Layer) return Tile_Layer_Id is (This.Id); ----------- -- Width -- ----------- function Width (This : Tile_Layer) return Natural is (This.Width); ------------ -- Height -- ------------ function Height (This : Tile_Layer) return Natural is (This.Height); ---------- -- Tile -- ---------- function Tile (This : Tile_Layer; X, Y : Natural) return TCG.Tilesets.Map_Tile_Id is (This.Map (X, Y)); --------- -- Put -- --------- procedure Put (This : Tile_Layer) is begin Put_Line ("Layer: " & Name (This) & " Id:" & This.Id'Img); for Y in This.Map'Range (2) loop for X in This.Map'Range (1) loop Put (This.Map (X, Y)'Img & (if X = This.Map'Last (1) then "," else ", ")); end loop; New_Line; end loop; end Put; end TCG.Tile_Layers;
27199
------------------------------------------------------------------------------ -- -- -- tiled-code-gen -- -- -- -- Copyright (C) 2018 <NAME> -- -- -- -- -- -- 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 Ada.Text_IO; use Ada.Text_IO; with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Maps; use Ada.Strings.Maps; with Ada.Strings.Maps.Constants; with DOM.Core; use DOM.Core; with DOM.Core.Nodes; use DOM.Core.Nodes; with DOM.Core.Elements; use DOM.Core.Elements; with TCG.Utils; use TCG.Utils; with TCG.Tilesets; use TCG.Tilesets; package body TCG.Tile_Layers is function Create (N : Node) return Tile_Layer; procedure Load_Data (L : Tile_Layer; N : Node) with Pre => L /= No_Layer; Whitespace : constant Ada.Strings.Maps.Character_Set := not Ada.Strings.Maps.Constants.Decimal_Digit_Set; ------------ -- Create -- ------------ function Create (N : Node) return Tile_Layer is Id : Natural; Width : constant Natural := Item_As_Natural (N, "width"); Height : constant Natural := Item_As_Natural (N, "height"); Name : constant String := Item_As_String (N, "name"); L : constant Tile_Layer := new Layer_Data (Width, Height); begin if Item_Exists (N, "id") then Id := Item_As_Natural (N, "id"); else -- When there is not ID it means that there is only one layer Id := 0; end if; L.Id := Tile_Layer_Id (Id); L.Name := new String'(Name); return L; end Create; --------------- -- Load_Data -- --------------- procedure Load_Data (L : Tile_Layer; N : Node) is Data : constant String := Node_Value (First_Child (N)); Cursor : Integer := Data'First; function Next_Tile return Map_Tile_Id; --------------- -- Next_Tile -- --------------- function Next_Tile return Map_Tile_Id is From : constant Integer := Cursor; To : Integer := Cursor; begin while To < Data'Last and then Data (To) /= ',' loop To := To + 1; end loop; Cursor := To + 1; return Map_Tile_Id'Value (Trim (Data (From .. To - 1), Whitespace, Whitespace)); end Next_Tile; Encoding : constant String := Item_As_String (N, "encoding"); begin if Encoding /= "csv" then raise Program_Error with "Unsupported layer encoding: " & Encoding; end if; for Y in L.Map'Range (2) loop for X in L.Map'Range (1) loop L.Map (X, Y) := Next_Tile; end loop; end loop; end Load_Data; ---------- -- Load -- ---------- function Load (Root : Node) return Tile_Layer is L : constant Tile_Layer := Create (Root); List : Node_List; begin List := Get_Elements_By_Tag_Name (Root, "data"); if Length (List) > 1 then raise Program_Error with "Too many data elements"; end if; Load_Data (L, Item (List, 0)); Free (List); return L; end Load; ---------- -- Name -- ---------- function Name (This : Tile_Layer) return String is (if This.Name /= null then This.Name.all else ""); -------- -- Id -- -------- function Id (This : Tile_Layer) return Tile_Layer_Id is (This.Id); ----------- -- Width -- ----------- function Width (This : Tile_Layer) return Natural is (This.Width); ------------ -- Height -- ------------ function Height (This : Tile_Layer) return Natural is (This.Height); ---------- -- Tile -- ---------- function Tile (This : Tile_Layer; X, Y : Natural) return TCG.Tilesets.Map_Tile_Id is (This.Map (X, Y)); --------- -- Put -- --------- procedure Put (This : Tile_Layer) is begin Put_Line ("Layer: " & Name (This) & " Id:" & This.Id'Img); for Y in This.Map'Range (2) loop for X in This.Map'Range (1) loop Put (This.Map (X, Y)'Img & (if X = This.Map'Last (1) then "," else ", ")); end loop; New_Line; end loop; end Put; end TCG.Tile_Layers;
true
------------------------------------------------------------------------------ -- -- -- tiled-code-gen -- -- -- -- Copyright (C) 2018 PI:NAME:<NAME>END_PI -- -- -- -- -- -- 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 Ada.Text_IO; use Ada.Text_IO; with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Maps; use Ada.Strings.Maps; with Ada.Strings.Maps.Constants; with DOM.Core; use DOM.Core; with DOM.Core.Nodes; use DOM.Core.Nodes; with DOM.Core.Elements; use DOM.Core.Elements; with TCG.Utils; use TCG.Utils; with TCG.Tilesets; use TCG.Tilesets; package body TCG.Tile_Layers is function Create (N : Node) return Tile_Layer; procedure Load_Data (L : Tile_Layer; N : Node) with Pre => L /= No_Layer; Whitespace : constant Ada.Strings.Maps.Character_Set := not Ada.Strings.Maps.Constants.Decimal_Digit_Set; ------------ -- Create -- ------------ function Create (N : Node) return Tile_Layer is Id : Natural; Width : constant Natural := Item_As_Natural (N, "width"); Height : constant Natural := Item_As_Natural (N, "height"); Name : constant String := Item_As_String (N, "name"); L : constant Tile_Layer := new Layer_Data (Width, Height); begin if Item_Exists (N, "id") then Id := Item_As_Natural (N, "id"); else -- When there is not ID it means that there is only one layer Id := 0; end if; L.Id := Tile_Layer_Id (Id); L.Name := new String'(Name); return L; end Create; --------------- -- Load_Data -- --------------- procedure Load_Data (L : Tile_Layer; N : Node) is Data : constant String := Node_Value (First_Child (N)); Cursor : Integer := Data'First; function Next_Tile return Map_Tile_Id; --------------- -- Next_Tile -- --------------- function Next_Tile return Map_Tile_Id is From : constant Integer := Cursor; To : Integer := Cursor; begin while To < Data'Last and then Data (To) /= ',' loop To := To + 1; end loop; Cursor := To + 1; return Map_Tile_Id'Value (Trim (Data (From .. To - 1), Whitespace, Whitespace)); end Next_Tile; Encoding : constant String := Item_As_String (N, "encoding"); begin if Encoding /= "csv" then raise Program_Error with "Unsupported layer encoding: " & Encoding; end if; for Y in L.Map'Range (2) loop for X in L.Map'Range (1) loop L.Map (X, Y) := Next_Tile; end loop; end loop; end Load_Data; ---------- -- Load -- ---------- function Load (Root : Node) return Tile_Layer is L : constant Tile_Layer := Create (Root); List : Node_List; begin List := Get_Elements_By_Tag_Name (Root, "data"); if Length (List) > 1 then raise Program_Error with "Too many data elements"; end if; Load_Data (L, Item (List, 0)); Free (List); return L; end Load; ---------- -- Name -- ---------- function Name (This : Tile_Layer) return String is (if This.Name /= null then This.Name.all else ""); -------- -- Id -- -------- function Id (This : Tile_Layer) return Tile_Layer_Id is (This.Id); ----------- -- Width -- ----------- function Width (This : Tile_Layer) return Natural is (This.Width); ------------ -- Height -- ------------ function Height (This : Tile_Layer) return Natural is (This.Height); ---------- -- Tile -- ---------- function Tile (This : Tile_Layer; X, Y : Natural) return TCG.Tilesets.Map_Tile_Id is (This.Map (X, Y)); --------- -- Put -- --------- procedure Put (This : Tile_Layer) is begin Put_Line ("Layer: " & Name (This) & " Id:" & This.Id'Img); for Y in This.Map'Range (2) loop for X in This.Map'Range (1) loop Put (This.Map (X, Y)'Img & (if X = This.Map'Last (1) then "," else ", ")); end loop; New_Line; end loop; end Put; end TCG.Tile_Layers;
[ { "context": "Generic system file monitor\n-- Copyright (C) 2017 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 168, "score": 0.9998762011528015, "start": 153, "tag": "NAME", "value": "Stephane Carrez" }, { "context": " Copyright (C) 2017 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 199, "score": 0.999880313873291, "start": 184, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "7 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 226, "score": 0.9999271631240845, "start": 201, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
src/helios-monitor-sysfile.ads
stcarrez/helios
1
----------------------------------------------------------------------- -- helios-monitor-sysfile -- Generic system file monitor -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; package Helios.Monitor.Sysfile is type Agent_Type is new Helios.Monitor.Agent_Type with record Path : Ada.Strings.Unbounded.Unbounded_String; Value : Schemas.Definition_Type_Access; end record; -- Start the agent and build the definition tree. overriding procedure Start (Agent : in out Agent_Type; Config : in Util.Properties.Manager); -- Collect the values in the snapshot. overriding procedure Collect (Agent : in out Agent_Type; Values : in out Datas.Snapshot_Type); end Helios.Monitor.Sysfile;
10275
----------------------------------------------------------------------- -- helios-monitor-sysfile -- Generic system file monitor -- Copyright (C) 2017 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; package Helios.Monitor.Sysfile is type Agent_Type is new Helios.Monitor.Agent_Type with record Path : Ada.Strings.Unbounded.Unbounded_String; Value : Schemas.Definition_Type_Access; end record; -- Start the agent and build the definition tree. overriding procedure Start (Agent : in out Agent_Type; Config : in Util.Properties.Manager); -- Collect the values in the snapshot. overriding procedure Collect (Agent : in out Agent_Type; Values : in out Datas.Snapshot_Type); end Helios.Monitor.Sysfile;
true
----------------------------------------------------------------------- -- helios-monitor-sysfile -- Generic system file monitor -- Copyright (C) 2017 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; package Helios.Monitor.Sysfile is type Agent_Type is new Helios.Monitor.Agent_Type with record Path : Ada.Strings.Unbounded.Unbounded_String; Value : Schemas.Definition_Type_Access; end record; -- Start the agent and build the definition tree. overriding procedure Start (Agent : in out Agent_Type; Config : in Util.Properties.Manager); -- Collect the values in the snapshot. overriding procedure Collect (Agent : in out Agent_Type; Values : in out Datas.Snapshot_Type); end Helios.Monitor.Sysfile;
[ { "context": "hts reserved.\n--\n-- This software was developed by John Self of the Arcadia project\n-- at the University of Ca", "end": 133, "score": 0.9998492002487183, "start": 124, "tag": "NAME", "value": "John Self" }, { "context": "URPOSE.\n\n-- TITLE symbol table routines\n-- AUTHOR: John Self (UCI)\n-- DESCRIPTION implements only a simple sym", "end": 978, "score": 0.9998594522476196, "start": 969, "tag": "NAME", "value": "John Self" } ]
lib/aflexnat/sym.adb
alvaromb/Compilemon
1
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by John Self of the Arcadia project -- at the University of California, Irvine. -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- TITLE symbol table routines -- AUTHOR: John Self (UCI) -- DESCRIPTION implements only a simple symbol table using open hashing -- NOTES could be faster, but it isn't used much -- $Header: /co/ua/self/arcadia/aflex/ada/src/RCS/symB.a,v 1.6 90/01/12 15:20:39 self Exp Locker: self $ with misc_defs, misc, nfa, text_io, int_io, tstring; package body sym is use MISC_DEFS; use TSTRING; -- addsym - add symbol and definitions to symbol table -- -- true is returned if the symbol already exists, and the change not made. procedure ADDSYM(SYM, STR_DEF : in VSTRING; INT_DEF : in INTEGER; TABLE : in out HASH_TABLE; TABLE_SIZE : in INTEGER; RESULT : out BOOLEAN) is HASH_VAL : INTEGER := HASHFUNCT(SYM, TABLE_SIZE); SYM_ENTRY : HASH_LINK := TABLE(HASH_VAL); NEW_ENTRY, SUCCESSOR : HASH_LINK; begin while (SYM_ENTRY /= null) loop if (SYM = SYM_ENTRY.NAME) then -- entry already exists RESULT := TRUE; return; end if; SYM_ENTRY := SYM_ENTRY.NEXT; end loop; -- create new entry NEW_ENTRY := new HASH_ENTRY; SUCCESSOR := TABLE(HASH_VAL); if ((SUCCESSOR /= null)) then NEW_ENTRY.NEXT := SUCCESSOR; SUCCESSOR.PREV := NEW_ENTRY; else NEW_ENTRY.NEXT := null; end if; NEW_ENTRY.PREV := null; NEW_ENTRY.NAME := SYM; NEW_ENTRY.STR_VAL := STR_DEF; NEW_ENTRY.INT_VAL := INT_DEF; TABLE(HASH_VAL) := NEW_ENTRY; RESULT := FALSE; return; exception when STORAGE_ERROR => MISC.AFLEXFATAL("symbol table memory allocation failed"); end ADDSYM; -- cclinstal - save the text of a character class procedure CCLINSTAL(CCLTXT : in VSTRING; CCLNUM : in INTEGER) is -- we don't bother checking the return status because we are not called -- unless the symbol is new DUMMY : BOOLEAN; begin ADDSYM(CCLTXT, NUL, CCLNUM, CCLTAB, CCL_HASH_SIZE, DUMMY); end CCLINSTAL; -- ccllookup - lookup the number associated with character class text function CCLLOOKUP(CCLTXT : in VSTRING) return INTEGER is begin return FINDSYM(CCLTXT, CCLTAB, CCL_HASH_SIZE).INT_VAL; end CCLLOOKUP; -- findsym - find symbol in symbol table function FINDSYM(SYMBOL : in VSTRING; TABLE : in HASH_TABLE; TABLE_SIZE : in INTEGER) return HASH_LINK is SYM_ENTRY : HASH_LINK := TABLE(HASHFUNCT(SYMBOL, TABLE_SIZE)); EMPTY_ENTRY : HASH_LINK; begin while (SYM_ENTRY /= null) loop if (SYMBOL = SYM_ENTRY.NAME) then return SYM_ENTRY; end if; SYM_ENTRY := SYM_ENTRY.NEXT; end loop; EMPTY_ENTRY := new HASH_ENTRY; EMPTY_ENTRY.all := (null, null, NUL, NUL, 0); return EMPTY_ENTRY; exception when STORAGE_ERROR => MISC.AFLEXFATAL("dynamic memory failure in findsym()"); return EMPTY_ENTRY; end FINDSYM; -- hashfunct - compute the hash value for "str" and hash size "hash_size" function HASHFUNCT(STR : in VSTRING; HASH_SIZE : in INTEGER) return INTEGER is HASHVAL, LOCSTR : INTEGER; begin HASHVAL := 0; LOCSTR := TSTRING.FIRST; while (LOCSTR <= TSTRING.LEN(STR)) loop HASHVAL := ((HASHVAL*2) + CHARACTER'POS(CHAR(STR, LOCSTR))) mod HASH_SIZE ; LOCSTR := LOCSTR + 1; end loop; return HASHVAL; end HASHFUNCT; --ndinstal - install a name definition procedure NDINSTAL(ND, DEF : in VSTRING) is RESULT : BOOLEAN; begin ADDSYM(ND, DEF, 0, NDTBL, NAME_TABLE_HASH_SIZE, RESULT); if (RESULT) then MISC.SYNERR("name defined twice"); end if; end NDINSTAL; -- ndlookup - lookup a name definition function NDLOOKUP(ND : in VSTRING) return VSTRING is begin return FINDSYM(ND, NDTBL, NAME_TABLE_HASH_SIZE).STR_VAL; end NDLOOKUP; -- scinstal - make a start condition -- -- NOTE -- the start condition is Exclusive if xcluflg is true procedure SCINSTAL(STR : in VSTRING; XCLUFLG : in BOOLEAN) is -- bit of a hack. We know how the default start-condition is -- declared, and don't put out a define for it, because it -- would come out as "#define 0 1" -- actually, this is no longer the case. The default start-condition -- is now called "INITIAL". But we keep the following for the sake -- of future robustness. RESULT : BOOLEAN; begin if (STR /= VSTR("0")) then TSTRING.PUT(DEF_FILE, STR); TEXT_IO.PUT(DEF_FILE, " : constant := "); INT_IO.PUT(DEF_FILE, LASTSC, 1); TEXT_IO.PUT_LINE(DEF_FILE, ";"); end if; LASTSC := LASTSC + 1; if (LASTSC >= CURRENT_MAX_SCS) then CURRENT_MAX_SCS := CURRENT_MAX_SCS + MAX_SCS_INCREMENT; NUM_REALLOCS := NUM_REALLOCS + 1; REALLOCATE_INTEGER_ARRAY(SCSET, CURRENT_MAX_SCS); REALLOCATE_INTEGER_ARRAY(SCBOL, CURRENT_MAX_SCS); REALLOCATE_BOOLEAN_ARRAY(SCXCLU, CURRENT_MAX_SCS); REALLOCATE_BOOLEAN_ARRAY(SCEOF, CURRENT_MAX_SCS); REALLOCATE_VSTRING_ARRAY(SCNAME, CURRENT_MAX_SCS); REALLOCATE_INTEGER_ARRAY(ACTVSC, CURRENT_MAX_SCS); end if; SCNAME(LASTSC) := STR; ADDSYM(SCNAME(LASTSC), NUL, LASTSC, SCTBL, START_COND_HASH_SIZE, RESULT); if (RESULT) then MISC.AFLEXERROR("start condition " & STR & " declared twice"); end if; SCSET(LASTSC) := NFA.MKSTATE(SYM_EPSILON); SCBOL(LASTSC) := NFA.MKSTATE(SYM_EPSILON); SCXCLU(LASTSC) := XCLUFLG; SCEOF(LASTSC) := FALSE; end SCINSTAL; -- sclookup - lookup the number associated with a start condition function SCLOOKUP(STR : in VSTRING) return INTEGER is begin return FINDSYM(STR, SCTBL, START_COND_HASH_SIZE).INT_VAL; end SCLOOKUP; end sym;
23454
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by <NAME> of the Arcadia project -- at the University of California, Irvine. -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- TITLE symbol table routines -- AUTHOR: <NAME> (UCI) -- DESCRIPTION implements only a simple symbol table using open hashing -- NOTES could be faster, but it isn't used much -- $Header: /co/ua/self/arcadia/aflex/ada/src/RCS/symB.a,v 1.6 90/01/12 15:20:39 self Exp Locker: self $ with misc_defs, misc, nfa, text_io, int_io, tstring; package body sym is use MISC_DEFS; use TSTRING; -- addsym - add symbol and definitions to symbol table -- -- true is returned if the symbol already exists, and the change not made. procedure ADDSYM(SYM, STR_DEF : in VSTRING; INT_DEF : in INTEGER; TABLE : in out HASH_TABLE; TABLE_SIZE : in INTEGER; RESULT : out BOOLEAN) is HASH_VAL : INTEGER := HASHFUNCT(SYM, TABLE_SIZE); SYM_ENTRY : HASH_LINK := TABLE(HASH_VAL); NEW_ENTRY, SUCCESSOR : HASH_LINK; begin while (SYM_ENTRY /= null) loop if (SYM = SYM_ENTRY.NAME) then -- entry already exists RESULT := TRUE; return; end if; SYM_ENTRY := SYM_ENTRY.NEXT; end loop; -- create new entry NEW_ENTRY := new HASH_ENTRY; SUCCESSOR := TABLE(HASH_VAL); if ((SUCCESSOR /= null)) then NEW_ENTRY.NEXT := SUCCESSOR; SUCCESSOR.PREV := NEW_ENTRY; else NEW_ENTRY.NEXT := null; end if; NEW_ENTRY.PREV := null; NEW_ENTRY.NAME := SYM; NEW_ENTRY.STR_VAL := STR_DEF; NEW_ENTRY.INT_VAL := INT_DEF; TABLE(HASH_VAL) := NEW_ENTRY; RESULT := FALSE; return; exception when STORAGE_ERROR => MISC.AFLEXFATAL("symbol table memory allocation failed"); end ADDSYM; -- cclinstal - save the text of a character class procedure CCLINSTAL(CCLTXT : in VSTRING; CCLNUM : in INTEGER) is -- we don't bother checking the return status because we are not called -- unless the symbol is new DUMMY : BOOLEAN; begin ADDSYM(CCLTXT, NUL, CCLNUM, CCLTAB, CCL_HASH_SIZE, DUMMY); end CCLINSTAL; -- ccllookup - lookup the number associated with character class text function CCLLOOKUP(CCLTXT : in VSTRING) return INTEGER is begin return FINDSYM(CCLTXT, CCLTAB, CCL_HASH_SIZE).INT_VAL; end CCLLOOKUP; -- findsym - find symbol in symbol table function FINDSYM(SYMBOL : in VSTRING; TABLE : in HASH_TABLE; TABLE_SIZE : in INTEGER) return HASH_LINK is SYM_ENTRY : HASH_LINK := TABLE(HASHFUNCT(SYMBOL, TABLE_SIZE)); EMPTY_ENTRY : HASH_LINK; begin while (SYM_ENTRY /= null) loop if (SYMBOL = SYM_ENTRY.NAME) then return SYM_ENTRY; end if; SYM_ENTRY := SYM_ENTRY.NEXT; end loop; EMPTY_ENTRY := new HASH_ENTRY; EMPTY_ENTRY.all := (null, null, NUL, NUL, 0); return EMPTY_ENTRY; exception when STORAGE_ERROR => MISC.AFLEXFATAL("dynamic memory failure in findsym()"); return EMPTY_ENTRY; end FINDSYM; -- hashfunct - compute the hash value for "str" and hash size "hash_size" function HASHFUNCT(STR : in VSTRING; HASH_SIZE : in INTEGER) return INTEGER is HASHVAL, LOCSTR : INTEGER; begin HASHVAL := 0; LOCSTR := TSTRING.FIRST; while (LOCSTR <= TSTRING.LEN(STR)) loop HASHVAL := ((HASHVAL*2) + CHARACTER'POS(CHAR(STR, LOCSTR))) mod HASH_SIZE ; LOCSTR := LOCSTR + 1; end loop; return HASHVAL; end HASHFUNCT; --ndinstal - install a name definition procedure NDINSTAL(ND, DEF : in VSTRING) is RESULT : BOOLEAN; begin ADDSYM(ND, DEF, 0, NDTBL, NAME_TABLE_HASH_SIZE, RESULT); if (RESULT) then MISC.SYNERR("name defined twice"); end if; end NDINSTAL; -- ndlookup - lookup a name definition function NDLOOKUP(ND : in VSTRING) return VSTRING is begin return FINDSYM(ND, NDTBL, NAME_TABLE_HASH_SIZE).STR_VAL; end NDLOOKUP; -- scinstal - make a start condition -- -- NOTE -- the start condition is Exclusive if xcluflg is true procedure SCINSTAL(STR : in VSTRING; XCLUFLG : in BOOLEAN) is -- bit of a hack. We know how the default start-condition is -- declared, and don't put out a define for it, because it -- would come out as "#define 0 1" -- actually, this is no longer the case. The default start-condition -- is now called "INITIAL". But we keep the following for the sake -- of future robustness. RESULT : BOOLEAN; begin if (STR /= VSTR("0")) then TSTRING.PUT(DEF_FILE, STR); TEXT_IO.PUT(DEF_FILE, " : constant := "); INT_IO.PUT(DEF_FILE, LASTSC, 1); TEXT_IO.PUT_LINE(DEF_FILE, ";"); end if; LASTSC := LASTSC + 1; if (LASTSC >= CURRENT_MAX_SCS) then CURRENT_MAX_SCS := CURRENT_MAX_SCS + MAX_SCS_INCREMENT; NUM_REALLOCS := NUM_REALLOCS + 1; REALLOCATE_INTEGER_ARRAY(SCSET, CURRENT_MAX_SCS); REALLOCATE_INTEGER_ARRAY(SCBOL, CURRENT_MAX_SCS); REALLOCATE_BOOLEAN_ARRAY(SCXCLU, CURRENT_MAX_SCS); REALLOCATE_BOOLEAN_ARRAY(SCEOF, CURRENT_MAX_SCS); REALLOCATE_VSTRING_ARRAY(SCNAME, CURRENT_MAX_SCS); REALLOCATE_INTEGER_ARRAY(ACTVSC, CURRENT_MAX_SCS); end if; SCNAME(LASTSC) := STR; ADDSYM(SCNAME(LASTSC), NUL, LASTSC, SCTBL, START_COND_HASH_SIZE, RESULT); if (RESULT) then MISC.AFLEXERROR("start condition " & STR & " declared twice"); end if; SCSET(LASTSC) := NFA.MKSTATE(SYM_EPSILON); SCBOL(LASTSC) := NFA.MKSTATE(SYM_EPSILON); SCXCLU(LASTSC) := XCLUFLG; SCEOF(LASTSC) := FALSE; end SCINSTAL; -- sclookup - lookup the number associated with a start condition function SCLOOKUP(STR : in VSTRING) return INTEGER is begin return FINDSYM(STR, SCTBL, START_COND_HASH_SIZE).INT_VAL; end SCLOOKUP; end sym;
true
-- Copyright (c) 1990 Regents of the University of California. -- All rights reserved. -- -- This software was developed by PI:NAME:<NAME>END_PI of the Arcadia project -- at the University of California, Irvine. -- -- Redistribution and use in source and binary forms are permitted -- provided that the above copyright notice and this paragraph are -- duplicated in all such forms and that any documentation, -- advertising materials, and other materials related to such -- distribution and use acknowledge that the software was developed -- by the University of California, Irvine. The name of the -- University may not be used to endorse or promote products derived -- from this software without specific prior written permission. -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- TITLE symbol table routines -- AUTHOR: PI:NAME:<NAME>END_PI (UCI) -- DESCRIPTION implements only a simple symbol table using open hashing -- NOTES could be faster, but it isn't used much -- $Header: /co/ua/self/arcadia/aflex/ada/src/RCS/symB.a,v 1.6 90/01/12 15:20:39 self Exp Locker: self $ with misc_defs, misc, nfa, text_io, int_io, tstring; package body sym is use MISC_DEFS; use TSTRING; -- addsym - add symbol and definitions to symbol table -- -- true is returned if the symbol already exists, and the change not made. procedure ADDSYM(SYM, STR_DEF : in VSTRING; INT_DEF : in INTEGER; TABLE : in out HASH_TABLE; TABLE_SIZE : in INTEGER; RESULT : out BOOLEAN) is HASH_VAL : INTEGER := HASHFUNCT(SYM, TABLE_SIZE); SYM_ENTRY : HASH_LINK := TABLE(HASH_VAL); NEW_ENTRY, SUCCESSOR : HASH_LINK; begin while (SYM_ENTRY /= null) loop if (SYM = SYM_ENTRY.NAME) then -- entry already exists RESULT := TRUE; return; end if; SYM_ENTRY := SYM_ENTRY.NEXT; end loop; -- create new entry NEW_ENTRY := new HASH_ENTRY; SUCCESSOR := TABLE(HASH_VAL); if ((SUCCESSOR /= null)) then NEW_ENTRY.NEXT := SUCCESSOR; SUCCESSOR.PREV := NEW_ENTRY; else NEW_ENTRY.NEXT := null; end if; NEW_ENTRY.PREV := null; NEW_ENTRY.NAME := SYM; NEW_ENTRY.STR_VAL := STR_DEF; NEW_ENTRY.INT_VAL := INT_DEF; TABLE(HASH_VAL) := NEW_ENTRY; RESULT := FALSE; return; exception when STORAGE_ERROR => MISC.AFLEXFATAL("symbol table memory allocation failed"); end ADDSYM; -- cclinstal - save the text of a character class procedure CCLINSTAL(CCLTXT : in VSTRING; CCLNUM : in INTEGER) is -- we don't bother checking the return status because we are not called -- unless the symbol is new DUMMY : BOOLEAN; begin ADDSYM(CCLTXT, NUL, CCLNUM, CCLTAB, CCL_HASH_SIZE, DUMMY); end CCLINSTAL; -- ccllookup - lookup the number associated with character class text function CCLLOOKUP(CCLTXT : in VSTRING) return INTEGER is begin return FINDSYM(CCLTXT, CCLTAB, CCL_HASH_SIZE).INT_VAL; end CCLLOOKUP; -- findsym - find symbol in symbol table function FINDSYM(SYMBOL : in VSTRING; TABLE : in HASH_TABLE; TABLE_SIZE : in INTEGER) return HASH_LINK is SYM_ENTRY : HASH_LINK := TABLE(HASHFUNCT(SYMBOL, TABLE_SIZE)); EMPTY_ENTRY : HASH_LINK; begin while (SYM_ENTRY /= null) loop if (SYMBOL = SYM_ENTRY.NAME) then return SYM_ENTRY; end if; SYM_ENTRY := SYM_ENTRY.NEXT; end loop; EMPTY_ENTRY := new HASH_ENTRY; EMPTY_ENTRY.all := (null, null, NUL, NUL, 0); return EMPTY_ENTRY; exception when STORAGE_ERROR => MISC.AFLEXFATAL("dynamic memory failure in findsym()"); return EMPTY_ENTRY; end FINDSYM; -- hashfunct - compute the hash value for "str" and hash size "hash_size" function HASHFUNCT(STR : in VSTRING; HASH_SIZE : in INTEGER) return INTEGER is HASHVAL, LOCSTR : INTEGER; begin HASHVAL := 0; LOCSTR := TSTRING.FIRST; while (LOCSTR <= TSTRING.LEN(STR)) loop HASHVAL := ((HASHVAL*2) + CHARACTER'POS(CHAR(STR, LOCSTR))) mod HASH_SIZE ; LOCSTR := LOCSTR + 1; end loop; return HASHVAL; end HASHFUNCT; --ndinstal - install a name definition procedure NDINSTAL(ND, DEF : in VSTRING) is RESULT : BOOLEAN; begin ADDSYM(ND, DEF, 0, NDTBL, NAME_TABLE_HASH_SIZE, RESULT); if (RESULT) then MISC.SYNERR("name defined twice"); end if; end NDINSTAL; -- ndlookup - lookup a name definition function NDLOOKUP(ND : in VSTRING) return VSTRING is begin return FINDSYM(ND, NDTBL, NAME_TABLE_HASH_SIZE).STR_VAL; end NDLOOKUP; -- scinstal - make a start condition -- -- NOTE -- the start condition is Exclusive if xcluflg is true procedure SCINSTAL(STR : in VSTRING; XCLUFLG : in BOOLEAN) is -- bit of a hack. We know how the default start-condition is -- declared, and don't put out a define for it, because it -- would come out as "#define 0 1" -- actually, this is no longer the case. The default start-condition -- is now called "INITIAL". But we keep the following for the sake -- of future robustness. RESULT : BOOLEAN; begin if (STR /= VSTR("0")) then TSTRING.PUT(DEF_FILE, STR); TEXT_IO.PUT(DEF_FILE, " : constant := "); INT_IO.PUT(DEF_FILE, LASTSC, 1); TEXT_IO.PUT_LINE(DEF_FILE, ";"); end if; LASTSC := LASTSC + 1; if (LASTSC >= CURRENT_MAX_SCS) then CURRENT_MAX_SCS := CURRENT_MAX_SCS + MAX_SCS_INCREMENT; NUM_REALLOCS := NUM_REALLOCS + 1; REALLOCATE_INTEGER_ARRAY(SCSET, CURRENT_MAX_SCS); REALLOCATE_INTEGER_ARRAY(SCBOL, CURRENT_MAX_SCS); REALLOCATE_BOOLEAN_ARRAY(SCXCLU, CURRENT_MAX_SCS); REALLOCATE_BOOLEAN_ARRAY(SCEOF, CURRENT_MAX_SCS); REALLOCATE_VSTRING_ARRAY(SCNAME, CURRENT_MAX_SCS); REALLOCATE_INTEGER_ARRAY(ACTVSC, CURRENT_MAX_SCS); end if; SCNAME(LASTSC) := STR; ADDSYM(SCNAME(LASTSC), NUL, LASTSC, SCTBL, START_COND_HASH_SIZE, RESULT); if (RESULT) then MISC.AFLEXERROR("start condition " & STR & " declared twice"); end if; SCSET(LASTSC) := NFA.MKSTATE(SYM_EPSILON); SCBOL(LASTSC) := NFA.MKSTATE(SYM_EPSILON); SCXCLU(LASTSC) := XCLUFLG; SCEOF(LASTSC) := FALSE; end SCINSTAL; -- sclookup - lookup the number associated with a start condition function SCLOOKUP(STR : in VSTRING) return INTEGER is begin return FINDSYM(STR, SCTBL, START_COND_HASH_SIZE).INT_VAL; end SCLOOKUP; end sym;
[ { "context": "bingo-q_gtk-q_intl.adb\n--*\n--* AUTHOR: Javier Fuica Fernandez\n--*\n--*******************************************", "end": 219, "score": 0.9998159408569336, "start": 197, "tag": "NAME", "value": "Javier Fuica Fernandez" } ]
src/q_bingo-q_gtk-q_intl.adb
jfuica/bingada
4
--***************************************************************************** --* --* PROJECT: Bingada --* --* FILE: q_bingo-q_gtk-q_intl.adb --* --* AUTHOR: Javier Fuica Fernandez --* --***************************************************************************** with Gtkada.Intl; with Text_Io; package body Q_Bingo.Q_Gtk.Q_Intl is --================================================================== --C_PATH : CONSTANT STRING := "/usr/local/share/locale"; procedure P_Initialise is begin if Gtkada.Intl.Getlocale = "C" then Gtkada.Intl.Setlocale (Category => Gtkada.Intl.Lc_Messages,Locale => "en_GB"); Text_Io.Put_Line ("DEFAULT LOCALE changed to : " & Gtkada.Intl.Getlocale); else Gtkada.Intl.Setlocale; end if; Gtkada.Intl.Bind_Text_Domain (Domain => "bingada", Dirname => "./messages"); Gtkada.Intl.Text_Domain ("bingada"); end P_Initialise; --================================================================== end Q_Bingo.Q_Gtk.Q_Intl;
6553
--***************************************************************************** --* --* PROJECT: Bingada --* --* FILE: q_bingo-q_gtk-q_intl.adb --* --* AUTHOR: <NAME> --* --***************************************************************************** with Gtkada.Intl; with Text_Io; package body Q_Bingo.Q_Gtk.Q_Intl is --================================================================== --C_PATH : CONSTANT STRING := "/usr/local/share/locale"; procedure P_Initialise is begin if Gtkada.Intl.Getlocale = "C" then Gtkada.Intl.Setlocale (Category => Gtkada.Intl.Lc_Messages,Locale => "en_GB"); Text_Io.Put_Line ("DEFAULT LOCALE changed to : " & Gtkada.Intl.Getlocale); else Gtkada.Intl.Setlocale; end if; Gtkada.Intl.Bind_Text_Domain (Domain => "bingada", Dirname => "./messages"); Gtkada.Intl.Text_Domain ("bingada"); end P_Initialise; --================================================================== end Q_Bingo.Q_Gtk.Q_Intl;
true
--***************************************************************************** --* --* PROJECT: Bingada --* --* FILE: q_bingo-q_gtk-q_intl.adb --* --* AUTHOR: PI:NAME:<NAME>END_PI --* --***************************************************************************** with Gtkada.Intl; with Text_Io; package body Q_Bingo.Q_Gtk.Q_Intl is --================================================================== --C_PATH : CONSTANT STRING := "/usr/local/share/locale"; procedure P_Initialise is begin if Gtkada.Intl.Getlocale = "C" then Gtkada.Intl.Setlocale (Category => Gtkada.Intl.Lc_Messages,Locale => "en_GB"); Text_Io.Put_Line ("DEFAULT LOCALE changed to : " & Gtkada.Intl.Getlocale); else Gtkada.Intl.Setlocale; end if; Gtkada.Intl.Bind_Text_Domain (Domain => "bingada", Dirname => "./messages"); Gtkada.Intl.Text_Domain ("bingada"); end P_Initialise; --================================================================== end Q_Bingo.Q_Gtk.Q_Intl;
[ { "context": "========================\n--\n-- Copyright 2021 (C) Holger Rodriguez\n--\n-- SPDX-License-Identifier: BSD-3-Clause\n--\nw", "end": 310, "score": 0.999830961227417, "start": 294, "tag": "NAME", "value": "Holger Rodriguez" } ]
src/evaluate-leds.ads
hgrodriguez/embedded-dashboard-console
0
--=========================================================================== -- -- This package checks and evaluates the input received from the serial -- line for commanding the LEDs -- --=========================================================================== -- -- Copyright 2021 (C) Holger Rodriguez -- -- SPDX-License-Identifier: BSD-3-Clause -- with Execute; package Evaluate.LEDs is -------------------------------------------------------------------------- -- LED section -- The complete instruction is built as (all elements are Character): -- <LED_Prefix><Block Code><Color of LED><State of LED> -- LED_Prefix := L -- This LED_Instruction is the part *after* the LED_Prefix -- Block Code := (0) -- only one block available at the moment -- Color of LED := (R, A, G, W, B) -- State of LED := (0, 1, 2) subtype LED_Instruction is String (1 .. 3); -------------------------------------------------------------------------- -- Blocks of LEDs defined. At the moment there is only one block -------------------------------------------------------------------------- type Blocks is (Zero); -------------------------------------------------------------------------- -- Colors of the LEDs available -------------------------------------------------------------------------- type Colors is (Red, Amber, Green, White, Blue); -------------------------------------------------------------------------- -- Operations possible for the LEDs -------------------------------------------------------------------------- type Operations is (Off, On, Toggle); -------------------------------------------------------------------------- -- Checks the input received against the rules defined above -------------------------------------------------------------------------- function Check_Input (Instruction : LED_Instruction) return Execute.LED_Errors; -------------------------------------------------------------------------- -- Evaluates the input received and returns the equivalent LED Command -------------------------------------------------------------------------- function Evaluate (Instruction : LED_Instruction) return Execute.LED_Commands; end Evaluate.LEDs;
13095
--=========================================================================== -- -- This package checks and evaluates the input received from the serial -- line for commanding the LEDs -- --=========================================================================== -- -- Copyright 2021 (C) <NAME> -- -- SPDX-License-Identifier: BSD-3-Clause -- with Execute; package Evaluate.LEDs is -------------------------------------------------------------------------- -- LED section -- The complete instruction is built as (all elements are Character): -- <LED_Prefix><Block Code><Color of LED><State of LED> -- LED_Prefix := L -- This LED_Instruction is the part *after* the LED_Prefix -- Block Code := (0) -- only one block available at the moment -- Color of LED := (R, A, G, W, B) -- State of LED := (0, 1, 2) subtype LED_Instruction is String (1 .. 3); -------------------------------------------------------------------------- -- Blocks of LEDs defined. At the moment there is only one block -------------------------------------------------------------------------- type Blocks is (Zero); -------------------------------------------------------------------------- -- Colors of the LEDs available -------------------------------------------------------------------------- type Colors is (Red, Amber, Green, White, Blue); -------------------------------------------------------------------------- -- Operations possible for the LEDs -------------------------------------------------------------------------- type Operations is (Off, On, Toggle); -------------------------------------------------------------------------- -- Checks the input received against the rules defined above -------------------------------------------------------------------------- function Check_Input (Instruction : LED_Instruction) return Execute.LED_Errors; -------------------------------------------------------------------------- -- Evaluates the input received and returns the equivalent LED Command -------------------------------------------------------------------------- function Evaluate (Instruction : LED_Instruction) return Execute.LED_Commands; end Evaluate.LEDs;
true
--=========================================================================== -- -- This package checks and evaluates the input received from the serial -- line for commanding the LEDs -- --=========================================================================== -- -- Copyright 2021 (C) PI:NAME:<NAME>END_PI -- -- SPDX-License-Identifier: BSD-3-Clause -- with Execute; package Evaluate.LEDs is -------------------------------------------------------------------------- -- LED section -- The complete instruction is built as (all elements are Character): -- <LED_Prefix><Block Code><Color of LED><State of LED> -- LED_Prefix := L -- This LED_Instruction is the part *after* the LED_Prefix -- Block Code := (0) -- only one block available at the moment -- Color of LED := (R, A, G, W, B) -- State of LED := (0, 1, 2) subtype LED_Instruction is String (1 .. 3); -------------------------------------------------------------------------- -- Blocks of LEDs defined. At the moment there is only one block -------------------------------------------------------------------------- type Blocks is (Zero); -------------------------------------------------------------------------- -- Colors of the LEDs available -------------------------------------------------------------------------- type Colors is (Red, Amber, Green, White, Blue); -------------------------------------------------------------------------- -- Operations possible for the LEDs -------------------------------------------------------------------------- type Operations is (Off, On, Toggle); -------------------------------------------------------------------------- -- Checks the input received against the rules defined above -------------------------------------------------------------------------- function Check_Input (Instruction : LED_Instruction) return Execute.LED_Errors; -------------------------------------------------------------------------- -- Evaluates the input received and returns the equivalent LED Command -------------------------------------------------------------------------- function Evaluate (Instruction : LED_Instruction) return Execute.LED_Commands; end Evaluate.LEDs;
[ { "context": "-- SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 43, "score": 0.9998666048049927, "start": 33, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 63, "score": 0.9999309778213501, "start": 45, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
sources/jupyter/jupyter.ads
reznikmm/jupyter
4
-- SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- package Jupyter is pragma Pure; end Jupyter;
6570
-- SPDX-FileCopyrightText: 2020 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- package Jupyter is pragma Pure; end Jupyter;
true
-- SPDX-FileCopyrightText: 2020 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- package Jupyter is pragma Pure; end Jupyter;
[ { "context": "-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 35, "score": 0.9998533129692078, "start": 23, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 55, "score": 0.9999313950538635, "start": 37, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
source/nodes/program-nodes-aspect_specifications.ads
optikos/oasis
0
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Expressions; with Program.Lexical_Elements; with Program.Elements.Aspect_Specifications; with Program.Element_Visitors; package Program.Nodes.Aspect_Specifications is pragma Preelaborate; type Aspect_Specification is new Program.Nodes.Node and Program.Elements.Aspect_Specifications.Aspect_Specification and Program.Elements.Aspect_Specifications.Aspect_Specification_Text with private; function Create (Aspect_Mark : not null Program.Elements.Expressions .Expression_Access; Arrow_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Aspect_Definition : not null Program.Elements.Expressions .Expression_Access) return Aspect_Specification; type Implicit_Aspect_Specification is new Program.Nodes.Node and Program.Elements.Aspect_Specifications.Aspect_Specification with private; function Create (Aspect_Mark : not null Program.Elements.Expressions .Expression_Access; Aspect_Definition : 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_Aspect_Specification with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Aspect_Specification is abstract new Program.Nodes.Node and Program.Elements.Aspect_Specifications.Aspect_Specification with record Aspect_Mark : not null Program.Elements.Expressions .Expression_Access; Aspect_Definition : not null Program.Elements.Expressions .Expression_Access; end record; procedure Initialize (Self : aliased in out Base_Aspect_Specification'Class); overriding procedure Visit (Self : not null access Base_Aspect_Specification; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Aspect_Mark (Self : Base_Aspect_Specification) return not null Program.Elements.Expressions.Expression_Access; overriding function Aspect_Definition (Self : Base_Aspect_Specification) return not null Program.Elements.Expressions.Expression_Access; overriding function Is_Aspect_Specification_Element (Self : Base_Aspect_Specification) return Boolean; overriding function Is_Definition_Element (Self : Base_Aspect_Specification) return Boolean; type Aspect_Specification is new Base_Aspect_Specification and Program.Elements.Aspect_Specifications.Aspect_Specification_Text with record Arrow_Token : not null Program.Lexical_Elements.Lexical_Element_Access; end record; overriding function To_Aspect_Specification_Text (Self : aliased in out Aspect_Specification) return Program.Elements.Aspect_Specifications .Aspect_Specification_Text_Access; overriding function Arrow_Token (Self : Aspect_Specification) return not null Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Aspect_Specification is new Base_Aspect_Specification with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Aspect_Specification_Text (Self : aliased in out Implicit_Aspect_Specification) return Program.Elements.Aspect_Specifications .Aspect_Specification_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Aspect_Specification) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Aspect_Specification) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Aspect_Specification) return Boolean; end Program.Nodes.Aspect_Specifications;
4403
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Expressions; with Program.Lexical_Elements; with Program.Elements.Aspect_Specifications; with Program.Element_Visitors; package Program.Nodes.Aspect_Specifications is pragma Preelaborate; type Aspect_Specification is new Program.Nodes.Node and Program.Elements.Aspect_Specifications.Aspect_Specification and Program.Elements.Aspect_Specifications.Aspect_Specification_Text with private; function Create (Aspect_Mark : not null Program.Elements.Expressions .Expression_Access; Arrow_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Aspect_Definition : not null Program.Elements.Expressions .Expression_Access) return Aspect_Specification; type Implicit_Aspect_Specification is new Program.Nodes.Node and Program.Elements.Aspect_Specifications.Aspect_Specification with private; function Create (Aspect_Mark : not null Program.Elements.Expressions .Expression_Access; Aspect_Definition : 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_Aspect_Specification with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Aspect_Specification is abstract new Program.Nodes.Node and Program.Elements.Aspect_Specifications.Aspect_Specification with record Aspect_Mark : not null Program.Elements.Expressions .Expression_Access; Aspect_Definition : not null Program.Elements.Expressions .Expression_Access; end record; procedure Initialize (Self : aliased in out Base_Aspect_Specification'Class); overriding procedure Visit (Self : not null access Base_Aspect_Specification; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Aspect_Mark (Self : Base_Aspect_Specification) return not null Program.Elements.Expressions.Expression_Access; overriding function Aspect_Definition (Self : Base_Aspect_Specification) return not null Program.Elements.Expressions.Expression_Access; overriding function Is_Aspect_Specification_Element (Self : Base_Aspect_Specification) return Boolean; overriding function Is_Definition_Element (Self : Base_Aspect_Specification) return Boolean; type Aspect_Specification is new Base_Aspect_Specification and Program.Elements.Aspect_Specifications.Aspect_Specification_Text with record Arrow_Token : not null Program.Lexical_Elements.Lexical_Element_Access; end record; overriding function To_Aspect_Specification_Text (Self : aliased in out Aspect_Specification) return Program.Elements.Aspect_Specifications .Aspect_Specification_Text_Access; overriding function Arrow_Token (Self : Aspect_Specification) return not null Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Aspect_Specification is new Base_Aspect_Specification with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Aspect_Specification_Text (Self : aliased in out Implicit_Aspect_Specification) return Program.Elements.Aspect_Specifications .Aspect_Specification_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Aspect_Specification) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Aspect_Specification) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Aspect_Specification) return Boolean; end Program.Nodes.Aspect_Specifications;
true
-- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Expressions; with Program.Lexical_Elements; with Program.Elements.Aspect_Specifications; with Program.Element_Visitors; package Program.Nodes.Aspect_Specifications is pragma Preelaborate; type Aspect_Specification is new Program.Nodes.Node and Program.Elements.Aspect_Specifications.Aspect_Specification and Program.Elements.Aspect_Specifications.Aspect_Specification_Text with private; function Create (Aspect_Mark : not null Program.Elements.Expressions .Expression_Access; Arrow_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Aspect_Definition : not null Program.Elements.Expressions .Expression_Access) return Aspect_Specification; type Implicit_Aspect_Specification is new Program.Nodes.Node and Program.Elements.Aspect_Specifications.Aspect_Specification with private; function Create (Aspect_Mark : not null Program.Elements.Expressions .Expression_Access; Aspect_Definition : 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_Aspect_Specification with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Aspect_Specification is abstract new Program.Nodes.Node and Program.Elements.Aspect_Specifications.Aspect_Specification with record Aspect_Mark : not null Program.Elements.Expressions .Expression_Access; Aspect_Definition : not null Program.Elements.Expressions .Expression_Access; end record; procedure Initialize (Self : aliased in out Base_Aspect_Specification'Class); overriding procedure Visit (Self : not null access Base_Aspect_Specification; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Aspect_Mark (Self : Base_Aspect_Specification) return not null Program.Elements.Expressions.Expression_Access; overriding function Aspect_Definition (Self : Base_Aspect_Specification) return not null Program.Elements.Expressions.Expression_Access; overriding function Is_Aspect_Specification_Element (Self : Base_Aspect_Specification) return Boolean; overriding function Is_Definition_Element (Self : Base_Aspect_Specification) return Boolean; type Aspect_Specification is new Base_Aspect_Specification and Program.Elements.Aspect_Specifications.Aspect_Specification_Text with record Arrow_Token : not null Program.Lexical_Elements.Lexical_Element_Access; end record; overriding function To_Aspect_Specification_Text (Self : aliased in out Aspect_Specification) return Program.Elements.Aspect_Specifications .Aspect_Specification_Text_Access; overriding function Arrow_Token (Self : Aspect_Specification) return not null Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Aspect_Specification is new Base_Aspect_Specification with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Aspect_Specification_Text (Self : aliased in out Implicit_Aspect_Specification) return Program.Elements.Aspect_Specifications .Aspect_Specification_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Aspect_Specification) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Aspect_Specification) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Aspect_Specification) return Boolean; end Program.Nodes.Aspect_Specifications;
[ { "context": "-- MIT License\n--\n-- Copyright (c) 2021 Glen Cornell <glen.m.cornell@gmail.com>\n--\n-- Permission is he", "end": 52, "score": 0.9998806118965149, "start": 40, "tag": "NAME", "value": "Glen Cornell" }, { "context": "IT License\n--\n-- Copyright (c) 2021 Glen Cornell <glen.m.cornell@gmail.com>\n--\n-- Permission is hereby granted, free of char", "end": 78, "score": 0.9999338388442993, "start": 54, "tag": "EMAIL", "value": "glen.m.cornell@gmail.com" } ]
examples/can_utils/print_can_frame.ads
glencornell/ada-socketcan
2
-- MIT License -- -- Copyright (c) 2021 Glen Cornell <glen.m.cornell@gmail.com> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. with Sockets.Can_Frame; procedure Print_Can_Frame (Frame : in Sockets.Can_Frame.Can_Frame; Prefix : in String := ""); -- Print the raw CAN frame to ada.text_io.current_output. The string -- specified by the parameter "Prefix" is printed out on the same -- line just before the can frame. Prefix can be anything that you -- want, but it is recommended that you use the interface name from -- which the frame was received. Output is in the format similar to -- the candump utility. Examples: -- -- vcan0 52 [5] 10 22 9A 69 E4 -- vcan0 4D6 [8] 56 3C 4F 78 23 19 B 4F -- vcan0 6BD [8] 29 87 AA 2D 26 1B 33 1D -- vcan0 E [8] 4B F 79 67 60 D0 C0 5 -- vcan0 269 [1] 4A -- vcan0 DF [2] AF 2 -- vcan0 13E [4] 3A 93 5 58
28771
-- MIT License -- -- Copyright (c) 2021 <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. with Sockets.Can_Frame; procedure Print_Can_Frame (Frame : in Sockets.Can_Frame.Can_Frame; Prefix : in String := ""); -- Print the raw CAN frame to ada.text_io.current_output. The string -- specified by the parameter "Prefix" is printed out on the same -- line just before the can frame. Prefix can be anything that you -- want, but it is recommended that you use the interface name from -- which the frame was received. Output is in the format similar to -- the candump utility. Examples: -- -- vcan0 52 [5] 10 22 9A 69 E4 -- vcan0 4D6 [8] 56 3C 4F 78 23 19 B 4F -- vcan0 6BD [8] 29 87 AA 2D 26 1B 33 1D -- vcan0 E [8] 4B F 79 67 60 D0 C0 5 -- vcan0 269 [1] 4A -- vcan0 DF [2] AF 2 -- vcan0 13E [4] 3A 93 5 58
true
-- MIT License -- -- Copyright (c) 2021 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. with Sockets.Can_Frame; procedure Print_Can_Frame (Frame : in Sockets.Can_Frame.Can_Frame; Prefix : in String := ""); -- Print the raw CAN frame to ada.text_io.current_output. The string -- specified by the parameter "Prefix" is printed out on the same -- line just before the can frame. Prefix can be anything that you -- want, but it is recommended that you use the interface name from -- which the frame was received. Output is in the format similar to -- the candump utility. Examples: -- -- vcan0 52 [5] 10 22 9A 69 E4 -- vcan0 4D6 [8] 56 3C 4F 78 23 19 B 4F -- vcan0 6BD [8] 29 87 AA 2D 26 1B 33 1D -- vcan0 E [8] 4B F 79 67 60 D0 C0 5 -- vcan0 269 [1] 4A -- vcan0 DF [2] AF 2 -- vcan0 13E [4] 3A 93 5 58
[ { "context": "--------------------------\n-- Copyright (c) 2019, Daniel King\n-- All rights reserved.\n--\n-- Redistribution an", "end": 115, "score": 0.9997732639312744, "start": 104, "tag": "NAME", "value": "Daniel King" } ]
src/common/keccak-generic_cshake.ads
damaki/libkeccak
26
------------------------------------------------------------------------------- -- Copyright (c) 2019, Daniel King -- 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. -- * The name of the copyright holder may not 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 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 Keccak.Types; use Keccak.Types; with Keccak.Generic_XOF; pragma Elaborate_All (Keccak.Generic_XOF); -- @summary -- Implements cSHAKE on top of any generic eXtedable Output Function (XOF). -- -- @description -- This API is used as follows: -- -- 1 Initialise a new context by calling Init. Customization strings can be -- optionally given to Init to provide domain separation between different -- uses of cSHAKE. -- -- 2 Call Update one or more times to input an arbitrary amount of data into cSHAKE. -- -- 3 Call Extract one or more times to produce an arbitrary number of output bytes. -- -- @group cSHAKE generic with package XOF is new Keccak.Generic_XOF (<>); -- The extendable output function on which the CSHAKE instance is -- constructed. package Keccak.Generic_CSHAKE is type Context is private; type States is (Updating, Ready_To_Extract, Extracting); -- The possible states for the context. -- -- @value Updating When in this state the context can be fed -- with input data by calling the Update procedure. -- -- @value Ready_To_Extract When in this state the Update procedure can -- no longer be called (i.e. no more data can be input to the context), -- and the context is ready to generate output data. -- -- @value Extracting When in this state the context can produce output -- bytes by calling the Extract procedure. procedure Init (Ctx : out Context; Customization : in String := ""; Function_Name : in String := "") with Global => null, Depends => (Ctx => (Customization, Function_Name)), Pre => Customization /= "" or Function_Name /= "", Post => State_Of (Ctx) = Updating; -- Initialize the CSHAKE context. -- -- Note that the Customization and Function_Name strings are optional, but -- at least one must be a non-empty string. If your use case needs both -- strings to be empty then SHAKE should be used instead, or -- Keccak.XOF if a a differently customized version of SHAKE is required. -- -- In cases where many CSHAKE computations are performed with the same -- customization and function name strings it is possible to initialize -- a context once with the desired parameters, then copy the context as -- many times as necessary for the different computations. The following -- example creates two contexts initialised to the same value: -- -- declare -- Ctx1 : Context; -- Ctx2 : Context; -- begin -- Init (Ctx1, "Example", ""); -- -- Ctx2 := Ctx1; -- end; -- -- @param Ctx The context to initialize. -- -- @param Customization An optional customization string to provide domain -- separation from different usages of CSHAKE. -- -- @param Function_Name An optional name for the function for which CSHAKE -- is being used. This is intended to be used only for NIST-defined -- constructions based on CSHAKE. For other non-NIST usages this string -- should be the empty string. procedure Update (Ctx : in out Context; Message : in Byte_Array) with Global => null, Inline, Depends => (Ctx =>+ Message), Pre => State_Of (Ctx) = Updating, Post => State_Of (Ctx) = Updating; -- Process bytes with CSHAKE. -- -- This procedure can only be called when the Ctx is in the Updating state. -- It can be called multiple times to process a large amount of data. -- -- @param Ctx The CSHAKE context. -- -- @param Message The data to process with CSHAKE. procedure Update (Ctx : in out Context; Message : in Byte_Array; Bit_Length : in Natural) with Global => null, Depends => (Ctx =>+ (Message, Bit_Length)), Pre => (State_Of (Ctx) = Updating and then (Message'Length < Natural'Last / 8) and then Bit_Length <= Message'Length * 8), Contract_Cases => (Bit_Length mod 8 = 0 => State_Of (Ctx) = Updating, others => State_Of (Ctx) = Ready_To_Extract); -- Process bits with CSHAKE. -- -- This procedure can only be called when the Ctx is in the Updating state. -- -- This procedure may be called multiple times to process long messages, -- as long as the Bit_Length is a multiple of 8 for all calls except the -- last call, which may use any Bit_Length value. procedure Extract (Ctx : in out Context; Digest : out Byte_Array) with Global => null, Depends => ((Ctx, Digest) => (Ctx, Digest)), Post => State_Of (Ctx) = Extracting; -- Produce output bytes. -- -- Note that after Extract has been called it is no longer possible to -- process data using Update. -- -- This function can be called multiple times to produce an arbitrary -- amount of output bytes. -- -- @param Ctx The CSHAKE context. -- -- @param Digest The output bytes are written to this byte array. The -- length of this array determines the number of bytes to produce. function State_Of (Ctx : in Context) return States with Global => null; -- Get the current state of a context. function Rate return Positive with Global => null, Post => Rate'Result mod 8 = 0; -- Get the rate parameter (in bits) of the CSHAKE instance. -- -- The rate is defined as the underlying state size minus the capacity -- parameter. E.g. for CSHAKE128 the state size is 1600 bits (the state -- is based on Keccak[1600]), and the Capacity is 256 bits, which results -- in a rate of 1600 - 256 = 1344 bits (168 bytes). private use type XOF.States; type Context is record XOF_Ctx : XOF.Context; end record; function State_Of (Ctx : in Context) return States is (case XOF.State_Of (Ctx.XOF_Ctx) is when XOF.Updating => Updating, when XOF.Ready_To_Extract => Ready_To_Extract, when XOF.Extracting => Extracting); function Rate return Positive is (XOF.Rate); end Keccak.Generic_CSHAKE;
11687
------------------------------------------------------------------------------- -- Copyright (c) 2019, <NAME> -- 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. -- * The name of the copyright holder may not 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 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 Keccak.Types; use Keccak.Types; with Keccak.Generic_XOF; pragma Elaborate_All (Keccak.Generic_XOF); -- @summary -- Implements cSHAKE on top of any generic eXtedable Output Function (XOF). -- -- @description -- This API is used as follows: -- -- 1 Initialise a new context by calling Init. Customization strings can be -- optionally given to Init to provide domain separation between different -- uses of cSHAKE. -- -- 2 Call Update one or more times to input an arbitrary amount of data into cSHAKE. -- -- 3 Call Extract one or more times to produce an arbitrary number of output bytes. -- -- @group cSHAKE generic with package XOF is new Keccak.Generic_XOF (<>); -- The extendable output function on which the CSHAKE instance is -- constructed. package Keccak.Generic_CSHAKE is type Context is private; type States is (Updating, Ready_To_Extract, Extracting); -- The possible states for the context. -- -- @value Updating When in this state the context can be fed -- with input data by calling the Update procedure. -- -- @value Ready_To_Extract When in this state the Update procedure can -- no longer be called (i.e. no more data can be input to the context), -- and the context is ready to generate output data. -- -- @value Extracting When in this state the context can produce output -- bytes by calling the Extract procedure. procedure Init (Ctx : out Context; Customization : in String := ""; Function_Name : in String := "") with Global => null, Depends => (Ctx => (Customization, Function_Name)), Pre => Customization /= "" or Function_Name /= "", Post => State_Of (Ctx) = Updating; -- Initialize the CSHAKE context. -- -- Note that the Customization and Function_Name strings are optional, but -- at least one must be a non-empty string. If your use case needs both -- strings to be empty then SHAKE should be used instead, or -- Keccak.XOF if a a differently customized version of SHAKE is required. -- -- In cases where many CSHAKE computations are performed with the same -- customization and function name strings it is possible to initialize -- a context once with the desired parameters, then copy the context as -- many times as necessary for the different computations. The following -- example creates two contexts initialised to the same value: -- -- declare -- Ctx1 : Context; -- Ctx2 : Context; -- begin -- Init (Ctx1, "Example", ""); -- -- Ctx2 := Ctx1; -- end; -- -- @param Ctx The context to initialize. -- -- @param Customization An optional customization string to provide domain -- separation from different usages of CSHAKE. -- -- @param Function_Name An optional name for the function for which CSHAKE -- is being used. This is intended to be used only for NIST-defined -- constructions based on CSHAKE. For other non-NIST usages this string -- should be the empty string. procedure Update (Ctx : in out Context; Message : in Byte_Array) with Global => null, Inline, Depends => (Ctx =>+ Message), Pre => State_Of (Ctx) = Updating, Post => State_Of (Ctx) = Updating; -- Process bytes with CSHAKE. -- -- This procedure can only be called when the Ctx is in the Updating state. -- It can be called multiple times to process a large amount of data. -- -- @param Ctx The CSHAKE context. -- -- @param Message The data to process with CSHAKE. procedure Update (Ctx : in out Context; Message : in Byte_Array; Bit_Length : in Natural) with Global => null, Depends => (Ctx =>+ (Message, Bit_Length)), Pre => (State_Of (Ctx) = Updating and then (Message'Length < Natural'Last / 8) and then Bit_Length <= Message'Length * 8), Contract_Cases => (Bit_Length mod 8 = 0 => State_Of (Ctx) = Updating, others => State_Of (Ctx) = Ready_To_Extract); -- Process bits with CSHAKE. -- -- This procedure can only be called when the Ctx is in the Updating state. -- -- This procedure may be called multiple times to process long messages, -- as long as the Bit_Length is a multiple of 8 for all calls except the -- last call, which may use any Bit_Length value. procedure Extract (Ctx : in out Context; Digest : out Byte_Array) with Global => null, Depends => ((Ctx, Digest) => (Ctx, Digest)), Post => State_Of (Ctx) = Extracting; -- Produce output bytes. -- -- Note that after Extract has been called it is no longer possible to -- process data using Update. -- -- This function can be called multiple times to produce an arbitrary -- amount of output bytes. -- -- @param Ctx The CSHAKE context. -- -- @param Digest The output bytes are written to this byte array. The -- length of this array determines the number of bytes to produce. function State_Of (Ctx : in Context) return States with Global => null; -- Get the current state of a context. function Rate return Positive with Global => null, Post => Rate'Result mod 8 = 0; -- Get the rate parameter (in bits) of the CSHAKE instance. -- -- The rate is defined as the underlying state size minus the capacity -- parameter. E.g. for CSHAKE128 the state size is 1600 bits (the state -- is based on Keccak[1600]), and the Capacity is 256 bits, which results -- in a rate of 1600 - 256 = 1344 bits (168 bytes). private use type XOF.States; type Context is record XOF_Ctx : XOF.Context; end record; function State_Of (Ctx : in Context) return States is (case XOF.State_Of (Ctx.XOF_Ctx) is when XOF.Updating => Updating, when XOF.Ready_To_Extract => Ready_To_Extract, when XOF.Extracting => Extracting); function Rate return Positive is (XOF.Rate); end Keccak.Generic_CSHAKE;
true
------------------------------------------------------------------------------- -- Copyright (c) 2019, PI:NAME:<NAME>END_PI -- 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. -- * The name of the copyright holder may not 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 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 Keccak.Types; use Keccak.Types; with Keccak.Generic_XOF; pragma Elaborate_All (Keccak.Generic_XOF); -- @summary -- Implements cSHAKE on top of any generic eXtedable Output Function (XOF). -- -- @description -- This API is used as follows: -- -- 1 Initialise a new context by calling Init. Customization strings can be -- optionally given to Init to provide domain separation between different -- uses of cSHAKE. -- -- 2 Call Update one or more times to input an arbitrary amount of data into cSHAKE. -- -- 3 Call Extract one or more times to produce an arbitrary number of output bytes. -- -- @group cSHAKE generic with package XOF is new Keccak.Generic_XOF (<>); -- The extendable output function on which the CSHAKE instance is -- constructed. package Keccak.Generic_CSHAKE is type Context is private; type States is (Updating, Ready_To_Extract, Extracting); -- The possible states for the context. -- -- @value Updating When in this state the context can be fed -- with input data by calling the Update procedure. -- -- @value Ready_To_Extract When in this state the Update procedure can -- no longer be called (i.e. no more data can be input to the context), -- and the context is ready to generate output data. -- -- @value Extracting When in this state the context can produce output -- bytes by calling the Extract procedure. procedure Init (Ctx : out Context; Customization : in String := ""; Function_Name : in String := "") with Global => null, Depends => (Ctx => (Customization, Function_Name)), Pre => Customization /= "" or Function_Name /= "", Post => State_Of (Ctx) = Updating; -- Initialize the CSHAKE context. -- -- Note that the Customization and Function_Name strings are optional, but -- at least one must be a non-empty string. If your use case needs both -- strings to be empty then SHAKE should be used instead, or -- Keccak.XOF if a a differently customized version of SHAKE is required. -- -- In cases where many CSHAKE computations are performed with the same -- customization and function name strings it is possible to initialize -- a context once with the desired parameters, then copy the context as -- many times as necessary for the different computations. The following -- example creates two contexts initialised to the same value: -- -- declare -- Ctx1 : Context; -- Ctx2 : Context; -- begin -- Init (Ctx1, "Example", ""); -- -- Ctx2 := Ctx1; -- end; -- -- @param Ctx The context to initialize. -- -- @param Customization An optional customization string to provide domain -- separation from different usages of CSHAKE. -- -- @param Function_Name An optional name for the function for which CSHAKE -- is being used. This is intended to be used only for NIST-defined -- constructions based on CSHAKE. For other non-NIST usages this string -- should be the empty string. procedure Update (Ctx : in out Context; Message : in Byte_Array) with Global => null, Inline, Depends => (Ctx =>+ Message), Pre => State_Of (Ctx) = Updating, Post => State_Of (Ctx) = Updating; -- Process bytes with CSHAKE. -- -- This procedure can only be called when the Ctx is in the Updating state. -- It can be called multiple times to process a large amount of data. -- -- @param Ctx The CSHAKE context. -- -- @param Message The data to process with CSHAKE. procedure Update (Ctx : in out Context; Message : in Byte_Array; Bit_Length : in Natural) with Global => null, Depends => (Ctx =>+ (Message, Bit_Length)), Pre => (State_Of (Ctx) = Updating and then (Message'Length < Natural'Last / 8) and then Bit_Length <= Message'Length * 8), Contract_Cases => (Bit_Length mod 8 = 0 => State_Of (Ctx) = Updating, others => State_Of (Ctx) = Ready_To_Extract); -- Process bits with CSHAKE. -- -- This procedure can only be called when the Ctx is in the Updating state. -- -- This procedure may be called multiple times to process long messages, -- as long as the Bit_Length is a multiple of 8 for all calls except the -- last call, which may use any Bit_Length value. procedure Extract (Ctx : in out Context; Digest : out Byte_Array) with Global => null, Depends => ((Ctx, Digest) => (Ctx, Digest)), Post => State_Of (Ctx) = Extracting; -- Produce output bytes. -- -- Note that after Extract has been called it is no longer possible to -- process data using Update. -- -- This function can be called multiple times to produce an arbitrary -- amount of output bytes. -- -- @param Ctx The CSHAKE context. -- -- @param Digest The output bytes are written to this byte array. The -- length of this array determines the number of bytes to produce. function State_Of (Ctx : in Context) return States with Global => null; -- Get the current state of a context. function Rate return Positive with Global => null, Post => Rate'Result mod 8 = 0; -- Get the rate parameter (in bits) of the CSHAKE instance. -- -- The rate is defined as the underlying state size minus the capacity -- parameter. E.g. for CSHAKE128 the state size is 1600 bits (the state -- is based on Keccak[1600]), and the Capacity is 256 bits, which results -- in a rate of 1600 - 256 = 1344 bits (168 bytes). private use type XOF.States; type Context is record XOF_Ctx : XOF.Context; end record; function State_Of (Ctx : in Context) return States is (case XOF.State_Of (Ctx.XOF_Ctx) is when XOF.Updating => Updating, when XOF.Ready_To_Extract => Ready_To_Extract, when XOF.Extracting => Extracting); function Rate return Positive is (XOF.Rate); end Keccak.Generic_CSHAKE;
[ { "context": "-- part of AdaYaml, (c) 2017 Felix Krause\n-- released under the terms of the MIT license, ", "end": 42, "score": 0.9998412132263184, "start": 30, "tag": "NAME", "value": "Felix Krause" } ]
src/annotation_processor/implementation/yaml-transformator-annotation-concatenation.adb
robdaemon/AdaYaml
32
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" with Ada.Unchecked_Deallocation; package body Yaml.Transformator.Annotation.Concatenation is procedure Put (Object : in out Instance; E : Event) is begin Object.State.all (Object, E); end Put; function Has_Next (Object : Instance) return Boolean is (Object.Current_Exists); function Next (Object : in out Instance) return Event is begin if not Object.Current_Exists then raise Constraint_Error with "no event to retrieve"; end if; return Ret : constant Event := Object.Current do if Object.Current_Aliased.Exists then Object.Current := Object.Current_Aliased.Value.Next; case Object.Current.Kind is when Sequence_Start => Object.Depth := Object.Depth + 1; when Sequence_End => Object.Depth := Object.Depth - 1; if Object.Depth = 0 then Object.Current_Exists := False; Object.Current_Aliased.Clear; end if; when others => null; end case; else Object.Current_Exists := False; end if; end return; end Next; function New_Concatenation (Pool : Text.Pool.Reference; Node_Context : Node_Context_Type; Processor_Context : Events.Context.Reference; Swallows_Previous : out Boolean) return not null Pointer is pragma Unreferenced (Node_Context); begin Swallows_Previous := False; return new Instance'(Transformator.Instance with Pool => Pool, Context => Processor_Context, others => <>); end New_Concatenation; procedure Initial (Object : in out Instance; E : Event) is begin if E.Kind /= Annotation_Start then raise Stream_Error with "unexpected token (expected annotation start): " & E.Kind'Img; end if; Object.Node_Properties := E.Annotation_Properties; Object.Current.Start_Position := E.Start_Position; Object.State := After_Annotation_Start'Access; end Initial; procedure After_Annotation_Start (Object : in out Instance; E : Event) is begin if E.Kind /= Annotation_End then raise Annotation_Error with "@@concat does not take any parameters."; end if; Object.State := After_Annotation_End'Access; end After_Annotation_Start; procedure After_Annotation_End (Object : in out Instance; E : Event) is begin if E.Kind /= Sequence_Start then raise Annotation_Error with "@@concat must be applied on a sequence."; end if; Object.State := After_List_Start'Access; end After_Annotation_End; procedure After_List_Start (Object : in out Instance; E : Event) is begin case E.Kind is when Scalar => Object.Builder := new Text.Builder.Reference'(Text.Builder.Create (Object.Pool)); Object.Builder.Append (E.Content.Value); Object.State := After_String'Access; when Sequence_Start => Object.Depth := 1; Object.Current := Event'(Kind => Sequence_Start, Collection_Style => Any, Collection_Properties => Default_Properties, others => <>); Object.Current_Exists := True; Object.State := In_Sequence'Access; when Alias => declare use type Events.Context.Cursor; use type Text.Reference; Position : constant Events.Context.Cursor := Events.Context.Position (Object.Context, E.Target); begin if Position = Events.Context.No_Element then raise Annotation_Error with "Unresolvable alias: *" & E.Target; end if; declare Stream : constant Events.Store.Stream_Reference := Events.Context.Retrieve (Position); Referred : constant Event := Stream.Value.Next; begin case Referred.Kind is when Scalar => Object.Builder := new Text.Builder.Reference'(Text.Builder.Create (Object.Pool)); Object.Builder.Append (Referred.Content.Value); Object.State := After_String'Access; when Sequence_Start => Object.Depth := 1; Object.Current := Event'(Kind => Sequence_Start, Collection_Style => Any, Collection_Properties => Object.Node_Properties, others => <>); Object.Current_Exists := True; Object.State := After_Sequence'Access; Object.Current_Aliased := Stream.Optional; when others => raise Annotation_Error with "@@concat requires a list of scalars or sequences"; end case; end; end; when others => raise Annotation_Error with "@@concat requires a list of scalars or sequences"; end case; end After_List_Start; procedure In_Sequence (Object : in out Instance; E : Event) is begin case E.Kind is when Sequence_Start => Object.Depth := Object.Depth + 1; Object.Current := E; Object.Current_Exists := True; when Sequence_End => Object.Depth := Object.Depth - 1; if Object.Depth = 0 then Object.State := After_Sequence'Access; else Object.Current := E; Object.Current_Exists := True; end if; when others => Object.Current := E; Object.Current_Exists := True; end case; end In_Sequence; procedure After_Sequence (Object : in out Instance; E : Event) is begin case E.Kind is when Sequence_Start => Object.Depth := 1; Object.State := In_Sequence'Access; when Alias => declare use type Events.Context.Cursor; use type Text.Reference; Position : constant Events.Context.Cursor := Events.Context.Position (Object.Context, E.Target); begin if Position = Events.Context.No_Element then raise Annotation_Error with "Unresolvable alias: *" & E.Target; end if; declare Stream : constant Events.Store.Stream_Reference := Events.Context.Retrieve (Position); Referred : constant Event := Stream.Value.Next; begin if Referred.Kind = Sequence_Start then Object.Current := Stream.Value.Next; if Object.Current.Kind /= Sequence_End then Object.Depth := (if Object.Current.Kind = Sequence_Start then 2 else 1); Object.Current_Exists := True; Object.Current_Aliased := Stream.Optional; end if; else raise Annotation_Error with "illegal element in sequence, expected another sequence" & Referred.Kind'Img; end if; end; end; when Sequence_End => Object.Current := E; Object.Current_Exists := True; Object.State := After_List_End'Access; when others => raise Annotation_Error with "illegal element in sequence, expected another sequence: " & E.Kind'Img; end case; end After_Sequence; procedure After_String (Object : in out Instance; E : Event) is procedure Free is new Ada.Unchecked_Deallocation (Text.Builder.Reference, Builder_Pointer); begin case E.Kind is when Scalar => Object.Builder.Append (E.Content.Value); when Alias => declare use type Events.Context.Cursor; use type Text.Reference; Position : constant Events.Context.Cursor := Events.Context.Position (Object.Context, E.Target); begin if Position = Events.Context.No_Element then raise Annotation_Error with "Unresolvable alias: *" & E.Target; end if; declare Stream : constant Events.Store.Stream_Reference := Events.Context.Retrieve (Position); Referred_Event : constant Event := Stream.Value.Next; begin if Referred_Event.Kind /= Scalar then raise Annotation_Error with "illegal element in concatenation sequence, expected another scalar: " & E.Kind'Img; end if; Object.Builder.Append (Referred_Event.Content.Value); end; end; when Sequence_End => Object.Current := (Kind => Scalar, Scalar_Style => Any, Scalar_Properties => Object.Node_Properties, Start_Position => Object.Current.Start_Position, End_Position => E.End_Position, Content => Object.Builder.Lock); Object.Current_Exists := True; Free (Object.Builder); Object.State := After_List_End'Access; when others => raise Annotation_Error with "illegal element in concatenation sequence, expected another scalar: " & E.Kind'Img; end case; end After_String; procedure After_List_End (Object : in out Instance; E : Event) is begin raise Constraint_Error with "unexpected input to @@concat (already finished)"; end After_List_End; begin Map.Include ("concat", New_Concatenation'Access); end Yaml.Transformator.Annotation.Concatenation;
24840
-- part of AdaYaml, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "copying.txt" with Ada.Unchecked_Deallocation; package body Yaml.Transformator.Annotation.Concatenation is procedure Put (Object : in out Instance; E : Event) is begin Object.State.all (Object, E); end Put; function Has_Next (Object : Instance) return Boolean is (Object.Current_Exists); function Next (Object : in out Instance) return Event is begin if not Object.Current_Exists then raise Constraint_Error with "no event to retrieve"; end if; return Ret : constant Event := Object.Current do if Object.Current_Aliased.Exists then Object.Current := Object.Current_Aliased.Value.Next; case Object.Current.Kind is when Sequence_Start => Object.Depth := Object.Depth + 1; when Sequence_End => Object.Depth := Object.Depth - 1; if Object.Depth = 0 then Object.Current_Exists := False; Object.Current_Aliased.Clear; end if; when others => null; end case; else Object.Current_Exists := False; end if; end return; end Next; function New_Concatenation (Pool : Text.Pool.Reference; Node_Context : Node_Context_Type; Processor_Context : Events.Context.Reference; Swallows_Previous : out Boolean) return not null Pointer is pragma Unreferenced (Node_Context); begin Swallows_Previous := False; return new Instance'(Transformator.Instance with Pool => Pool, Context => Processor_Context, others => <>); end New_Concatenation; procedure Initial (Object : in out Instance; E : Event) is begin if E.Kind /= Annotation_Start then raise Stream_Error with "unexpected token (expected annotation start): " & E.Kind'Img; end if; Object.Node_Properties := E.Annotation_Properties; Object.Current.Start_Position := E.Start_Position; Object.State := After_Annotation_Start'Access; end Initial; procedure After_Annotation_Start (Object : in out Instance; E : Event) is begin if E.Kind /= Annotation_End then raise Annotation_Error with "@@concat does not take any parameters."; end if; Object.State := After_Annotation_End'Access; end After_Annotation_Start; procedure After_Annotation_End (Object : in out Instance; E : Event) is begin if E.Kind /= Sequence_Start then raise Annotation_Error with "@@concat must be applied on a sequence."; end if; Object.State := After_List_Start'Access; end After_Annotation_End; procedure After_List_Start (Object : in out Instance; E : Event) is begin case E.Kind is when Scalar => Object.Builder := new Text.Builder.Reference'(Text.Builder.Create (Object.Pool)); Object.Builder.Append (E.Content.Value); Object.State := After_String'Access; when Sequence_Start => Object.Depth := 1; Object.Current := Event'(Kind => Sequence_Start, Collection_Style => Any, Collection_Properties => Default_Properties, others => <>); Object.Current_Exists := True; Object.State := In_Sequence'Access; when Alias => declare use type Events.Context.Cursor; use type Text.Reference; Position : constant Events.Context.Cursor := Events.Context.Position (Object.Context, E.Target); begin if Position = Events.Context.No_Element then raise Annotation_Error with "Unresolvable alias: *" & E.Target; end if; declare Stream : constant Events.Store.Stream_Reference := Events.Context.Retrieve (Position); Referred : constant Event := Stream.Value.Next; begin case Referred.Kind is when Scalar => Object.Builder := new Text.Builder.Reference'(Text.Builder.Create (Object.Pool)); Object.Builder.Append (Referred.Content.Value); Object.State := After_String'Access; when Sequence_Start => Object.Depth := 1; Object.Current := Event'(Kind => Sequence_Start, Collection_Style => Any, Collection_Properties => Object.Node_Properties, others => <>); Object.Current_Exists := True; Object.State := After_Sequence'Access; Object.Current_Aliased := Stream.Optional; when others => raise Annotation_Error with "@@concat requires a list of scalars or sequences"; end case; end; end; when others => raise Annotation_Error with "@@concat requires a list of scalars or sequences"; end case; end After_List_Start; procedure In_Sequence (Object : in out Instance; E : Event) is begin case E.Kind is when Sequence_Start => Object.Depth := Object.Depth + 1; Object.Current := E; Object.Current_Exists := True; when Sequence_End => Object.Depth := Object.Depth - 1; if Object.Depth = 0 then Object.State := After_Sequence'Access; else Object.Current := E; Object.Current_Exists := True; end if; when others => Object.Current := E; Object.Current_Exists := True; end case; end In_Sequence; procedure After_Sequence (Object : in out Instance; E : Event) is begin case E.Kind is when Sequence_Start => Object.Depth := 1; Object.State := In_Sequence'Access; when Alias => declare use type Events.Context.Cursor; use type Text.Reference; Position : constant Events.Context.Cursor := Events.Context.Position (Object.Context, E.Target); begin if Position = Events.Context.No_Element then raise Annotation_Error with "Unresolvable alias: *" & E.Target; end if; declare Stream : constant Events.Store.Stream_Reference := Events.Context.Retrieve (Position); Referred : constant Event := Stream.Value.Next; begin if Referred.Kind = Sequence_Start then Object.Current := Stream.Value.Next; if Object.Current.Kind /= Sequence_End then Object.Depth := (if Object.Current.Kind = Sequence_Start then 2 else 1); Object.Current_Exists := True; Object.Current_Aliased := Stream.Optional; end if; else raise Annotation_Error with "illegal element in sequence, expected another sequence" & Referred.Kind'Img; end if; end; end; when Sequence_End => Object.Current := E; Object.Current_Exists := True; Object.State := After_List_End'Access; when others => raise Annotation_Error with "illegal element in sequence, expected another sequence: " & E.Kind'Img; end case; end After_Sequence; procedure After_String (Object : in out Instance; E : Event) is procedure Free is new Ada.Unchecked_Deallocation (Text.Builder.Reference, Builder_Pointer); begin case E.Kind is when Scalar => Object.Builder.Append (E.Content.Value); when Alias => declare use type Events.Context.Cursor; use type Text.Reference; Position : constant Events.Context.Cursor := Events.Context.Position (Object.Context, E.Target); begin if Position = Events.Context.No_Element then raise Annotation_Error with "Unresolvable alias: *" & E.Target; end if; declare Stream : constant Events.Store.Stream_Reference := Events.Context.Retrieve (Position); Referred_Event : constant Event := Stream.Value.Next; begin if Referred_Event.Kind /= Scalar then raise Annotation_Error with "illegal element in concatenation sequence, expected another scalar: " & E.Kind'Img; end if; Object.Builder.Append (Referred_Event.Content.Value); end; end; when Sequence_End => Object.Current := (Kind => Scalar, Scalar_Style => Any, Scalar_Properties => Object.Node_Properties, Start_Position => Object.Current.Start_Position, End_Position => E.End_Position, Content => Object.Builder.Lock); Object.Current_Exists := True; Free (Object.Builder); Object.State := After_List_End'Access; when others => raise Annotation_Error with "illegal element in concatenation sequence, expected another scalar: " & E.Kind'Img; end case; end After_String; procedure After_List_End (Object : in out Instance; E : Event) is begin raise Constraint_Error with "unexpected input to @@concat (already finished)"; end After_List_End; begin Map.Include ("concat", New_Concatenation'Access); end Yaml.Transformator.Annotation.Concatenation;
true
-- part of AdaYaml, (c) 2017 PI:NAME:<NAME>END_PI -- released under the terms of the MIT license, see the file "copying.txt" with Ada.Unchecked_Deallocation; package body Yaml.Transformator.Annotation.Concatenation is procedure Put (Object : in out Instance; E : Event) is begin Object.State.all (Object, E); end Put; function Has_Next (Object : Instance) return Boolean is (Object.Current_Exists); function Next (Object : in out Instance) return Event is begin if not Object.Current_Exists then raise Constraint_Error with "no event to retrieve"; end if; return Ret : constant Event := Object.Current do if Object.Current_Aliased.Exists then Object.Current := Object.Current_Aliased.Value.Next; case Object.Current.Kind is when Sequence_Start => Object.Depth := Object.Depth + 1; when Sequence_End => Object.Depth := Object.Depth - 1; if Object.Depth = 0 then Object.Current_Exists := False; Object.Current_Aliased.Clear; end if; when others => null; end case; else Object.Current_Exists := False; end if; end return; end Next; function New_Concatenation (Pool : Text.Pool.Reference; Node_Context : Node_Context_Type; Processor_Context : Events.Context.Reference; Swallows_Previous : out Boolean) return not null Pointer is pragma Unreferenced (Node_Context); begin Swallows_Previous := False; return new Instance'(Transformator.Instance with Pool => Pool, Context => Processor_Context, others => <>); end New_Concatenation; procedure Initial (Object : in out Instance; E : Event) is begin if E.Kind /= Annotation_Start then raise Stream_Error with "unexpected token (expected annotation start): " & E.Kind'Img; end if; Object.Node_Properties := E.Annotation_Properties; Object.Current.Start_Position := E.Start_Position; Object.State := After_Annotation_Start'Access; end Initial; procedure After_Annotation_Start (Object : in out Instance; E : Event) is begin if E.Kind /= Annotation_End then raise Annotation_Error with "@@concat does not take any parameters."; end if; Object.State := After_Annotation_End'Access; end After_Annotation_Start; procedure After_Annotation_End (Object : in out Instance; E : Event) is begin if E.Kind /= Sequence_Start then raise Annotation_Error with "@@concat must be applied on a sequence."; end if; Object.State := After_List_Start'Access; end After_Annotation_End; procedure After_List_Start (Object : in out Instance; E : Event) is begin case E.Kind is when Scalar => Object.Builder := new Text.Builder.Reference'(Text.Builder.Create (Object.Pool)); Object.Builder.Append (E.Content.Value); Object.State := After_String'Access; when Sequence_Start => Object.Depth := 1; Object.Current := Event'(Kind => Sequence_Start, Collection_Style => Any, Collection_Properties => Default_Properties, others => <>); Object.Current_Exists := True; Object.State := In_Sequence'Access; when Alias => declare use type Events.Context.Cursor; use type Text.Reference; Position : constant Events.Context.Cursor := Events.Context.Position (Object.Context, E.Target); begin if Position = Events.Context.No_Element then raise Annotation_Error with "Unresolvable alias: *" & E.Target; end if; declare Stream : constant Events.Store.Stream_Reference := Events.Context.Retrieve (Position); Referred : constant Event := Stream.Value.Next; begin case Referred.Kind is when Scalar => Object.Builder := new Text.Builder.Reference'(Text.Builder.Create (Object.Pool)); Object.Builder.Append (Referred.Content.Value); Object.State := After_String'Access; when Sequence_Start => Object.Depth := 1; Object.Current := Event'(Kind => Sequence_Start, Collection_Style => Any, Collection_Properties => Object.Node_Properties, others => <>); Object.Current_Exists := True; Object.State := After_Sequence'Access; Object.Current_Aliased := Stream.Optional; when others => raise Annotation_Error with "@@concat requires a list of scalars or sequences"; end case; end; end; when others => raise Annotation_Error with "@@concat requires a list of scalars or sequences"; end case; end After_List_Start; procedure In_Sequence (Object : in out Instance; E : Event) is begin case E.Kind is when Sequence_Start => Object.Depth := Object.Depth + 1; Object.Current := E; Object.Current_Exists := True; when Sequence_End => Object.Depth := Object.Depth - 1; if Object.Depth = 0 then Object.State := After_Sequence'Access; else Object.Current := E; Object.Current_Exists := True; end if; when others => Object.Current := E; Object.Current_Exists := True; end case; end In_Sequence; procedure After_Sequence (Object : in out Instance; E : Event) is begin case E.Kind is when Sequence_Start => Object.Depth := 1; Object.State := In_Sequence'Access; when Alias => declare use type Events.Context.Cursor; use type Text.Reference; Position : constant Events.Context.Cursor := Events.Context.Position (Object.Context, E.Target); begin if Position = Events.Context.No_Element then raise Annotation_Error with "Unresolvable alias: *" & E.Target; end if; declare Stream : constant Events.Store.Stream_Reference := Events.Context.Retrieve (Position); Referred : constant Event := Stream.Value.Next; begin if Referred.Kind = Sequence_Start then Object.Current := Stream.Value.Next; if Object.Current.Kind /= Sequence_End then Object.Depth := (if Object.Current.Kind = Sequence_Start then 2 else 1); Object.Current_Exists := True; Object.Current_Aliased := Stream.Optional; end if; else raise Annotation_Error with "illegal element in sequence, expected another sequence" & Referred.Kind'Img; end if; end; end; when Sequence_End => Object.Current := E; Object.Current_Exists := True; Object.State := After_List_End'Access; when others => raise Annotation_Error with "illegal element in sequence, expected another sequence: " & E.Kind'Img; end case; end After_Sequence; procedure After_String (Object : in out Instance; E : Event) is procedure Free is new Ada.Unchecked_Deallocation (Text.Builder.Reference, Builder_Pointer); begin case E.Kind is when Scalar => Object.Builder.Append (E.Content.Value); when Alias => declare use type Events.Context.Cursor; use type Text.Reference; Position : constant Events.Context.Cursor := Events.Context.Position (Object.Context, E.Target); begin if Position = Events.Context.No_Element then raise Annotation_Error with "Unresolvable alias: *" & E.Target; end if; declare Stream : constant Events.Store.Stream_Reference := Events.Context.Retrieve (Position); Referred_Event : constant Event := Stream.Value.Next; begin if Referred_Event.Kind /= Scalar then raise Annotation_Error with "illegal element in concatenation sequence, expected another scalar: " & E.Kind'Img; end if; Object.Builder.Append (Referred_Event.Content.Value); end; end; when Sequence_End => Object.Current := (Kind => Scalar, Scalar_Style => Any, Scalar_Properties => Object.Node_Properties, Start_Position => Object.Current.Start_Position, End_Position => E.End_Position, Content => Object.Builder.Lock); Object.Current_Exists := True; Free (Object.Builder); Object.State := After_List_End'Access; when others => raise Annotation_Error with "illegal element in concatenation sequence, expected another scalar: " & E.Kind'Img; end case; end After_String; procedure After_List_End (Object : in out Instance; E : Event) is begin raise Constraint_Error with "unexpected input to @@concat (already finished)"; end After_List_End; begin Map.Include ("concat", New_Concatenation'Access); end Yaml.Transformator.Annotation.Concatenation;
[ { "context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 43, "score": 0.9998605251312256, "start": 33, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 63, "score": 0.999930739402771, "start": 45, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
source/nodes/program-nodes-case_statements.adb
reznikmm/gela
0
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Nodes.Case_Statements is function Create (Case_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Selecting_Expression : not null Program.Elements.Expressions .Expression_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Paths : not null Program.Elements.Case_Paths .Case_Path_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Case_Token_2 : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Case_Statement is begin return Result : Case_Statement := (Case_Token => Case_Token, Selecting_Expression => Selecting_Expression, Is_Token => Is_Token, Paths => Paths, End_Token => End_Token, Case_Token_2 => Case_Token_2, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Selecting_Expression : not null Program.Elements.Expressions .Expression_Access; Paths : not null Program.Elements.Case_Paths .Case_Path_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Case_Statement is begin return Result : Implicit_Case_Statement := (Selecting_Expression => Selecting_Expression, Paths => Paths, 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 Selecting_Expression (Self : Base_Case_Statement) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Selecting_Expression; end Selecting_Expression; overriding function Paths (Self : Base_Case_Statement) return not null Program.Elements.Case_Paths.Case_Path_Vector_Access is begin return Self.Paths; end Paths; overriding function Case_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Case_Token; end Case_Token; overriding function Is_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Is_Token; end Is_Token; overriding function End_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.End_Token; end End_Token; overriding function Case_Token_2 (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Case_Token_2; end Case_Token_2; overriding function Semicolon_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Case_Statement) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Case_Statement) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Case_Statement) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : in out Base_Case_Statement'Class) is begin Set_Enclosing_Element (Self.Selecting_Expression, Self'Unchecked_Access); for Item in Self.Paths.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Case_Statement (Self : Base_Case_Statement) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Case_Statement; overriding function Is_Statement (Self : Base_Case_Statement) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Statement; overriding procedure Visit (Self : not null access Base_Case_Statement; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Case_Statement (Self); end Visit; overriding function To_Case_Statement_Text (Self : in out Case_Statement) return Program.Elements.Case_Statements.Case_Statement_Text_Access is begin return Self'Unchecked_Access; end To_Case_Statement_Text; overriding function To_Case_Statement_Text (Self : in out Implicit_Case_Statement) return Program.Elements.Case_Statements.Case_Statement_Text_Access is pragma Unreferenced (Self); begin return null; end To_Case_Statement_Text; end Program.Nodes.Case_Statements;
27996
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Nodes.Case_Statements is function Create (Case_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Selecting_Expression : not null Program.Elements.Expressions .Expression_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Paths : not null Program.Elements.Case_Paths .Case_Path_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Case_Token_2 : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Case_Statement is begin return Result : Case_Statement := (Case_Token => Case_Token, Selecting_Expression => Selecting_Expression, Is_Token => Is_Token, Paths => Paths, End_Token => End_Token, Case_Token_2 => Case_Token_2, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Selecting_Expression : not null Program.Elements.Expressions .Expression_Access; Paths : not null Program.Elements.Case_Paths .Case_Path_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Case_Statement is begin return Result : Implicit_Case_Statement := (Selecting_Expression => Selecting_Expression, Paths => Paths, 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 Selecting_Expression (Self : Base_Case_Statement) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Selecting_Expression; end Selecting_Expression; overriding function Paths (Self : Base_Case_Statement) return not null Program.Elements.Case_Paths.Case_Path_Vector_Access is begin return Self.Paths; end Paths; overriding function Case_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Case_Token; end Case_Token; overriding function Is_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Is_Token; end Is_Token; overriding function End_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.End_Token; end End_Token; overriding function Case_Token_2 (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Case_Token_2; end Case_Token_2; overriding function Semicolon_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Case_Statement) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Case_Statement) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Case_Statement) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : in out Base_Case_Statement'Class) is begin Set_Enclosing_Element (Self.Selecting_Expression, Self'Unchecked_Access); for Item in Self.Paths.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Case_Statement (Self : Base_Case_Statement) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Case_Statement; overriding function Is_Statement (Self : Base_Case_Statement) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Statement; overriding procedure Visit (Self : not null access Base_Case_Statement; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Case_Statement (Self); end Visit; overriding function To_Case_Statement_Text (Self : in out Case_Statement) return Program.Elements.Case_Statements.Case_Statement_Text_Access is begin return Self'Unchecked_Access; end To_Case_Statement_Text; overriding function To_Case_Statement_Text (Self : in out Implicit_Case_Statement) return Program.Elements.Case_Statements.Case_Statement_Text_Access is pragma Unreferenced (Self); begin return null; end To_Case_Statement_Text; end Program.Nodes.Case_Statements;
true
-- SPDX-FileCopyrightText: 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Nodes.Case_Statements is function Create (Case_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Selecting_Expression : not null Program.Elements.Expressions .Expression_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Paths : not null Program.Elements.Case_Paths .Case_Path_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Case_Token_2 : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Case_Statement is begin return Result : Case_Statement := (Case_Token => Case_Token, Selecting_Expression => Selecting_Expression, Is_Token => Is_Token, Paths => Paths, End_Token => End_Token, Case_Token_2 => Case_Token_2, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Selecting_Expression : not null Program.Elements.Expressions .Expression_Access; Paths : not null Program.Elements.Case_Paths .Case_Path_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Case_Statement is begin return Result : Implicit_Case_Statement := (Selecting_Expression => Selecting_Expression, Paths => Paths, 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 Selecting_Expression (Self : Base_Case_Statement) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Selecting_Expression; end Selecting_Expression; overriding function Paths (Self : Base_Case_Statement) return not null Program.Elements.Case_Paths.Case_Path_Vector_Access is begin return Self.Paths; end Paths; overriding function Case_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Case_Token; end Case_Token; overriding function Is_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Is_Token; end Is_Token; overriding function End_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.End_Token; end End_Token; overriding function Case_Token_2 (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Case_Token_2; end Case_Token_2; overriding function Semicolon_Token (Self : Case_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Case_Statement) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Case_Statement) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Case_Statement) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : in out Base_Case_Statement'Class) is begin Set_Enclosing_Element (Self.Selecting_Expression, Self'Unchecked_Access); for Item in Self.Paths.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Case_Statement (Self : Base_Case_Statement) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Case_Statement; overriding function Is_Statement (Self : Base_Case_Statement) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Statement; overriding procedure Visit (Self : not null access Base_Case_Statement; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Case_Statement (Self); end Visit; overriding function To_Case_Statement_Text (Self : in out Case_Statement) return Program.Elements.Case_Statements.Case_Statement_Text_Access is begin return Self'Unchecked_Access; end To_Case_Statement_Text; overriding function To_Case_Statement_Text (Self : in out Implicit_Case_Statement) return Program.Elements.Case_Statements.Case_Statement_Text_Access is pragma Unreferenced (Self); begin return null; end To_Case_Statement_Text; end Program.Nodes.Case_Statements;
[ { "context": "---------------------------\n-- Copyright (c) 2014, Natacha Porté --\n-- ", "end": 115, "score": 0.9998552799224854, "start": 102, "tag": "NAME", "value": "Natacha Porté" } ]
tools/hmac-pinentry.ads
faelys/natools
0
------------------------------------------------------------------------------ -- Copyright (c) 2014, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- HMAC.Pinentry encapsulates communication with `pinentry` utility from -- -- GnuPG project. -- -- Depending on communication features available, the package might not be -- -- functional on all targets. A client should use Is_Available function to -- -- ensure the underlying implentation is indeed operational. -- ------------------------------------------------------------------------------ package HMAC.Pinentry is Backend_Error : exception; function Get_Key (Command : String) return String; -- Run the given Command and communicate with it using pinentry protocol -- and return a secret String or raise Backend_Error. function Is_Available return Boolean; -- Check whether Get_Key can actually work end HMAC.Pinentry;
6920
------------------------------------------------------------------------------ -- Copyright (c) 2014, <NAME> -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- HMAC.Pinentry encapsulates communication with `pinentry` utility from -- -- GnuPG project. -- -- Depending on communication features available, the package might not be -- -- functional on all targets. A client should use Is_Available function to -- -- ensure the underlying implentation is indeed operational. -- ------------------------------------------------------------------------------ package HMAC.Pinentry is Backend_Error : exception; function Get_Key (Command : String) return String; -- Run the given Command and communicate with it using pinentry protocol -- and return a secret String or raise Backend_Error. function Is_Available return Boolean; -- Check whether Get_Key can actually work end HMAC.Pinentry;
true
------------------------------------------------------------------------------ -- Copyright (c) 2014, PI:NAME:<NAME>END_PI -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- HMAC.Pinentry encapsulates communication with `pinentry` utility from -- -- GnuPG project. -- -- Depending on communication features available, the package might not be -- -- functional on all targets. A client should use Is_Available function to -- -- ensure the underlying implentation is indeed operational. -- ------------------------------------------------------------------------------ package HMAC.Pinentry is Backend_Error : exception; function Get_Key (Command : String) return String; -- Run the given Command and communicate with it using pinentry protocol -- and return a secret String or raise Backend_Error. function Is_Available return Boolean; -- Check whether Get_Key can actually work end HMAC.Pinentry;
[ { "context": "t Multimedia Library\n-- // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)\n-- //\n-- // This software", "end": 162, "score": 0.9998880624771118, "start": 148, "tag": "NAME", "value": "Laurent Gomila" }, { "context": "ary\n-- // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)\n-- //\n-- // This software is provided 'as-is', w", "end": 185, "score": 0.9999303817749023, "start": 164, "tag": "EMAIL", "value": "laurent.gom@gmail.com" } ]
include/sf-audio-soundstream.ads
danva994/ASFML-1.6
1
-- //////////////////////////////////////////////////////////// -- // -- // SFML - Simple and Fast Multimedia Library -- // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) -- // -- // 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. -- // -- //////////////////////////////////////////////////////////// -- //////////////////////////////////////////////////////////// -- // Headers -- //////////////////////////////////////////////////////////// with Sf.Config; with Sf.Audio.SoundStatus; with Sf.Audio.Types; package Sf.Audio.SoundStream is use Sf.Config; use Sf.Audio.SoundStatus; use Sf.Audio.Types; -- //////////////////////////////////////////////////////////// -- /// sfSoundStreamChunk defines the data to fill by the -- /// OnGetData callback -- //////////////////////////////////////////////////////////// type sfSoundStreamChunk is record Samples : sfInt16_Ptr; -- ///< Pointer to the audio samples NbSamples : aliased sfUint32; -- ///< Number of samples pointed by Samples end record; type sfSoundStreamStartCallback is access function (Arg0 : sfVoid_Ptr) return sfBool; -- ///< Type of the callback used to start a sound stream type sfSoundStreamGetDataCallback is access function (Arg0 : access sfSoundStreamChunk; Arg1 : sfVoid_Ptr) return sfBool; -- ///< Type of the callback used to get a sound stream data -- //////////////////////////////////////////////////////////// -- /// Construct a new sound stream -- /// -- /// \param OnStart : Function called when the stream starts (can be NULL) -- /// \param OnGetData : Function called when the stream needs more data (can't be NULL) -- /// \param ChannelsCount : Number of channels to use (1 = mono, 2 = stereo) -- /// \param SampleRate : Sample rate of the sound (44100 = CD quality) -- /// \param UserData : Data to pass to the callback functions -- /// -- /// \return A new sfSoundStream object (NULL if failed) -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_Create (OnStart : sfSoundStreamStartCallback; OnGetData : sfSoundStreamGetDataCallback; ChannelsCount : sfUint32; SampleRate : sfUint32; UserData : sfVoid_Ptr) return sfSoundStream_Ptr; -- //////////////////////////////////////////////////////////// -- /// Destroy an existing sound stream -- /// -- /// \param SoundStream : Sound stream to delete -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_Destroy (SoundStream : sfSoundStream_Ptr); -- //////////////////////////////////////////////////////////// -- /// Start playing a sound stream -- /// -- /// \param SoundStream : Sound stream to play -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_Play (SoundStream : sfSoundStream_Ptr); -- //////////////////////////////////////////////////////////// -- /// Pause a sound stream -- /// -- /// \param SoundStream : Sound stream to pause -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_Pause (SoundStream : sfSoundStream_Ptr); -- //////////////////////////////////////////////////////////// -- /// Stop playing a sound stream -- /// -- /// \param SoundStream : Sound stream to stop -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_Stop (SoundStream : sfSoundStream_Ptr); -- //////////////////////////////////////////////////////////// -- /// Get the status of a sound stream (stopped, paused, playing) -- /// -- /// \param SoundStream : Sound stream to get the status from -- /// -- /// \return Current status of the sound stream -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetStatus (SoundStream : sfSoundStream_Ptr) return sfSoundStatus; -- //////////////////////////////////////////////////////////// -- /// Return the number of channels of a sound stream -- /// (1 = mono, 2 = stereo) -- /// -- /// \param SoundStream : Sound stream to get the channels count from -- /// -- /// \return Number of channels -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetChannelsCount (SoundStream : sfSoundStream_Ptr) return sfUint32; -- //////////////////////////////////////////////////////////// -- /// Get the sample rate of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the sample rate from -- /// -- /// \return Stream frequency (number of samples per second) -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetSampleRate (SoundStream : sfSoundStream_Ptr) return sfUint32; -- //////////////////////////////////////////////////////////// -- /// Set the pitch of a sound stream -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param Pitch : New pitch -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetPitch (SoundStream : sfSoundStream_Ptr; Pitch : Float); -- //////////////////////////////////////////////////////////// -- /// Set the volume of a sound stream -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param Volume : Volume (in range [0, 100]) -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetVolume (SoundStream : sfSoundStream_Ptr; Volume : Float); -- //////////////////////////////////////////////////////////// -- /// Set the position of a sound stream -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param X : X position of the sound stream in the world -- /// \param Y : Y position of the sound stream in the world -- /// \param Z : Z position of the sound stream in the world -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetPosition (SoundStream : sfSoundStream_Ptr; X, Y, Z : Float); -- //////////////////////////////////////////////////////////// -- /// Make the sound stream's position relative to the listener's -- /// position, or absolute. -- /// The default value is false (absolute) -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param Relative : True to set the position relative, false to set it absolute -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetRelativeToListener (SoundStream : sfSoundStream_Ptr; Relative : sfBool); -- //////////////////////////////////////////////////////////// -- /// Set the minimum distance - closer than this distance, -- /// the listener will hear the sound stream at its maximum volume. -- /// The default minimum distance is 1.0 -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param MinDistance : New minimum distance for the sound stream -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetMinDistance (SoundStream : sfSoundStream_Ptr; MinDistance : Float); -- //////////////////////////////////////////////////////////// -- /// Set the attenuation factor - the higher the attenuation, the -- /// more the sound stream will be attenuated with distance from listener. -- /// The default attenuation factor 1.0 -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param Attenuation : New attenuation factor for the sound stream -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetAttenuation (SoundStream : sfSoundStream_Ptr; Attenuation : Float); -- //////////////////////////////////////////////////////////// -- /// Set a stream loop state -- /// -- /// \param SoundStream : Stream to set the loop state -- /// \param Loop : sfTrue to play in loop, sfFalse to play once -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetLoop (SoundStream : sfSoundStream_Ptr; Enable : sfBool); -- //////////////////////////////////////////////////////////// -- /// Get the pitch of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the pitch from -- /// -- /// \return Pitch value -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetPitch (SoundStream : sfSoundStream_Ptr) return Float; -- //////////////////////////////////////////////////////////// -- /// Get the volume of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the volume from -- /// -- /// \return Volume value (in range [1, 100]) -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetVolume (SoundStream : sfSoundStream_Ptr) return Float; -- //////////////////////////////////////////////////////////// -- /// Get the position of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the position from -- /// \param X : X position of the sound stream in the world -- /// \param Y : Y position of the sound stream in the world -- /// \param Z : Z position of the sound stream in the world -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_GetPosition (SoundStream : sfSoundStream_Ptr; X, Y, Z : access Float); -- //////////////////////////////////////////////////////////// -- /// Tell if the sound stream's position is relative to the listener's -- /// position, or if it's absolute -- /// -- /// \param SoundStream : Sound stream to check -- /// -- /// \return sfTrue if the position is relative, sfFalse if it's absolute -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_IsRelativeToListener (SoundStream : sfSoundStream_Ptr) return sfBool; -- //////////////////////////////////////////////////////////// -- /// Get the minimum distance of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the minimum distance from -- /// -- /// \return Minimum distance for the sound stream -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetMinDistance (SoundStream : sfSoundStream_Ptr) return Float; -- //////////////////////////////////////////////////////////// -- /// Get the attenuation factor of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the attenuation factor from -- /// -- /// \return Attenuation factor for the sound stream -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetAttenuation (SoundStream : sfSoundStream_Ptr) return Float; -- //////////////////////////////////////////////////////////// -- /// Tell whether or not a stream is looping -- /// -- /// \param SoundStream : Soundstream to get the loop state from -- /// -- /// \return sfTrue if the stream is looping, sfFalse otherwise -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetLoop (SoundStream : sfSoundStream_Ptr) return sfBool; -- //////////////////////////////////////////////////////////// -- /// Get the current playing position of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the position from -- /// -- /// \return Current playing position, expressed in seconds -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetPlayingOffset (SoundStream : sfSoundStream_Ptr) return Float; private pragma Convention (C, sfSoundStreamStartCallback); pragma Convention (C, sfSoundStreamGetDataCallback); pragma Convention (C_Pass_By_Copy, sfSoundStreamChunk); pragma Import (C, sfSoundStream_Create, "sfSoundStream_Create"); pragma Import (C, sfSoundStream_Destroy, "sfSoundStream_Destroy"); pragma Import (C, sfSoundStream_Play, "sfSoundStream_Play"); pragma Import (C, sfSoundStream_Pause, "sfSoundStream_Pause"); pragma Import (C, sfSoundStream_Stop, "sfSoundStream_Stop"); pragma Import (C, sfSoundStream_GetStatus, "sfSoundStream_GetStatus"); pragma Import (C, sfSoundStream_GetChannelsCount, "sfSoundStream_GetChannelsCount"); pragma Import (C, sfSoundStream_GetSampleRate, "sfSoundStream_GetSampleRate"); pragma Import (C, sfSoundStream_SetPitch, "sfSoundStream_SetPitch"); pragma Import (C, sfSoundStream_SetVolume, "sfSoundStream_SetVolume"); pragma Import (C, sfSoundStream_SetPosition, "sfSoundStream_SetPosition"); pragma Import (C, sfSoundStream_SetRelativeToListener, "sfSoundStream_SetRelativeToListener"); pragma Import (C, sfSoundStream_SetMinDistance, "sfSoundStream_SetMinDistance"); pragma Import (C, sfSoundStream_SetAttenuation, "sfSoundStream_SetAttenuation"); pragma Import (C, sfSoundStream_SetLoop, "sfSoundStream_SetLoop"); pragma Import (C, sfSoundStream_GetPitch, "sfSoundStream_GetPitch"); pragma Import (C, sfSoundStream_GetVolume, "sfSoundStream_GetVolume"); pragma Import (C, sfSoundStream_GetPosition, "sfSoundStream_GetPosition"); pragma Import (C, sfSoundStream_IsRelativeToListener, "sfSoundStream_IsRelativeToListener"); pragma Import (C, sfSoundStream_GetMinDistance, "sfSoundStream_GetMinDistance"); pragma Import (C, sfSoundStream_GetAttenuation, "sfSoundStream_GetAttenuation"); pragma Import (C, sfSoundStream_GetLoop, "sfSoundStream_GetLoop"); pragma Import (C, sfSoundStream_GetPlayingOffset, "sfSoundStream_GetPlayingOffset"); end Sf.Audio.SoundStream;
14322
-- //////////////////////////////////////////////////////////// -- // -- // SFML - Simple and Fast Multimedia Library -- // Copyright (C) 2007-2009 <NAME> (<EMAIL>) -- // -- // 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. -- // -- //////////////////////////////////////////////////////////// -- //////////////////////////////////////////////////////////// -- // Headers -- //////////////////////////////////////////////////////////// with Sf.Config; with Sf.Audio.SoundStatus; with Sf.Audio.Types; package Sf.Audio.SoundStream is use Sf.Config; use Sf.Audio.SoundStatus; use Sf.Audio.Types; -- //////////////////////////////////////////////////////////// -- /// sfSoundStreamChunk defines the data to fill by the -- /// OnGetData callback -- //////////////////////////////////////////////////////////// type sfSoundStreamChunk is record Samples : sfInt16_Ptr; -- ///< Pointer to the audio samples NbSamples : aliased sfUint32; -- ///< Number of samples pointed by Samples end record; type sfSoundStreamStartCallback is access function (Arg0 : sfVoid_Ptr) return sfBool; -- ///< Type of the callback used to start a sound stream type sfSoundStreamGetDataCallback is access function (Arg0 : access sfSoundStreamChunk; Arg1 : sfVoid_Ptr) return sfBool; -- ///< Type of the callback used to get a sound stream data -- //////////////////////////////////////////////////////////// -- /// Construct a new sound stream -- /// -- /// \param OnStart : Function called when the stream starts (can be NULL) -- /// \param OnGetData : Function called when the stream needs more data (can't be NULL) -- /// \param ChannelsCount : Number of channels to use (1 = mono, 2 = stereo) -- /// \param SampleRate : Sample rate of the sound (44100 = CD quality) -- /// \param UserData : Data to pass to the callback functions -- /// -- /// \return A new sfSoundStream object (NULL if failed) -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_Create (OnStart : sfSoundStreamStartCallback; OnGetData : sfSoundStreamGetDataCallback; ChannelsCount : sfUint32; SampleRate : sfUint32; UserData : sfVoid_Ptr) return sfSoundStream_Ptr; -- //////////////////////////////////////////////////////////// -- /// Destroy an existing sound stream -- /// -- /// \param SoundStream : Sound stream to delete -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_Destroy (SoundStream : sfSoundStream_Ptr); -- //////////////////////////////////////////////////////////// -- /// Start playing a sound stream -- /// -- /// \param SoundStream : Sound stream to play -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_Play (SoundStream : sfSoundStream_Ptr); -- //////////////////////////////////////////////////////////// -- /// Pause a sound stream -- /// -- /// \param SoundStream : Sound stream to pause -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_Pause (SoundStream : sfSoundStream_Ptr); -- //////////////////////////////////////////////////////////// -- /// Stop playing a sound stream -- /// -- /// \param SoundStream : Sound stream to stop -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_Stop (SoundStream : sfSoundStream_Ptr); -- //////////////////////////////////////////////////////////// -- /// Get the status of a sound stream (stopped, paused, playing) -- /// -- /// \param SoundStream : Sound stream to get the status from -- /// -- /// \return Current status of the sound stream -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetStatus (SoundStream : sfSoundStream_Ptr) return sfSoundStatus; -- //////////////////////////////////////////////////////////// -- /// Return the number of channels of a sound stream -- /// (1 = mono, 2 = stereo) -- /// -- /// \param SoundStream : Sound stream to get the channels count from -- /// -- /// \return Number of channels -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetChannelsCount (SoundStream : sfSoundStream_Ptr) return sfUint32; -- //////////////////////////////////////////////////////////// -- /// Get the sample rate of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the sample rate from -- /// -- /// \return Stream frequency (number of samples per second) -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetSampleRate (SoundStream : sfSoundStream_Ptr) return sfUint32; -- //////////////////////////////////////////////////////////// -- /// Set the pitch of a sound stream -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param Pitch : New pitch -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetPitch (SoundStream : sfSoundStream_Ptr; Pitch : Float); -- //////////////////////////////////////////////////////////// -- /// Set the volume of a sound stream -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param Volume : Volume (in range [0, 100]) -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetVolume (SoundStream : sfSoundStream_Ptr; Volume : Float); -- //////////////////////////////////////////////////////////// -- /// Set the position of a sound stream -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param X : X position of the sound stream in the world -- /// \param Y : Y position of the sound stream in the world -- /// \param Z : Z position of the sound stream in the world -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetPosition (SoundStream : sfSoundStream_Ptr; X, Y, Z : Float); -- //////////////////////////////////////////////////////////// -- /// Make the sound stream's position relative to the listener's -- /// position, or absolute. -- /// The default value is false (absolute) -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param Relative : True to set the position relative, false to set it absolute -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetRelativeToListener (SoundStream : sfSoundStream_Ptr; Relative : sfBool); -- //////////////////////////////////////////////////////////// -- /// Set the minimum distance - closer than this distance, -- /// the listener will hear the sound stream at its maximum volume. -- /// The default minimum distance is 1.0 -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param MinDistance : New minimum distance for the sound stream -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetMinDistance (SoundStream : sfSoundStream_Ptr; MinDistance : Float); -- //////////////////////////////////////////////////////////// -- /// Set the attenuation factor - the higher the attenuation, the -- /// more the sound stream will be attenuated with distance from listener. -- /// The default attenuation factor 1.0 -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param Attenuation : New attenuation factor for the sound stream -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetAttenuation (SoundStream : sfSoundStream_Ptr; Attenuation : Float); -- //////////////////////////////////////////////////////////// -- /// Set a stream loop state -- /// -- /// \param SoundStream : Stream to set the loop state -- /// \param Loop : sfTrue to play in loop, sfFalse to play once -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetLoop (SoundStream : sfSoundStream_Ptr; Enable : sfBool); -- //////////////////////////////////////////////////////////// -- /// Get the pitch of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the pitch from -- /// -- /// \return Pitch value -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetPitch (SoundStream : sfSoundStream_Ptr) return Float; -- //////////////////////////////////////////////////////////// -- /// Get the volume of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the volume from -- /// -- /// \return Volume value (in range [1, 100]) -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetVolume (SoundStream : sfSoundStream_Ptr) return Float; -- //////////////////////////////////////////////////////////// -- /// Get the position of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the position from -- /// \param X : X position of the sound stream in the world -- /// \param Y : Y position of the sound stream in the world -- /// \param Z : Z position of the sound stream in the world -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_GetPosition (SoundStream : sfSoundStream_Ptr; X, Y, Z : access Float); -- //////////////////////////////////////////////////////////// -- /// Tell if the sound stream's position is relative to the listener's -- /// position, or if it's absolute -- /// -- /// \param SoundStream : Sound stream to check -- /// -- /// \return sfTrue if the position is relative, sfFalse if it's absolute -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_IsRelativeToListener (SoundStream : sfSoundStream_Ptr) return sfBool; -- //////////////////////////////////////////////////////////// -- /// Get the minimum distance of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the minimum distance from -- /// -- /// \return Minimum distance for the sound stream -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetMinDistance (SoundStream : sfSoundStream_Ptr) return Float; -- //////////////////////////////////////////////////////////// -- /// Get the attenuation factor of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the attenuation factor from -- /// -- /// \return Attenuation factor for the sound stream -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetAttenuation (SoundStream : sfSoundStream_Ptr) return Float; -- //////////////////////////////////////////////////////////// -- /// Tell whether or not a stream is looping -- /// -- /// \param SoundStream : Soundstream to get the loop state from -- /// -- /// \return sfTrue if the stream is looping, sfFalse otherwise -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetLoop (SoundStream : sfSoundStream_Ptr) return sfBool; -- //////////////////////////////////////////////////////////// -- /// Get the current playing position of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the position from -- /// -- /// \return Current playing position, expressed in seconds -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetPlayingOffset (SoundStream : sfSoundStream_Ptr) return Float; private pragma Convention (C, sfSoundStreamStartCallback); pragma Convention (C, sfSoundStreamGetDataCallback); pragma Convention (C_Pass_By_Copy, sfSoundStreamChunk); pragma Import (C, sfSoundStream_Create, "sfSoundStream_Create"); pragma Import (C, sfSoundStream_Destroy, "sfSoundStream_Destroy"); pragma Import (C, sfSoundStream_Play, "sfSoundStream_Play"); pragma Import (C, sfSoundStream_Pause, "sfSoundStream_Pause"); pragma Import (C, sfSoundStream_Stop, "sfSoundStream_Stop"); pragma Import (C, sfSoundStream_GetStatus, "sfSoundStream_GetStatus"); pragma Import (C, sfSoundStream_GetChannelsCount, "sfSoundStream_GetChannelsCount"); pragma Import (C, sfSoundStream_GetSampleRate, "sfSoundStream_GetSampleRate"); pragma Import (C, sfSoundStream_SetPitch, "sfSoundStream_SetPitch"); pragma Import (C, sfSoundStream_SetVolume, "sfSoundStream_SetVolume"); pragma Import (C, sfSoundStream_SetPosition, "sfSoundStream_SetPosition"); pragma Import (C, sfSoundStream_SetRelativeToListener, "sfSoundStream_SetRelativeToListener"); pragma Import (C, sfSoundStream_SetMinDistance, "sfSoundStream_SetMinDistance"); pragma Import (C, sfSoundStream_SetAttenuation, "sfSoundStream_SetAttenuation"); pragma Import (C, sfSoundStream_SetLoop, "sfSoundStream_SetLoop"); pragma Import (C, sfSoundStream_GetPitch, "sfSoundStream_GetPitch"); pragma Import (C, sfSoundStream_GetVolume, "sfSoundStream_GetVolume"); pragma Import (C, sfSoundStream_GetPosition, "sfSoundStream_GetPosition"); pragma Import (C, sfSoundStream_IsRelativeToListener, "sfSoundStream_IsRelativeToListener"); pragma Import (C, sfSoundStream_GetMinDistance, "sfSoundStream_GetMinDistance"); pragma Import (C, sfSoundStream_GetAttenuation, "sfSoundStream_GetAttenuation"); pragma Import (C, sfSoundStream_GetLoop, "sfSoundStream_GetLoop"); pragma Import (C, sfSoundStream_GetPlayingOffset, "sfSoundStream_GetPlayingOffset"); end Sf.Audio.SoundStream;
true
-- //////////////////////////////////////////////////////////// -- // -- // SFML - Simple and Fast Multimedia Library -- // Copyright (C) 2007-2009 PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- // -- // 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. -- // -- //////////////////////////////////////////////////////////// -- //////////////////////////////////////////////////////////// -- // Headers -- //////////////////////////////////////////////////////////// with Sf.Config; with Sf.Audio.SoundStatus; with Sf.Audio.Types; package Sf.Audio.SoundStream is use Sf.Config; use Sf.Audio.SoundStatus; use Sf.Audio.Types; -- //////////////////////////////////////////////////////////// -- /// sfSoundStreamChunk defines the data to fill by the -- /// OnGetData callback -- //////////////////////////////////////////////////////////// type sfSoundStreamChunk is record Samples : sfInt16_Ptr; -- ///< Pointer to the audio samples NbSamples : aliased sfUint32; -- ///< Number of samples pointed by Samples end record; type sfSoundStreamStartCallback is access function (Arg0 : sfVoid_Ptr) return sfBool; -- ///< Type of the callback used to start a sound stream type sfSoundStreamGetDataCallback is access function (Arg0 : access sfSoundStreamChunk; Arg1 : sfVoid_Ptr) return sfBool; -- ///< Type of the callback used to get a sound stream data -- //////////////////////////////////////////////////////////// -- /// Construct a new sound stream -- /// -- /// \param OnStart : Function called when the stream starts (can be NULL) -- /// \param OnGetData : Function called when the stream needs more data (can't be NULL) -- /// \param ChannelsCount : Number of channels to use (1 = mono, 2 = stereo) -- /// \param SampleRate : Sample rate of the sound (44100 = CD quality) -- /// \param UserData : Data to pass to the callback functions -- /// -- /// \return A new sfSoundStream object (NULL if failed) -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_Create (OnStart : sfSoundStreamStartCallback; OnGetData : sfSoundStreamGetDataCallback; ChannelsCount : sfUint32; SampleRate : sfUint32; UserData : sfVoid_Ptr) return sfSoundStream_Ptr; -- //////////////////////////////////////////////////////////// -- /// Destroy an existing sound stream -- /// -- /// \param SoundStream : Sound stream to delete -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_Destroy (SoundStream : sfSoundStream_Ptr); -- //////////////////////////////////////////////////////////// -- /// Start playing a sound stream -- /// -- /// \param SoundStream : Sound stream to play -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_Play (SoundStream : sfSoundStream_Ptr); -- //////////////////////////////////////////////////////////// -- /// Pause a sound stream -- /// -- /// \param SoundStream : Sound stream to pause -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_Pause (SoundStream : sfSoundStream_Ptr); -- //////////////////////////////////////////////////////////// -- /// Stop playing a sound stream -- /// -- /// \param SoundStream : Sound stream to stop -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_Stop (SoundStream : sfSoundStream_Ptr); -- //////////////////////////////////////////////////////////// -- /// Get the status of a sound stream (stopped, paused, playing) -- /// -- /// \param SoundStream : Sound stream to get the status from -- /// -- /// \return Current status of the sound stream -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetStatus (SoundStream : sfSoundStream_Ptr) return sfSoundStatus; -- //////////////////////////////////////////////////////////// -- /// Return the number of channels of a sound stream -- /// (1 = mono, 2 = stereo) -- /// -- /// \param SoundStream : Sound stream to get the channels count from -- /// -- /// \return Number of channels -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetChannelsCount (SoundStream : sfSoundStream_Ptr) return sfUint32; -- //////////////////////////////////////////////////////////// -- /// Get the sample rate of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the sample rate from -- /// -- /// \return Stream frequency (number of samples per second) -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetSampleRate (SoundStream : sfSoundStream_Ptr) return sfUint32; -- //////////////////////////////////////////////////////////// -- /// Set the pitch of a sound stream -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param Pitch : New pitch -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetPitch (SoundStream : sfSoundStream_Ptr; Pitch : Float); -- //////////////////////////////////////////////////////////// -- /// Set the volume of a sound stream -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param Volume : Volume (in range [0, 100]) -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetVolume (SoundStream : sfSoundStream_Ptr; Volume : Float); -- //////////////////////////////////////////////////////////// -- /// Set the position of a sound stream -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param X : X position of the sound stream in the world -- /// \param Y : Y position of the sound stream in the world -- /// \param Z : Z position of the sound stream in the world -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetPosition (SoundStream : sfSoundStream_Ptr; X, Y, Z : Float); -- //////////////////////////////////////////////////////////// -- /// Make the sound stream's position relative to the listener's -- /// position, or absolute. -- /// The default value is false (absolute) -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param Relative : True to set the position relative, false to set it absolute -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetRelativeToListener (SoundStream : sfSoundStream_Ptr; Relative : sfBool); -- //////////////////////////////////////////////////////////// -- /// Set the minimum distance - closer than this distance, -- /// the listener will hear the sound stream at its maximum volume. -- /// The default minimum distance is 1.0 -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param MinDistance : New minimum distance for the sound stream -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetMinDistance (SoundStream : sfSoundStream_Ptr; MinDistance : Float); -- //////////////////////////////////////////////////////////// -- /// Set the attenuation factor - the higher the attenuation, the -- /// more the sound stream will be attenuated with distance from listener. -- /// The default attenuation factor 1.0 -- /// -- /// \param SoundStream : Sound stream to modify -- /// \param Attenuation : New attenuation factor for the sound stream -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetAttenuation (SoundStream : sfSoundStream_Ptr; Attenuation : Float); -- //////////////////////////////////////////////////////////// -- /// Set a stream loop state -- /// -- /// \param SoundStream : Stream to set the loop state -- /// \param Loop : sfTrue to play in loop, sfFalse to play once -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_SetLoop (SoundStream : sfSoundStream_Ptr; Enable : sfBool); -- //////////////////////////////////////////////////////////// -- /// Get the pitch of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the pitch from -- /// -- /// \return Pitch value -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetPitch (SoundStream : sfSoundStream_Ptr) return Float; -- //////////////////////////////////////////////////////////// -- /// Get the volume of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the volume from -- /// -- /// \return Volume value (in range [1, 100]) -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetVolume (SoundStream : sfSoundStream_Ptr) return Float; -- //////////////////////////////////////////////////////////// -- /// Get the position of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the position from -- /// \param X : X position of the sound stream in the world -- /// \param Y : Y position of the sound stream in the world -- /// \param Z : Z position of the sound stream in the world -- /// -- //////////////////////////////////////////////////////////// procedure sfSoundStream_GetPosition (SoundStream : sfSoundStream_Ptr; X, Y, Z : access Float); -- //////////////////////////////////////////////////////////// -- /// Tell if the sound stream's position is relative to the listener's -- /// position, or if it's absolute -- /// -- /// \param SoundStream : Sound stream to check -- /// -- /// \return sfTrue if the position is relative, sfFalse if it's absolute -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_IsRelativeToListener (SoundStream : sfSoundStream_Ptr) return sfBool; -- //////////////////////////////////////////////////////////// -- /// Get the minimum distance of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the minimum distance from -- /// -- /// \return Minimum distance for the sound stream -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetMinDistance (SoundStream : sfSoundStream_Ptr) return Float; -- //////////////////////////////////////////////////////////// -- /// Get the attenuation factor of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the attenuation factor from -- /// -- /// \return Attenuation factor for the sound stream -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetAttenuation (SoundStream : sfSoundStream_Ptr) return Float; -- //////////////////////////////////////////////////////////// -- /// Tell whether or not a stream is looping -- /// -- /// \param SoundStream : Soundstream to get the loop state from -- /// -- /// \return sfTrue if the stream is looping, sfFalse otherwise -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetLoop (SoundStream : sfSoundStream_Ptr) return sfBool; -- //////////////////////////////////////////////////////////// -- /// Get the current playing position of a sound stream -- /// -- /// \param SoundStream : Sound stream to get the position from -- /// -- /// \return Current playing position, expressed in seconds -- /// -- //////////////////////////////////////////////////////////// function sfSoundStream_GetPlayingOffset (SoundStream : sfSoundStream_Ptr) return Float; private pragma Convention (C, sfSoundStreamStartCallback); pragma Convention (C, sfSoundStreamGetDataCallback); pragma Convention (C_Pass_By_Copy, sfSoundStreamChunk); pragma Import (C, sfSoundStream_Create, "sfSoundStream_Create"); pragma Import (C, sfSoundStream_Destroy, "sfSoundStream_Destroy"); pragma Import (C, sfSoundStream_Play, "sfSoundStream_Play"); pragma Import (C, sfSoundStream_Pause, "sfSoundStream_Pause"); pragma Import (C, sfSoundStream_Stop, "sfSoundStream_Stop"); pragma Import (C, sfSoundStream_GetStatus, "sfSoundStream_GetStatus"); pragma Import (C, sfSoundStream_GetChannelsCount, "sfSoundStream_GetChannelsCount"); pragma Import (C, sfSoundStream_GetSampleRate, "sfSoundStream_GetSampleRate"); pragma Import (C, sfSoundStream_SetPitch, "sfSoundStream_SetPitch"); pragma Import (C, sfSoundStream_SetVolume, "sfSoundStream_SetVolume"); pragma Import (C, sfSoundStream_SetPosition, "sfSoundStream_SetPosition"); pragma Import (C, sfSoundStream_SetRelativeToListener, "sfSoundStream_SetRelativeToListener"); pragma Import (C, sfSoundStream_SetMinDistance, "sfSoundStream_SetMinDistance"); pragma Import (C, sfSoundStream_SetAttenuation, "sfSoundStream_SetAttenuation"); pragma Import (C, sfSoundStream_SetLoop, "sfSoundStream_SetLoop"); pragma Import (C, sfSoundStream_GetPitch, "sfSoundStream_GetPitch"); pragma Import (C, sfSoundStream_GetVolume, "sfSoundStream_GetVolume"); pragma Import (C, sfSoundStream_GetPosition, "sfSoundStream_GetPosition"); pragma Import (C, sfSoundStream_IsRelativeToListener, "sfSoundStream_IsRelativeToListener"); pragma Import (C, sfSoundStream_GetMinDistance, "sfSoundStream_GetMinDistance"); pragma Import (C, sfSoundStream_GetAttenuation, "sfSoundStream_GetAttenuation"); pragma Import (C, sfSoundStream_GetLoop, "sfSoundStream_GetLoop"); pragma Import (C, sfSoundStream_GetPlayingOffset, "sfSoundStream_GetPlayingOffset"); end Sf.Audio.SoundStream;
[ { "context": " Copyright (C) 2011, 2012, 2013, 2014, 2016, 2017 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 169, "score": 0.9998652338981628, "start": 154, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "3, 2014, 2016, 2017 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 200, "score": 0.9998899698257446, "start": 185, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "7 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 227, "score": 0.9999269247055054, "start": 202, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
awa/src/awa-services-contexts.adb
fuzzysloth/ada-awa
81
----------------------------------------------------------------------- -- awa-services -- Services -- Copyright (C) 2011, 2012, 2013, 2014, 2016, 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Task_Attributes; with Security.Contexts; package body AWA.Services.Contexts is use type ADO.Sessions.Connection_Status; use type AWA.Users.Principals.Principal_Access; package Task_Context is new Ada.Task_Attributes (Service_Context_Access, null); -- ------------------------------ -- Get the application associated with the current service operation. -- ------------------------------ function Get_Application (Ctx : in Service_Context) return AWA.Applications.Application_Access is begin return Ctx.Application; end Get_Application; -- ------------------------------ -- Get the current database connection for reading. -- ------------------------------ function Get_Session (Ctx : in Service_Context_Access) return ADO.Sessions.Session is begin -- If a master database session was created, use it. if Ctx.Master.Get_Status = ADO.Sessions.OPEN then return ADO.Sessions.Session (Ctx.Master); elsif Ctx.Slave.Get_Status /= ADO.Sessions.OPEN then Ctx.Slave := Ctx.Application.Get_Session; end if; return Ctx.Slave; end Get_Session; -- ------------------------------ -- Get the current database connection for reading and writing. -- ------------------------------ function Get_Master_Session (Ctx : in Service_Context_Access) return ADO.Sessions.Master_Session is begin if Ctx.Master.Get_Status /= ADO.Sessions.OPEN then Ctx.Master := Ctx.Application.Get_Master_Session; end if; return Ctx.Master; end Get_Master_Session; -- ------------------------------ -- Get the current user invoking the service operation. -- Returns a null user if there is none. -- ------------------------------ function Get_User (Ctx : in Service_Context) return AWA.Users.Models.User_Ref is begin if Ctx.Principal = null then return AWA.Users.Models.Null_User; else return Ctx.Principal.Get_User; end if; end Get_User; -- ------------------------------ -- Get the current user identifier invoking the service operation. -- Returns NO_IDENTIFIER if there is none. -- ------------------------------ function Get_User_Identifier (Ctx : in Service_Context) return ADO.Identifier is begin if Ctx.Principal = null then return ADO.NO_IDENTIFIER; else return Ctx.Principal.Get_User_Identifier; end if; end Get_User_Identifier; -- ------------------------------ -- Get the current user session from the user invoking the service operation. -- Returns a null session if there is none. -- ------------------------------ function Get_User_Session (Ctx : in Service_Context) return AWA.Users.Models.Session_Ref is begin if Ctx.Principal = null then return AWA.Users.Models.Null_Session; else return Ctx.Principal.Get_Session; end if; end Get_User_Session; -- ------------------------------ -- Starts a transaction. -- ------------------------------ procedure Start (Ctx : in out Service_Context) is begin if Ctx.Transaction = 0 and then not Ctx.Active_Transaction then Ctx.Master.Begin_Transaction; Ctx.Active_Transaction := True; end if; Ctx.Transaction := Ctx.Transaction + 1; end Start; -- ------------------------------ -- Commits the current transaction. The database transaction is really committed by the -- last <b>Commit</b> called. -- ------------------------------ procedure Commit (Ctx : in out Service_Context) is begin Ctx.Transaction := Ctx.Transaction - 1; if Ctx.Transaction = 0 and then Ctx.Active_Transaction then Ctx.Master.Commit; Ctx.Active_Transaction := False; end if; end Commit; -- ------------------------------ -- Rollback the current transaction. The database transaction is rollback at the first -- call to <b>Rollback</b>. -- ------------------------------ procedure Rollback (Ctx : in out Service_Context) is begin null; end Rollback; -- ------------------------------ -- Get the attribute registered under the given name in the HTTP session. -- ------------------------------ function Get_Session_Attribute (Ctx : in Service_Context; Name : in String) return Util.Beans.Objects.Object is pragma Unreferenced (Ctx, Name); begin return Util.Beans.Objects.Null_Object; end Get_Session_Attribute; -- ------------------------------ -- Set the attribute registered under the given name in the HTTP session. -- ------------------------------ procedure Set_Session_Attribute (Ctx : in out Service_Context; Name : in String; Value : in Util.Beans.Objects.Object) is begin null; end Set_Session_Attribute; -- ------------------------------ -- Set the current application and user context. -- ------------------------------ procedure Set_Context (Ctx : in out Service_Context; Application : in AWA.Applications.Application_Access; Principal : in AWA.Users.Principals.Principal_Access) is begin Ctx.Application := Application; Ctx.Principal := Principal; end Set_Context; -- ------------------------------ -- Initializes the service context. -- ------------------------------ overriding procedure Initialize (Ctx : in out Service_Context) is use type AWA.Applications.Application_Access; begin Ctx.Previous := Task_Context.Value; Task_Context.Set_Value (Ctx'Unchecked_Access); if Ctx.Previous /= null and then Ctx.Application = null then Ctx.Application := Ctx.Previous.Application; end if; end Initialize; -- ------------------------------ -- Finalize the service context, rollback non-committed transaction, releases any object. -- ------------------------------ overriding procedure Finalize (Ctx : in out Service_Context) is begin -- When the service context is released, we must not have any active transaction. -- This means we are leaving the service in an abnormal way such as when an -- exception is raised. If this is the case, rollback the transaction. if Ctx.Active_Transaction then Ctx.Master.Rollback; end if; Task_Context.Set_Value (Ctx.Previous); end Finalize; -- ------------------------------ -- Get the current service context. -- Returns null if the current thread is not associated with any service context. -- ------------------------------ function Current return Service_Context_Access is begin return Task_Context.Value; end Current; -- ------------------------------ -- Run the process procedure on behalf of the specific user and session. -- This operation changes temporarily the identity of the current user principal and -- executes the <tt>Process</tt> procedure. -- ------------------------------ procedure Run_As (User : in AWA.Users.Models.User_Ref; Session : in AWA.Users.Models.Session_Ref) is Ctx : Service_Context; Sec : Security.Contexts.Security_Context; Principal : aliased AWA.Users.Principals.Principal := AWA.Users.Principals.Create (User, Session); begin Ctx.Principal := Principal'Unchecked_Access; Sec.Set_Context (Ctx.Application.Get_Security_Manager, Principal'Unchecked_Access); Process; end Run_As; end AWA.Services.Contexts;
4597
----------------------------------------------------------------------- -- awa-services -- Services -- Copyright (C) 2011, 2012, 2013, 2014, 2016, 2017 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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.Task_Attributes; with Security.Contexts; package body AWA.Services.Contexts is use type ADO.Sessions.Connection_Status; use type AWA.Users.Principals.Principal_Access; package Task_Context is new Ada.Task_Attributes (Service_Context_Access, null); -- ------------------------------ -- Get the application associated with the current service operation. -- ------------------------------ function Get_Application (Ctx : in Service_Context) return AWA.Applications.Application_Access is begin return Ctx.Application; end Get_Application; -- ------------------------------ -- Get the current database connection for reading. -- ------------------------------ function Get_Session (Ctx : in Service_Context_Access) return ADO.Sessions.Session is begin -- If a master database session was created, use it. if Ctx.Master.Get_Status = ADO.Sessions.OPEN then return ADO.Sessions.Session (Ctx.Master); elsif Ctx.Slave.Get_Status /= ADO.Sessions.OPEN then Ctx.Slave := Ctx.Application.Get_Session; end if; return Ctx.Slave; end Get_Session; -- ------------------------------ -- Get the current database connection for reading and writing. -- ------------------------------ function Get_Master_Session (Ctx : in Service_Context_Access) return ADO.Sessions.Master_Session is begin if Ctx.Master.Get_Status /= ADO.Sessions.OPEN then Ctx.Master := Ctx.Application.Get_Master_Session; end if; return Ctx.Master; end Get_Master_Session; -- ------------------------------ -- Get the current user invoking the service operation. -- Returns a null user if there is none. -- ------------------------------ function Get_User (Ctx : in Service_Context) return AWA.Users.Models.User_Ref is begin if Ctx.Principal = null then return AWA.Users.Models.Null_User; else return Ctx.Principal.Get_User; end if; end Get_User; -- ------------------------------ -- Get the current user identifier invoking the service operation. -- Returns NO_IDENTIFIER if there is none. -- ------------------------------ function Get_User_Identifier (Ctx : in Service_Context) return ADO.Identifier is begin if Ctx.Principal = null then return ADO.NO_IDENTIFIER; else return Ctx.Principal.Get_User_Identifier; end if; end Get_User_Identifier; -- ------------------------------ -- Get the current user session from the user invoking the service operation. -- Returns a null session if there is none. -- ------------------------------ function Get_User_Session (Ctx : in Service_Context) return AWA.Users.Models.Session_Ref is begin if Ctx.Principal = null then return AWA.Users.Models.Null_Session; else return Ctx.Principal.Get_Session; end if; end Get_User_Session; -- ------------------------------ -- Starts a transaction. -- ------------------------------ procedure Start (Ctx : in out Service_Context) is begin if Ctx.Transaction = 0 and then not Ctx.Active_Transaction then Ctx.Master.Begin_Transaction; Ctx.Active_Transaction := True; end if; Ctx.Transaction := Ctx.Transaction + 1; end Start; -- ------------------------------ -- Commits the current transaction. The database transaction is really committed by the -- last <b>Commit</b> called. -- ------------------------------ procedure Commit (Ctx : in out Service_Context) is begin Ctx.Transaction := Ctx.Transaction - 1; if Ctx.Transaction = 0 and then Ctx.Active_Transaction then Ctx.Master.Commit; Ctx.Active_Transaction := False; end if; end Commit; -- ------------------------------ -- Rollback the current transaction. The database transaction is rollback at the first -- call to <b>Rollback</b>. -- ------------------------------ procedure Rollback (Ctx : in out Service_Context) is begin null; end Rollback; -- ------------------------------ -- Get the attribute registered under the given name in the HTTP session. -- ------------------------------ function Get_Session_Attribute (Ctx : in Service_Context; Name : in String) return Util.Beans.Objects.Object is pragma Unreferenced (Ctx, Name); begin return Util.Beans.Objects.Null_Object; end Get_Session_Attribute; -- ------------------------------ -- Set the attribute registered under the given name in the HTTP session. -- ------------------------------ procedure Set_Session_Attribute (Ctx : in out Service_Context; Name : in String; Value : in Util.Beans.Objects.Object) is begin null; end Set_Session_Attribute; -- ------------------------------ -- Set the current application and user context. -- ------------------------------ procedure Set_Context (Ctx : in out Service_Context; Application : in AWA.Applications.Application_Access; Principal : in AWA.Users.Principals.Principal_Access) is begin Ctx.Application := Application; Ctx.Principal := Principal; end Set_Context; -- ------------------------------ -- Initializes the service context. -- ------------------------------ overriding procedure Initialize (Ctx : in out Service_Context) is use type AWA.Applications.Application_Access; begin Ctx.Previous := Task_Context.Value; Task_Context.Set_Value (Ctx'Unchecked_Access); if Ctx.Previous /= null and then Ctx.Application = null then Ctx.Application := Ctx.Previous.Application; end if; end Initialize; -- ------------------------------ -- Finalize the service context, rollback non-committed transaction, releases any object. -- ------------------------------ overriding procedure Finalize (Ctx : in out Service_Context) is begin -- When the service context is released, we must not have any active transaction. -- This means we are leaving the service in an abnormal way such as when an -- exception is raised. If this is the case, rollback the transaction. if Ctx.Active_Transaction then Ctx.Master.Rollback; end if; Task_Context.Set_Value (Ctx.Previous); end Finalize; -- ------------------------------ -- Get the current service context. -- Returns null if the current thread is not associated with any service context. -- ------------------------------ function Current return Service_Context_Access is begin return Task_Context.Value; end Current; -- ------------------------------ -- Run the process procedure on behalf of the specific user and session. -- This operation changes temporarily the identity of the current user principal and -- executes the <tt>Process</tt> procedure. -- ------------------------------ procedure Run_As (User : in AWA.Users.Models.User_Ref; Session : in AWA.Users.Models.Session_Ref) is Ctx : Service_Context; Sec : Security.Contexts.Security_Context; Principal : aliased AWA.Users.Principals.Principal := AWA.Users.Principals.Create (User, Session); begin Ctx.Principal := Principal'Unchecked_Access; Sec.Set_Context (Ctx.Application.Get_Security_Manager, Principal'Unchecked_Access); Process; end Run_As; end AWA.Services.Contexts;
true
----------------------------------------------------------------------- -- awa-services -- Services -- Copyright (C) 2011, 2012, 2013, 2014, 2016, 2017 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- 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.Task_Attributes; with Security.Contexts; package body AWA.Services.Contexts is use type ADO.Sessions.Connection_Status; use type AWA.Users.Principals.Principal_Access; package Task_Context is new Ada.Task_Attributes (Service_Context_Access, null); -- ------------------------------ -- Get the application associated with the current service operation. -- ------------------------------ function Get_Application (Ctx : in Service_Context) return AWA.Applications.Application_Access is begin return Ctx.Application; end Get_Application; -- ------------------------------ -- Get the current database connection for reading. -- ------------------------------ function Get_Session (Ctx : in Service_Context_Access) return ADO.Sessions.Session is begin -- If a master database session was created, use it. if Ctx.Master.Get_Status = ADO.Sessions.OPEN then return ADO.Sessions.Session (Ctx.Master); elsif Ctx.Slave.Get_Status /= ADO.Sessions.OPEN then Ctx.Slave := Ctx.Application.Get_Session; end if; return Ctx.Slave; end Get_Session; -- ------------------------------ -- Get the current database connection for reading and writing. -- ------------------------------ function Get_Master_Session (Ctx : in Service_Context_Access) return ADO.Sessions.Master_Session is begin if Ctx.Master.Get_Status /= ADO.Sessions.OPEN then Ctx.Master := Ctx.Application.Get_Master_Session; end if; return Ctx.Master; end Get_Master_Session; -- ------------------------------ -- Get the current user invoking the service operation. -- Returns a null user if there is none. -- ------------------------------ function Get_User (Ctx : in Service_Context) return AWA.Users.Models.User_Ref is begin if Ctx.Principal = null then return AWA.Users.Models.Null_User; else return Ctx.Principal.Get_User; end if; end Get_User; -- ------------------------------ -- Get the current user identifier invoking the service operation. -- Returns NO_IDENTIFIER if there is none. -- ------------------------------ function Get_User_Identifier (Ctx : in Service_Context) return ADO.Identifier is begin if Ctx.Principal = null then return ADO.NO_IDENTIFIER; else return Ctx.Principal.Get_User_Identifier; end if; end Get_User_Identifier; -- ------------------------------ -- Get the current user session from the user invoking the service operation. -- Returns a null session if there is none. -- ------------------------------ function Get_User_Session (Ctx : in Service_Context) return AWA.Users.Models.Session_Ref is begin if Ctx.Principal = null then return AWA.Users.Models.Null_Session; else return Ctx.Principal.Get_Session; end if; end Get_User_Session; -- ------------------------------ -- Starts a transaction. -- ------------------------------ procedure Start (Ctx : in out Service_Context) is begin if Ctx.Transaction = 0 and then not Ctx.Active_Transaction then Ctx.Master.Begin_Transaction; Ctx.Active_Transaction := True; end if; Ctx.Transaction := Ctx.Transaction + 1; end Start; -- ------------------------------ -- Commits the current transaction. The database transaction is really committed by the -- last <b>Commit</b> called. -- ------------------------------ procedure Commit (Ctx : in out Service_Context) is begin Ctx.Transaction := Ctx.Transaction - 1; if Ctx.Transaction = 0 and then Ctx.Active_Transaction then Ctx.Master.Commit; Ctx.Active_Transaction := False; end if; end Commit; -- ------------------------------ -- Rollback the current transaction. The database transaction is rollback at the first -- call to <b>Rollback</b>. -- ------------------------------ procedure Rollback (Ctx : in out Service_Context) is begin null; end Rollback; -- ------------------------------ -- Get the attribute registered under the given name in the HTTP session. -- ------------------------------ function Get_Session_Attribute (Ctx : in Service_Context; Name : in String) return Util.Beans.Objects.Object is pragma Unreferenced (Ctx, Name); begin return Util.Beans.Objects.Null_Object; end Get_Session_Attribute; -- ------------------------------ -- Set the attribute registered under the given name in the HTTP session. -- ------------------------------ procedure Set_Session_Attribute (Ctx : in out Service_Context; Name : in String; Value : in Util.Beans.Objects.Object) is begin null; end Set_Session_Attribute; -- ------------------------------ -- Set the current application and user context. -- ------------------------------ procedure Set_Context (Ctx : in out Service_Context; Application : in AWA.Applications.Application_Access; Principal : in AWA.Users.Principals.Principal_Access) is begin Ctx.Application := Application; Ctx.Principal := Principal; end Set_Context; -- ------------------------------ -- Initializes the service context. -- ------------------------------ overriding procedure Initialize (Ctx : in out Service_Context) is use type AWA.Applications.Application_Access; begin Ctx.Previous := Task_Context.Value; Task_Context.Set_Value (Ctx'Unchecked_Access); if Ctx.Previous /= null and then Ctx.Application = null then Ctx.Application := Ctx.Previous.Application; end if; end Initialize; -- ------------------------------ -- Finalize the service context, rollback non-committed transaction, releases any object. -- ------------------------------ overriding procedure Finalize (Ctx : in out Service_Context) is begin -- When the service context is released, we must not have any active transaction. -- This means we are leaving the service in an abnormal way such as when an -- exception is raised. If this is the case, rollback the transaction. if Ctx.Active_Transaction then Ctx.Master.Rollback; end if; Task_Context.Set_Value (Ctx.Previous); end Finalize; -- ------------------------------ -- Get the current service context. -- Returns null if the current thread is not associated with any service context. -- ------------------------------ function Current return Service_Context_Access is begin return Task_Context.Value; end Current; -- ------------------------------ -- Run the process procedure on behalf of the specific user and session. -- This operation changes temporarily the identity of the current user principal and -- executes the <tt>Process</tt> procedure. -- ------------------------------ procedure Run_As (User : in AWA.Users.Models.User_Ref; Session : in AWA.Users.Models.Session_Ref) is Ctx : Service_Context; Sec : Security.Contexts.Security_Context; Principal : aliased AWA.Users.Principals.Principal := AWA.Users.Principals.Create (User, Session); begin Ctx.Principal := Principal'Unchecked_Access; Sec.Set_Context (Ctx.Application.Get_Security_Manager, Principal'Unchecked_Access); Process; end Run_As; end AWA.Services.Contexts;
[ { "context": " --\n-- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com> --\n-- Al", "end": 824, "score": 0.9998862743377686, "start": 811, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com> --\n-- All rights reserved. ", "end": 844, "score": 0.9999313354492188, "start": 826, "tag": "EMAIL", "value": "vgodunko@gmail.com" } ]
source/sql/matreshka-internals-sql_parameter_rewriters.adb
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Characters.Wide_Wide_Latin_1; package body Matreshka.Internals.SQL_Parameter_Rewriters is ------------- -- Rewrite -- ------------- procedure Rewrite (Self : Abstract_Parameter_Rewriter'Class; Source : League.Strings.Universal_String; Rewritten : out League.Strings.Universal_String; Parameters : out SQL_Parameter_Sets.Parameter_Set) is Placeholder : League.Strings.Universal_String; Number : Positive := 1; Index : Positive := 1; First : Positive; begin Rewritten.Clear; Parameters.Clear; while Index <= Source.Length loop case Source.Element (Index).To_Wide_Wide_Character is when ':' => -- Parameter placeholder. First := Index; Index := Index + 1; -- First character must be ID_Start. if Index <= Source.Length and then Source.Element (Index).Is_ID_Start then Index := Index + 1; -- And others are ID_Continue. while Index <= Source.Length loop exit when not Source.Element (Index).Is_ID_Continue; Index := Index + 1; end loop; Index := Index - 1; -- Replace generic parameter placeholder by database -- specific one. Self.Database_Placeholder (Source.Slice (First, Index).To_Casefold, Number, Placeholder, Parameters); Rewritten.Append (Placeholder); Number := Number + 1; else raise Program_Error; end if; when ''' => -- String literal. Rewritten.Append (Source.Element (Index)); Index := Index + 1; -- Copy all characters till end of statement or single -- apostrophe character (two sequential apostrophe characters -- is escape sequence in SQL) is reached. while Index <= Source.Length loop Rewritten.Append (Source.Element (Index)); exit when Source.Element (Index).To_Wide_Wide_Character = ''' and (Index = Source.Length or else Source.Element (Index + 1).To_Wide_Wide_Character /= '''); Index := Index + 1; end loop; when '-' => Rewritten.Append (Source.Element (Index)); -- Comment starts from to minus signs and ends by end of line. if Index < Source.Length and then Source.Element (Index + 1).To_Wide_Wide_Character = '-' then Index := Index + 1; Rewritten.Append (Source.Element (Index)); Index := Index + 1; while Index <= Source.Length loop Rewritten.Append (Source.Element (Index)); exit when Source.Element (Index).To_Wide_Wide_Character = Ada.Characters.Wide_Wide_Latin_1.CR or Source.Element (Index).To_Wide_Wide_Character = Ada.Characters.Wide_Wide_Latin_1.LF; Index := Index + 1; end loop; end if; when others => Rewritten.Append (Source.Element (Index)); end case; Index := Index + 1; end loop; end Rewrite; end Matreshka.Internals.SQL_Parameter_Rewriters;
3425
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, <NAME> <<EMAIL>> -- -- 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.Characters.Wide_Wide_Latin_1; package body Matreshka.Internals.SQL_Parameter_Rewriters is ------------- -- Rewrite -- ------------- procedure Rewrite (Self : Abstract_Parameter_Rewriter'Class; Source : League.Strings.Universal_String; Rewritten : out League.Strings.Universal_String; Parameters : out SQL_Parameter_Sets.Parameter_Set) is Placeholder : League.Strings.Universal_String; Number : Positive := 1; Index : Positive := 1; First : Positive; begin Rewritten.Clear; Parameters.Clear; while Index <= Source.Length loop case Source.Element (Index).To_Wide_Wide_Character is when ':' => -- Parameter placeholder. First := Index; Index := Index + 1; -- First character must be ID_Start. if Index <= Source.Length and then Source.Element (Index).Is_ID_Start then Index := Index + 1; -- And others are ID_Continue. while Index <= Source.Length loop exit when not Source.Element (Index).Is_ID_Continue; Index := Index + 1; end loop; Index := Index - 1; -- Replace generic parameter placeholder by database -- specific one. Self.Database_Placeholder (Source.Slice (First, Index).To_Casefold, Number, Placeholder, Parameters); Rewritten.Append (Placeholder); Number := Number + 1; else raise Program_Error; end if; when ''' => -- String literal. Rewritten.Append (Source.Element (Index)); Index := Index + 1; -- Copy all characters till end of statement or single -- apostrophe character (two sequential apostrophe characters -- is escape sequence in SQL) is reached. while Index <= Source.Length loop Rewritten.Append (Source.Element (Index)); exit when Source.Element (Index).To_Wide_Wide_Character = ''' and (Index = Source.Length or else Source.Element (Index + 1).To_Wide_Wide_Character /= '''); Index := Index + 1; end loop; when '-' => Rewritten.Append (Source.Element (Index)); -- Comment starts from to minus signs and ends by end of line. if Index < Source.Length and then Source.Element (Index + 1).To_Wide_Wide_Character = '-' then Index := Index + 1; Rewritten.Append (Source.Element (Index)); Index := Index + 1; while Index <= Source.Length loop Rewritten.Append (Source.Element (Index)); exit when Source.Element (Index).To_Wide_Wide_Character = Ada.Characters.Wide_Wide_Latin_1.CR or Source.Element (Index).To_Wide_Wide_Character = Ada.Characters.Wide_Wide_Latin_1.LF; Index := Index + 1; end loop; end if; when others => Rewritten.Append (Source.Element (Index)); end case; Index := Index + 1; end loop; end Rewrite; end Matreshka.Internals.SQL_Parameter_Rewriters;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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.Characters.Wide_Wide_Latin_1; package body Matreshka.Internals.SQL_Parameter_Rewriters is ------------- -- Rewrite -- ------------- procedure Rewrite (Self : Abstract_Parameter_Rewriter'Class; Source : League.Strings.Universal_String; Rewritten : out League.Strings.Universal_String; Parameters : out SQL_Parameter_Sets.Parameter_Set) is Placeholder : League.Strings.Universal_String; Number : Positive := 1; Index : Positive := 1; First : Positive; begin Rewritten.Clear; Parameters.Clear; while Index <= Source.Length loop case Source.Element (Index).To_Wide_Wide_Character is when ':' => -- Parameter placeholder. First := Index; Index := Index + 1; -- First character must be ID_Start. if Index <= Source.Length and then Source.Element (Index).Is_ID_Start then Index := Index + 1; -- And others are ID_Continue. while Index <= Source.Length loop exit when not Source.Element (Index).Is_ID_Continue; Index := Index + 1; end loop; Index := Index - 1; -- Replace generic parameter placeholder by database -- specific one. Self.Database_Placeholder (Source.Slice (First, Index).To_Casefold, Number, Placeholder, Parameters); Rewritten.Append (Placeholder); Number := Number + 1; else raise Program_Error; end if; when ''' => -- String literal. Rewritten.Append (Source.Element (Index)); Index := Index + 1; -- Copy all characters till end of statement or single -- apostrophe character (two sequential apostrophe characters -- is escape sequence in SQL) is reached. while Index <= Source.Length loop Rewritten.Append (Source.Element (Index)); exit when Source.Element (Index).To_Wide_Wide_Character = ''' and (Index = Source.Length or else Source.Element (Index + 1).To_Wide_Wide_Character /= '''); Index := Index + 1; end loop; when '-' => Rewritten.Append (Source.Element (Index)); -- Comment starts from to minus signs and ends by end of line. if Index < Source.Length and then Source.Element (Index + 1).To_Wide_Wide_Character = '-' then Index := Index + 1; Rewritten.Append (Source.Element (Index)); Index := Index + 1; while Index <= Source.Length loop Rewritten.Append (Source.Element (Index)); exit when Source.Element (Index).To_Wide_Wide_Character = Ada.Characters.Wide_Wide_Latin_1.CR or Source.Element (Index).To_Wide_Wide_Character = Ada.Characters.Wide_Wide_Latin_1.LF; Index := Index + 1; end loop; end if; when others => Rewritten.Append (Source.Element (Index)); end case; Index := Index + 1; end loop; end Rewrite; end Matreshka.Internals.SQL_Parameter_Rewriters;
[ { "context": "e-Identifier: MIT\n--\n-- Copyright (c) 2016 - 2018 Gautier de Montmollin\n-- SWITZERLAND\n--\n-- The copyright holder is on", "end": 87, "score": 0.9998792409896851, "start": 66, "tag": "NAME", "value": "Gautier de Montmollin" }, { "context": " OS-, CPU- and compiler- independent.\n\n-- Author: lode.vandevenne [*] gmail [*] com (Lode Vandevenne)\n-- Author: j", "end": 1960, "score": 0.9970441460609436, "start": 1945, "tag": "USERNAME", "value": "lode.vandevenne" }, { "context": ".\n\n-- Author: lode.vandevenne [*] gmail [*] com (Lode Vandevenne)\n-- Author: jyrki.alakuijala [*] gmai", "end": 1984, "score": 0.9459430575370789, "start": 1980, "tag": "NAME", "value": "Lode" }, { "context": "ne [*] gmail [*] com (Lode Vandevenne)\n-- Author: jyrki.alakuijala [*] gmail [*] com (Jyrki Alakuijala)\n-", "end": 2014, "score": 0.9993265271186829, "start": 2009, "tag": "USERNAME", "value": "jyrki" }, { "context": " gmail [*] com (Lode Vandevenne)\n-- Author: jyrki.alakuijala [*] gmail [*] com (Jyrki Alakuijala)\n--\n-- Bound", "end": 2025, "score": 0.9556508660316467, "start": 2015, "tag": "EMAIL", "value": "alakuijala" }, { "context": ")\n-- Author: jyrki.alakuijala [*] gmail [*] com (Jyrki Alakuijala)\n--\n-- Bounded package merge algorithm, based on", "end": 2061, "score": 0.9998886585235596, "start": 2045, "tag": "NAME", "value": "Jyrki Alakuijala" }, { "context": "onomical Algorithm for Length-Limited Coding\n-- Jyrki Katajainen, Alistair Moffat, Andrew Turpin\".\n--\n-- Translat", "end": 2215, "score": 0.9998726844787598, "start": 2199, "tag": "NAME", "value": "Jyrki Katajainen" }, { "context": " for Length-Limited Coding\n-- Jyrki Katajainen, Alistair Moffat, Andrew Turpin\".\n--\n-- Translated by G. de Montm", "end": 2232, "score": 0.9998800754547119, "start": 2217, "tag": "NAME", "value": "Alistair Moffat" }, { "context": "ed Coding\n-- Jyrki Katajainen, Alistair Moffat, Andrew Turpin\".\n--\n-- Translated by G. de Montmollin to Ada fr", "end": 2247, "score": 0.9998452067375183, "start": 2234, "tag": "NAME", "value": "Andrew Turpin" }, { "context": "stair Moffat, Andrew Turpin\".\n--\n-- Translated by G. de Montmollin to Ada from katajainen.c (Zopfli project), 7-Feb-", "end": 2287, "score": 0.9998882412910461, "start": 2271, "tag": "NAME", "value": "G. de Montmollin" } ]
dcf/src/dcf-length_limited_huffman_code_lengths.ads
onox/dcf-ada
5
-- SPDX-License-Identifier: MIT -- -- Copyright (c) 2016 - 2018 Gautier de Montmollin -- SWITZERLAND -- -- The copyright holder is only the maintainer of the Ada version; -- authors of the C code and those of the algorithm are cited below. -- -- 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. -- Length_limited_Huffman_code_lengths -- ----------------------------------- -- -- This algorithm builds optimal Huffman codes for a given alphabet -- and occurrence counts (frequencies) of this alphabet. These occurrences -- are supposed to have been counted in a message to be sent in a -- compressed form using the Huffman codes. As output, only the bit lengths -- of the Huffman codes are given; the Huffman codes themselves are built -- with these bit lengths when the message actually needs to be sent. -- -- Pure Ada 95+ code, 100% portable: OS-, CPU- and compiler- independent. -- Author: lode.vandevenne [*] gmail [*] com (Lode Vandevenne) -- Author: jyrki.alakuijala [*] gmail [*] com (Jyrki Alakuijala) -- -- Bounded package merge algorithm, based on the paper -- "A Fast and Space-Economical Algorithm for Length-Limited Coding -- Jyrki Katajainen, Alistair Moffat, Andrew Turpin". -- -- Translated by G. de Montmollin to Ada from katajainen.c (Zopfli project), 7-Feb-2016 -- Translation notes in procedure's body. private generic type Alphabet is (<>); -- Any discrete type -- Count_Type is an integer type large enough for counting -- and indexing. See body for actual bounds. type Count_Type is range <>; type Count_Array is array (Alphabet) of Count_Type; type Length_Array is array (Alphabet) of Natural; Max_Bits : Positive; -- Length limit in Huffman codes procedure DCF.Length_Limited_Huffman_Code_Lengths (Frequencies : in Count_Array; Bit_Lengths : out Length_Array); pragma Preelaborate (DCF.Length_Limited_Huffman_Code_Lengths);
15272
-- SPDX-License-Identifier: MIT -- -- Copyright (c) 2016 - 2018 <NAME> -- SWITZERLAND -- -- The copyright holder is only the maintainer of the Ada version; -- authors of the C code and those of the algorithm are cited below. -- -- 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. -- Length_limited_Huffman_code_lengths -- ----------------------------------- -- -- This algorithm builds optimal Huffman codes for a given alphabet -- and occurrence counts (frequencies) of this alphabet. These occurrences -- are supposed to have been counted in a message to be sent in a -- compressed form using the Huffman codes. As output, only the bit lengths -- of the Huffman codes are given; the Huffman codes themselves are built -- with these bit lengths when the message actually needs to be sent. -- -- Pure Ada 95+ code, 100% portable: OS-, CPU- and compiler- independent. -- Author: lode.vandevenne [*] gmail [*] com (<NAME> Vandevenne) -- Author: jyrki.<EMAIL> [*] gmail [*] com (<NAME>) -- -- Bounded package merge algorithm, based on the paper -- "A Fast and Space-Economical Algorithm for Length-Limited Coding -- <NAME>, <NAME>, <NAME>". -- -- Translated by <NAME> to Ada from katajainen.c (Zopfli project), 7-Feb-2016 -- Translation notes in procedure's body. private generic type Alphabet is (<>); -- Any discrete type -- Count_Type is an integer type large enough for counting -- and indexing. See body for actual bounds. type Count_Type is range <>; type Count_Array is array (Alphabet) of Count_Type; type Length_Array is array (Alphabet) of Natural; Max_Bits : Positive; -- Length limit in Huffman codes procedure DCF.Length_Limited_Huffman_Code_Lengths (Frequencies : in Count_Array; Bit_Lengths : out Length_Array); pragma Preelaborate (DCF.Length_Limited_Huffman_Code_Lengths);
true
-- SPDX-License-Identifier: MIT -- -- Copyright (c) 2016 - 2018 PI:NAME:<NAME>END_PI -- SWITZERLAND -- -- The copyright holder is only the maintainer of the Ada version; -- authors of the C code and those of the algorithm are cited below. -- -- 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. -- Length_limited_Huffman_code_lengths -- ----------------------------------- -- -- This algorithm builds optimal Huffman codes for a given alphabet -- and occurrence counts (frequencies) of this alphabet. These occurrences -- are supposed to have been counted in a message to be sent in a -- compressed form using the Huffman codes. As output, only the bit lengths -- of the Huffman codes are given; the Huffman codes themselves are built -- with these bit lengths when the message actually needs to be sent. -- -- Pure Ada 95+ code, 100% portable: OS-, CPU- and compiler- independent. -- Author: lode.vandevenne [*] gmail [*] com (PI:NAME:<NAME>END_PI Vandevenne) -- Author: jyrki.PI:EMAIL:<EMAIL>END_PI [*] gmail [*] com (PI:NAME:<NAME>END_PI) -- -- Bounded package merge algorithm, based on the paper -- "A Fast and Space-Economical Algorithm for Length-Limited Coding -- PI:NAME:<NAME>END_PI, PI:NAME:<NAME>END_PI, PI:NAME:<NAME>END_PI". -- -- Translated by PI:NAME:<NAME>END_PI to Ada from katajainen.c (Zopfli project), 7-Feb-2016 -- Translation notes in procedure's body. private generic type Alphabet is (<>); -- Any discrete type -- Count_Type is an integer type large enough for counting -- and indexing. See body for actual bounds. type Count_Type is range <>; type Count_Array is array (Alphabet) of Count_Type; type Length_Array is array (Alphabet) of Natural; Max_Bits : Positive; -- Length limit in Huffman codes procedure DCF.Length_Limited_Huffman_Code_Lengths (Frequencies : in Count_Array; Bit_Lengths : out Length_Array); pragma Preelaborate (DCF.Length_Limited_Huffman_Code_Lengths);
[ { "context": "-- Copyright (c) 2015-2017 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 40, "score": 0.9998437762260437, "start": 28, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2015-2017 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 60, "score": 0.9999312162399292, "start": 42, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
testsuite/tests-lexers.ads
reznikmm/increment
5
-- Copyright (c) 2015-2017 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Incr.Lexers.Batch_Lexers.Generic_Lexers; with Matreshka.Internals.Unicode; package Tests.Lexers is package Tables is use Incr.Lexers.Batch_Lexers; function To_Class (Value : Matreshka.Internals.Unicode.Code_Point) return Character_Class; pragma Inline (To_Class); function Switch (S : State; Class : Character_Class) return State; pragma Inline (Switch); function Rule (S : State) return Rule_Index; pragma Inline (Rule); First_Final : constant State := 1; Last_Looping : constant State := 2; Error_State : constant State := 5; subtype Looping_State is State range 0 .. Last_Looping; subtype Final_State is State range First_Final .. Error_State - 1; end Tables; package Test_Lexers is new Incr.Lexers.Batch_Lexers.Generic_Lexers (To_Class => Tables.To_Class, Switch => Tables.Switch, Rule => Tables.Rule, First_Final => Tables.First_Final, Last_Looping => Tables.Last_Looping, Error_State => Tables.Error_State); end Tests.Lexers;
21909
-- Copyright (c) 2015-2017 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Incr.Lexers.Batch_Lexers.Generic_Lexers; with Matreshka.Internals.Unicode; package Tests.Lexers is package Tables is use Incr.Lexers.Batch_Lexers; function To_Class (Value : Matreshka.Internals.Unicode.Code_Point) return Character_Class; pragma Inline (To_Class); function Switch (S : State; Class : Character_Class) return State; pragma Inline (Switch); function Rule (S : State) return Rule_Index; pragma Inline (Rule); First_Final : constant State := 1; Last_Looping : constant State := 2; Error_State : constant State := 5; subtype Looping_State is State range 0 .. Last_Looping; subtype Final_State is State range First_Final .. Error_State - 1; end Tables; package Test_Lexers is new Incr.Lexers.Batch_Lexers.Generic_Lexers (To_Class => Tables.To_Class, Switch => Tables.Switch, Rule => Tables.Rule, First_Final => Tables.First_Final, Last_Looping => Tables.Last_Looping, Error_State => Tables.Error_State); end Tests.Lexers;
true
-- Copyright (c) 2015-2017 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Incr.Lexers.Batch_Lexers.Generic_Lexers; with Matreshka.Internals.Unicode; package Tests.Lexers is package Tables is use Incr.Lexers.Batch_Lexers; function To_Class (Value : Matreshka.Internals.Unicode.Code_Point) return Character_Class; pragma Inline (To_Class); function Switch (S : State; Class : Character_Class) return State; pragma Inline (Switch); function Rule (S : State) return Rule_Index; pragma Inline (Rule); First_Final : constant State := 1; Last_Looping : constant State := 2; Error_State : constant State := 5; subtype Looping_State is State range 0 .. Last_Looping; subtype Final_State is State range First_Final .. Error_State - 1; end Tables; package Test_Lexers is new Incr.Lexers.Batch_Lexers.Generic_Lexers (To_Class => Tables.To_Class, Switch => Tables.Switch, Rule => Tables.Rule, First_Final => Tables.First_Final, Last_Looping => Tables.Last_Looping, Error_State => Tables.Error_State); end Tests.Lexers;
[ { "context": " slot selection\n-- Copyright (C) 2014, 2015, 2021 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 193, "score": 0.9998797178268433, "start": 178, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "C) 2014, 2015, 2021 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 224, "score": 0.9998819231987, "start": 209, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "1 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 251, "score": 0.9999297857284546, "start": 226, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
mat/src/mat-expressions.ads
stcarrez/mat
7
----------------------------------------------------------------------- -- mat-expressions -- Expressions for event and memory slot selection -- Copyright (C) 2014, 2015, 2021 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Finalization; private with Util.Concurrent.Counters; with MAT.Types; with MAT.Memory; with MAT.Events; package MAT.Expressions is type Resolver_Type is limited interface; type Resolver_Type_Access is access all Resolver_Type'Class; -- Find the region that matches the given name. function Find_Region (Resolver : in Resolver_Type; Name : in String) return MAT.Memory.Region_Info is abstract; -- Find the symbol in the symbol table and return the start and end address. function Find_Symbol (Resolver : in Resolver_Type; Name : in String) return MAT.Memory.Region_Info is abstract; -- Find the symbol region in the symbol table that contains the given address -- and return the start and end address of that region. function Find_Symbol (Resolver : in Resolver_Type; Addr : in MAT.Types.Target_Addr) return MAT.Memory.Region_Info is abstract; -- Get the start time for the tick reference. function Get_Start_Time (Resolver : in Resolver_Type) return MAT.Types.Target_Tick_Ref is abstract; type Context_Type is record Addr : MAT.Types.Target_Addr; Allocation : MAT.Memory.Allocation; end record; type Inside_Type is (INSIDE_REGION, INSIDE_DIRECT_REGION, INSIDE_FUNCTION, INSIDE_DIRECT_FUNCTION); type Expression_Type is tagged private; -- Create a NOT expression node. function Create_Not (Expr : in Expression_Type) return Expression_Type; -- Create a AND expression node. function Create_And (Left : in Expression_Type; Right : in Expression_Type) return Expression_Type; -- Create a OR expression node. function Create_Or (Left : in Expression_Type; Right : in Expression_Type) return Expression_Type; -- Create an INSIDE expression node. function Create_Inside (Name : in Ada.Strings.Unbounded.Unbounded_String; Kind : in Inside_Type) return Expression_Type; function Create_Inside (Addr : in MAT.Types.Uint64; Kind : in Inside_Type) return Expression_Type; -- Create an size range expression node. function Create_Size (Min : in MAT.Types.Target_Size; Max : in MAT.Types.Target_Size) return Expression_Type; -- Create an addr range expression node. function Create_Addr (Min : in MAT.Types.Target_Addr; Max : in MAT.Types.Target_Addr) return Expression_Type; -- Create an time range expression node. function Create_Time (Min : in MAT.Types.Target_Tick_Ref; Max : in MAT.Types.Target_Tick_Ref) return Expression_Type; -- Create an event ID range expression node. function Create_Event (Min : in MAT.Events.Event_Id_Type; Max : in MAT.Events.Event_Id_Type) return Expression_Type; -- Create a thread ID range expression node. function Create_Thread (Min : in MAT.Types.Target_Thread_Ref; Max : in MAT.Types.Target_Thread_Ref) return Expression_Type; -- Create a event type expression check. function Create_Event_Type (Event_Kind : in MAT.Events.Probe_Index_Type) return Expression_Type; -- Create an expression node to keep allocation events which don't have any associated free. function Create_No_Free return Expression_Type; -- Evaluate the expression to check if the memory slot described by the -- context is selected. Returns True if the memory slot is selected. function Is_Selected (Node : in Expression_Type; Addr : in MAT.Types.Target_Addr; Allocation : in MAT.Memory.Allocation) return Boolean; -- Evaluate the expression to check if the event described by the -- context is selected. Returns True if the event is selected. function Is_Selected (Node : in Expression_Type; Event : in MAT.Events.Target_Event_Type) return Boolean; -- Parse the string and return the expression tree. function Parse (Expr : in String; Resolver : in Resolver_Type_Access) return Expression_Type; -- Empty expression. EMPTY : constant Expression_Type; type yystype is record low : MAT.Types.Uint64 := 0; high : MAT.Types.Uint64 := 0; bval : Boolean := False; name : Ada.Strings.Unbounded.Unbounded_String; expr : Expression_Type; end record; private type Kind_Type is (N_NOT, N_OR, N_AND, N_TRUE, N_FALSE, N_IN_FILE, N_IN_FILE_DIRECT, N_INSIDE, N_CALL_ADDR, N_CALL_ADDR_DIRECT, N_IN_FUNC, N_IN_FUNC_DIRECT, N_RANGE_SIZE, N_RANGE_ADDR, N_RANGE_TIME, N_EVENT, N_HAS_ADDR, N_CONDITION, N_THREAD, N_TYPE, N_NO_FREE); type Node_Type; type Node_Type_Access is access all Node_Type; type Node_Type (Kind : Kind_Type) is record Ref_Counter : Util.Concurrent.Counters.Counter; case Kind is when N_NOT => Expr : Node_Type_Access; when N_OR | N_AND => Left, Right : Node_Type_Access; when N_INSIDE | N_IN_FILE | N_IN_FILE_DIRECT => Name : Ada.Strings.Unbounded.Unbounded_String; Inside : Inside_Type; when N_RANGE_SIZE => Min_Size : MAT.Types.Target_Size; Max_Size : MAT.Types.Target_Size; when N_RANGE_ADDR | N_CALL_ADDR | N_CALL_ADDR_DIRECT | N_HAS_ADDR | N_IN_FUNC | N_IN_FUNC_DIRECT => Min_Addr : MAT.Types.Target_Addr; Max_Addr : MAT.Types.Target_Addr; when N_RANGE_TIME => Min_Time : MAT.Types.Target_Tick_Ref; Max_Time : MAT.Types.Target_Tick_Ref; when N_THREAD => Min_Thread : MAT.Types.Target_Thread_Ref; Max_Thread : MAT.Types.Target_Thread_Ref; when N_EVENT => Min_Event : MAT.Events.Event_Id_Type; Max_Event : MAT.Events.Event_Id_Type; when N_TYPE => Event_Kind : MAT.Events.Probe_Index_Type; when others => null; end case; end record; -- Evaluate the node against the context. Returns True if the node expression -- selects the memory slot defined by the context. function Is_Selected (Node : in Node_Type; Addr : in MAT.Types.Target_Addr; Allocation : in MAT.Memory.Allocation) return Boolean; -- Evaluate the expression to check if the event described by the -- context is selected. Returns True if the event is selected. function Is_Selected (Node : in Node_Type; Event : in MAT.Events.Target_Event_Type) return Boolean; type Expression_Type is new Ada.Finalization.Controlled with record Node : Node_Type_Access; end record; -- Release the reference and destroy the expression tree if it was the last reference. overriding procedure Finalize (Obj : in out Expression_Type); -- Update the reference after an assignment. overriding procedure Adjust (Obj : in out Expression_Type); -- Empty expression. EMPTY : constant Expression_Type := Expression_Type'(Ada.Finalization.Controlled with Node => null); end MAT.Expressions;
26113
----------------------------------------------------------------------- -- mat-expressions -- Expressions for event and memory slot selection -- Copyright (C) 2014, 2015, 2021 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Finalization; private with Util.Concurrent.Counters; with MAT.Types; with MAT.Memory; with MAT.Events; package MAT.Expressions is type Resolver_Type is limited interface; type Resolver_Type_Access is access all Resolver_Type'Class; -- Find the region that matches the given name. function Find_Region (Resolver : in Resolver_Type; Name : in String) return MAT.Memory.Region_Info is abstract; -- Find the symbol in the symbol table and return the start and end address. function Find_Symbol (Resolver : in Resolver_Type; Name : in String) return MAT.Memory.Region_Info is abstract; -- Find the symbol region in the symbol table that contains the given address -- and return the start and end address of that region. function Find_Symbol (Resolver : in Resolver_Type; Addr : in MAT.Types.Target_Addr) return MAT.Memory.Region_Info is abstract; -- Get the start time for the tick reference. function Get_Start_Time (Resolver : in Resolver_Type) return MAT.Types.Target_Tick_Ref is abstract; type Context_Type is record Addr : MAT.Types.Target_Addr; Allocation : MAT.Memory.Allocation; end record; type Inside_Type is (INSIDE_REGION, INSIDE_DIRECT_REGION, INSIDE_FUNCTION, INSIDE_DIRECT_FUNCTION); type Expression_Type is tagged private; -- Create a NOT expression node. function Create_Not (Expr : in Expression_Type) return Expression_Type; -- Create a AND expression node. function Create_And (Left : in Expression_Type; Right : in Expression_Type) return Expression_Type; -- Create a OR expression node. function Create_Or (Left : in Expression_Type; Right : in Expression_Type) return Expression_Type; -- Create an INSIDE expression node. function Create_Inside (Name : in Ada.Strings.Unbounded.Unbounded_String; Kind : in Inside_Type) return Expression_Type; function Create_Inside (Addr : in MAT.Types.Uint64; Kind : in Inside_Type) return Expression_Type; -- Create an size range expression node. function Create_Size (Min : in MAT.Types.Target_Size; Max : in MAT.Types.Target_Size) return Expression_Type; -- Create an addr range expression node. function Create_Addr (Min : in MAT.Types.Target_Addr; Max : in MAT.Types.Target_Addr) return Expression_Type; -- Create an time range expression node. function Create_Time (Min : in MAT.Types.Target_Tick_Ref; Max : in MAT.Types.Target_Tick_Ref) return Expression_Type; -- Create an event ID range expression node. function Create_Event (Min : in MAT.Events.Event_Id_Type; Max : in MAT.Events.Event_Id_Type) return Expression_Type; -- Create a thread ID range expression node. function Create_Thread (Min : in MAT.Types.Target_Thread_Ref; Max : in MAT.Types.Target_Thread_Ref) return Expression_Type; -- Create a event type expression check. function Create_Event_Type (Event_Kind : in MAT.Events.Probe_Index_Type) return Expression_Type; -- Create an expression node to keep allocation events which don't have any associated free. function Create_No_Free return Expression_Type; -- Evaluate the expression to check if the memory slot described by the -- context is selected. Returns True if the memory slot is selected. function Is_Selected (Node : in Expression_Type; Addr : in MAT.Types.Target_Addr; Allocation : in MAT.Memory.Allocation) return Boolean; -- Evaluate the expression to check if the event described by the -- context is selected. Returns True if the event is selected. function Is_Selected (Node : in Expression_Type; Event : in MAT.Events.Target_Event_Type) return Boolean; -- Parse the string and return the expression tree. function Parse (Expr : in String; Resolver : in Resolver_Type_Access) return Expression_Type; -- Empty expression. EMPTY : constant Expression_Type; type yystype is record low : MAT.Types.Uint64 := 0; high : MAT.Types.Uint64 := 0; bval : Boolean := False; name : Ada.Strings.Unbounded.Unbounded_String; expr : Expression_Type; end record; private type Kind_Type is (N_NOT, N_OR, N_AND, N_TRUE, N_FALSE, N_IN_FILE, N_IN_FILE_DIRECT, N_INSIDE, N_CALL_ADDR, N_CALL_ADDR_DIRECT, N_IN_FUNC, N_IN_FUNC_DIRECT, N_RANGE_SIZE, N_RANGE_ADDR, N_RANGE_TIME, N_EVENT, N_HAS_ADDR, N_CONDITION, N_THREAD, N_TYPE, N_NO_FREE); type Node_Type; type Node_Type_Access is access all Node_Type; type Node_Type (Kind : Kind_Type) is record Ref_Counter : Util.Concurrent.Counters.Counter; case Kind is when N_NOT => Expr : Node_Type_Access; when N_OR | N_AND => Left, Right : Node_Type_Access; when N_INSIDE | N_IN_FILE | N_IN_FILE_DIRECT => Name : Ada.Strings.Unbounded.Unbounded_String; Inside : Inside_Type; when N_RANGE_SIZE => Min_Size : MAT.Types.Target_Size; Max_Size : MAT.Types.Target_Size; when N_RANGE_ADDR | N_CALL_ADDR | N_CALL_ADDR_DIRECT | N_HAS_ADDR | N_IN_FUNC | N_IN_FUNC_DIRECT => Min_Addr : MAT.Types.Target_Addr; Max_Addr : MAT.Types.Target_Addr; when N_RANGE_TIME => Min_Time : MAT.Types.Target_Tick_Ref; Max_Time : MAT.Types.Target_Tick_Ref; when N_THREAD => Min_Thread : MAT.Types.Target_Thread_Ref; Max_Thread : MAT.Types.Target_Thread_Ref; when N_EVENT => Min_Event : MAT.Events.Event_Id_Type; Max_Event : MAT.Events.Event_Id_Type; when N_TYPE => Event_Kind : MAT.Events.Probe_Index_Type; when others => null; end case; end record; -- Evaluate the node against the context. Returns True if the node expression -- selects the memory slot defined by the context. function Is_Selected (Node : in Node_Type; Addr : in MAT.Types.Target_Addr; Allocation : in MAT.Memory.Allocation) return Boolean; -- Evaluate the expression to check if the event described by the -- context is selected. Returns True if the event is selected. function Is_Selected (Node : in Node_Type; Event : in MAT.Events.Target_Event_Type) return Boolean; type Expression_Type is new Ada.Finalization.Controlled with record Node : Node_Type_Access; end record; -- Release the reference and destroy the expression tree if it was the last reference. overriding procedure Finalize (Obj : in out Expression_Type); -- Update the reference after an assignment. overriding procedure Adjust (Obj : in out Expression_Type); -- Empty expression. EMPTY : constant Expression_Type := Expression_Type'(Ada.Finalization.Controlled with Node => null); end MAT.Expressions;
true
----------------------------------------------------------------------- -- mat-expressions -- Expressions for event and memory slot selection -- Copyright (C) 2014, 2015, 2021 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Finalization; private with Util.Concurrent.Counters; with MAT.Types; with MAT.Memory; with MAT.Events; package MAT.Expressions is type Resolver_Type is limited interface; type Resolver_Type_Access is access all Resolver_Type'Class; -- Find the region that matches the given name. function Find_Region (Resolver : in Resolver_Type; Name : in String) return MAT.Memory.Region_Info is abstract; -- Find the symbol in the symbol table and return the start and end address. function Find_Symbol (Resolver : in Resolver_Type; Name : in String) return MAT.Memory.Region_Info is abstract; -- Find the symbol region in the symbol table that contains the given address -- and return the start and end address of that region. function Find_Symbol (Resolver : in Resolver_Type; Addr : in MAT.Types.Target_Addr) return MAT.Memory.Region_Info is abstract; -- Get the start time for the tick reference. function Get_Start_Time (Resolver : in Resolver_Type) return MAT.Types.Target_Tick_Ref is abstract; type Context_Type is record Addr : MAT.Types.Target_Addr; Allocation : MAT.Memory.Allocation; end record; type Inside_Type is (INSIDE_REGION, INSIDE_DIRECT_REGION, INSIDE_FUNCTION, INSIDE_DIRECT_FUNCTION); type Expression_Type is tagged private; -- Create a NOT expression node. function Create_Not (Expr : in Expression_Type) return Expression_Type; -- Create a AND expression node. function Create_And (Left : in Expression_Type; Right : in Expression_Type) return Expression_Type; -- Create a OR expression node. function Create_Or (Left : in Expression_Type; Right : in Expression_Type) return Expression_Type; -- Create an INSIDE expression node. function Create_Inside (Name : in Ada.Strings.Unbounded.Unbounded_String; Kind : in Inside_Type) return Expression_Type; function Create_Inside (Addr : in MAT.Types.Uint64; Kind : in Inside_Type) return Expression_Type; -- Create an size range expression node. function Create_Size (Min : in MAT.Types.Target_Size; Max : in MAT.Types.Target_Size) return Expression_Type; -- Create an addr range expression node. function Create_Addr (Min : in MAT.Types.Target_Addr; Max : in MAT.Types.Target_Addr) return Expression_Type; -- Create an time range expression node. function Create_Time (Min : in MAT.Types.Target_Tick_Ref; Max : in MAT.Types.Target_Tick_Ref) return Expression_Type; -- Create an event ID range expression node. function Create_Event (Min : in MAT.Events.Event_Id_Type; Max : in MAT.Events.Event_Id_Type) return Expression_Type; -- Create a thread ID range expression node. function Create_Thread (Min : in MAT.Types.Target_Thread_Ref; Max : in MAT.Types.Target_Thread_Ref) return Expression_Type; -- Create a event type expression check. function Create_Event_Type (Event_Kind : in MAT.Events.Probe_Index_Type) return Expression_Type; -- Create an expression node to keep allocation events which don't have any associated free. function Create_No_Free return Expression_Type; -- Evaluate the expression to check if the memory slot described by the -- context is selected. Returns True if the memory slot is selected. function Is_Selected (Node : in Expression_Type; Addr : in MAT.Types.Target_Addr; Allocation : in MAT.Memory.Allocation) return Boolean; -- Evaluate the expression to check if the event described by the -- context is selected. Returns True if the event is selected. function Is_Selected (Node : in Expression_Type; Event : in MAT.Events.Target_Event_Type) return Boolean; -- Parse the string and return the expression tree. function Parse (Expr : in String; Resolver : in Resolver_Type_Access) return Expression_Type; -- Empty expression. EMPTY : constant Expression_Type; type yystype is record low : MAT.Types.Uint64 := 0; high : MAT.Types.Uint64 := 0; bval : Boolean := False; name : Ada.Strings.Unbounded.Unbounded_String; expr : Expression_Type; end record; private type Kind_Type is (N_NOT, N_OR, N_AND, N_TRUE, N_FALSE, N_IN_FILE, N_IN_FILE_DIRECT, N_INSIDE, N_CALL_ADDR, N_CALL_ADDR_DIRECT, N_IN_FUNC, N_IN_FUNC_DIRECT, N_RANGE_SIZE, N_RANGE_ADDR, N_RANGE_TIME, N_EVENT, N_HAS_ADDR, N_CONDITION, N_THREAD, N_TYPE, N_NO_FREE); type Node_Type; type Node_Type_Access is access all Node_Type; type Node_Type (Kind : Kind_Type) is record Ref_Counter : Util.Concurrent.Counters.Counter; case Kind is when N_NOT => Expr : Node_Type_Access; when N_OR | N_AND => Left, Right : Node_Type_Access; when N_INSIDE | N_IN_FILE | N_IN_FILE_DIRECT => Name : Ada.Strings.Unbounded.Unbounded_String; Inside : Inside_Type; when N_RANGE_SIZE => Min_Size : MAT.Types.Target_Size; Max_Size : MAT.Types.Target_Size; when N_RANGE_ADDR | N_CALL_ADDR | N_CALL_ADDR_DIRECT | N_HAS_ADDR | N_IN_FUNC | N_IN_FUNC_DIRECT => Min_Addr : MAT.Types.Target_Addr; Max_Addr : MAT.Types.Target_Addr; when N_RANGE_TIME => Min_Time : MAT.Types.Target_Tick_Ref; Max_Time : MAT.Types.Target_Tick_Ref; when N_THREAD => Min_Thread : MAT.Types.Target_Thread_Ref; Max_Thread : MAT.Types.Target_Thread_Ref; when N_EVENT => Min_Event : MAT.Events.Event_Id_Type; Max_Event : MAT.Events.Event_Id_Type; when N_TYPE => Event_Kind : MAT.Events.Probe_Index_Type; when others => null; end case; end record; -- Evaluate the node against the context. Returns True if the node expression -- selects the memory slot defined by the context. function Is_Selected (Node : in Node_Type; Addr : in MAT.Types.Target_Addr; Allocation : in MAT.Memory.Allocation) return Boolean; -- Evaluate the expression to check if the event described by the -- context is selected. Returns True if the event is selected. function Is_Selected (Node : in Node_Type; Event : in MAT.Events.Target_Event_Type) return Boolean; type Expression_Type is new Ada.Finalization.Controlled with record Node : Node_Type_Access; end record; -- Release the reference and destroy the expression tree if it was the last reference. overriding procedure Finalize (Obj : in out Expression_Type); -- Update the reference after an assignment. overriding procedure Adjust (Obj : in out Expression_Type); -- Empty expression. EMPTY : constant Expression_Type := Expression_Type'(Ada.Finalization.Controlled with Node => null); end MAT.Expressions;
[ { "context": "---------------------\n-- Copyright (c) 2013-2020, Luke A. Guest\n--\n-- This software is provided 'as-is', without", "end": 159, "score": 0.9996889233589172, "start": 146, "tag": "NAME", "value": "Luke A. Guest" } ]
src/sdl-video-rectangles.ads
Fabien-Chouteau/sdlada
1
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Video.Rectangles -- -- Rectangle bounding areas. -------------------------------------------------------------------------------------------------------------------- with Interfaces.C; package SDL.Video.Rectangles is package C renames Interfaces.C; Rectangle_Error : exception; type Size_Arrays is array (C.size_t range <>) of aliased SDL.Sizes with Convention => C; subtype Point is SDL.Coordinates; type Point_Arrays is array (C.size_t range <>) of aliased Point with Convention => C; type Line_Segment is record Start : SDL.Coordinates; Finish : SDL.Coordinates; end record with Convention => C; type Line_Arrays is array (C.size_t range <>) of aliased Line_Segment with Convention => C; -- TODO: Replace with Point and Sizes? type Rectangle is record X : SDL.Coordinate; Y : SDL.Coordinate; Width : SDL.Natural_Dimension; Height : SDL.Natural_Dimension; end record with Convention => C; Null_Rectangle : constant Rectangle := (others => 0); type Rectangle_Arrays is array (C.size_t range <>) of aliased Rectangle with Convention => C; type Rectangle_Access is access all Rectangle with Convention => C; function Enclose (Points : in Point_Arrays; Clip : in Rectangle; Enclosed : out Rectangle) return Boolean; procedure Enclose (Points : in Point_Arrays; Enclosed : out Rectangle); function Has_Intersected (A, B : in Rectangle) return Boolean; function Intersects (A, B : in Rectangle; Intersection : out Rectangle) return Boolean; function Clip_To (Clip_Area : in Rectangle; Line : in out Line_Segment) return Boolean; function Union (A, B : in Rectangle) return Rectangle; end SDL.Video.Rectangles;
4681
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, <NAME> -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Video.Rectangles -- -- Rectangle bounding areas. -------------------------------------------------------------------------------------------------------------------- with Interfaces.C; package SDL.Video.Rectangles is package C renames Interfaces.C; Rectangle_Error : exception; type Size_Arrays is array (C.size_t range <>) of aliased SDL.Sizes with Convention => C; subtype Point is SDL.Coordinates; type Point_Arrays is array (C.size_t range <>) of aliased Point with Convention => C; type Line_Segment is record Start : SDL.Coordinates; Finish : SDL.Coordinates; end record with Convention => C; type Line_Arrays is array (C.size_t range <>) of aliased Line_Segment with Convention => C; -- TODO: Replace with Point and Sizes? type Rectangle is record X : SDL.Coordinate; Y : SDL.Coordinate; Width : SDL.Natural_Dimension; Height : SDL.Natural_Dimension; end record with Convention => C; Null_Rectangle : constant Rectangle := (others => 0); type Rectangle_Arrays is array (C.size_t range <>) of aliased Rectangle with Convention => C; type Rectangle_Access is access all Rectangle with Convention => C; function Enclose (Points : in Point_Arrays; Clip : in Rectangle; Enclosed : out Rectangle) return Boolean; procedure Enclose (Points : in Point_Arrays; Enclosed : out Rectangle); function Has_Intersected (A, B : in Rectangle) return Boolean; function Intersects (A, B : in Rectangle; Intersection : out Rectangle) return Boolean; function Clip_To (Clip_Area : in Rectangle; Line : in out Line_Segment) return Boolean; function Union (A, B : in Rectangle) return Rectangle; end SDL.Video.Rectangles;
true
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2020, PI:NAME:<NAME>END_PI -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Video.Rectangles -- -- Rectangle bounding areas. -------------------------------------------------------------------------------------------------------------------- with Interfaces.C; package SDL.Video.Rectangles is package C renames Interfaces.C; Rectangle_Error : exception; type Size_Arrays is array (C.size_t range <>) of aliased SDL.Sizes with Convention => C; subtype Point is SDL.Coordinates; type Point_Arrays is array (C.size_t range <>) of aliased Point with Convention => C; type Line_Segment is record Start : SDL.Coordinates; Finish : SDL.Coordinates; end record with Convention => C; type Line_Arrays is array (C.size_t range <>) of aliased Line_Segment with Convention => C; -- TODO: Replace with Point and Sizes? type Rectangle is record X : SDL.Coordinate; Y : SDL.Coordinate; Width : SDL.Natural_Dimension; Height : SDL.Natural_Dimension; end record with Convention => C; Null_Rectangle : constant Rectangle := (others => 0); type Rectangle_Arrays is array (C.size_t range <>) of aliased Rectangle with Convention => C; type Rectangle_Access is access all Rectangle with Convention => C; function Enclose (Points : in Point_Arrays; Clip : in Rectangle; Enclosed : out Rectangle) return Boolean; procedure Enclose (Points : in Point_Arrays; Enclosed : out Rectangle); function Has_Intersected (A, B : in Rectangle) return Boolean; function Intersects (A, B : in Rectangle; Intersection : out Rectangle) return Boolean; function Clip_To (Clip_Area : in Rectangle; Line : in out Line_Segment) return Boolean; function Union (A, B : in Rectangle) return Rectangle; end SDL.Video.Rectangles;
[ { "context": " --\n-- Copyright (C) 2014 David Botton --\n-- ", "end": 741, "score": 0.99984210729599, "start": 729, "tag": "NAME", "value": "David Botton" } ]
ada_gui-gnoga-gui-element-list.ads
jrcarter/Ada_GUI
19
-- Ada_GUI implementation based on Gnoga. Adapted 2021 -- -- -- GNOGA - The GNU Omnificent GUI for Ada -- -- -- -- G N O G A . G U I . E L E M E N T . L I S T S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2014 David Botton -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- 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/>. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- For more information please go to http://www.gnoga.com -- ------------------------------------------------------------------------------ with Ada_GUI.Gnoga.Gui.View; package Ada_GUI.Gnoga.Gui.Element.List is -- Lists are elements, implemented as views that comprise sub element -- parts. Each list type has a different default display style. -- -- To add elements just Item.Create the sub types. -- To remove from list use Item.Remove -- To place in a specific location use the standard Element.Place_* -- methods. ------------------------------------------------------------------------- -- Ordered_List_Types ------------------------------------------------------------------------- type Ordered_List_Type is new Gnoga.Gui.View.View_Base_Type with private; type Ordered_List_Access is access all Ordered_List_Type; type Pointer_To_Ordered_List_Class is access all Ordered_List_Type'Class; ------------------------------------------------------------------------- -- Ordered_List_Types - Creation Methods ------------------------------------------------------------------------- procedure Create (List : in out Ordered_List_Type; Parent : in out Gnoga.Gui.Base_Type'Class; ID : in String := ""); -- Create an ordered (by default 1,2,3,4..) list ------------------------------------------------------------------------- -- Ordered_List_Types - Properties ------------------------------------------------------------------------- type List_Kind_Type is (Disc, Armenian, Circle, Cjk_Ideographic, Decimal, Decimal_Leading_Zero, Georgian, Hebrew, Hiragana, Hiragana_Iroha, Katakana, Katakana_Iroha, Lower_Alpha, Lower_Greek, Lower_Latin, Lower_Roman, None, Square, Upper_Alpha, Upper_Latin, Upper_Roman); procedure List_Kind (List : in out Ordered_List_Type; Value : in List_Kind_Type); type List_Location_Type is (Inside, Outside); procedure List_Location (List : in out Ordered_List_Type; Value : in List_Location_Type); -- Default is outside ------------------------------------------------------------------------- -- Unordered_List_Types ------------------------------------------------------------------------- type Unordered_List_Type is new Ordered_List_Type with private; type Unordered_List_Access is access all Unordered_List_Type; type Pointer_To_Unordered_List_Class is access all Unordered_List_Type'Class; ------------------------------------------------------------------------- -- Unordered_List_Types - Creation Methods ------------------------------------------------------------------------- overriding procedure Create (List : in out Unordered_List_Type; Parent : in out Gnoga.Gui.Base_Type'Class; ID : in String := ""); -- Create an unordered (by default) bullet/disc list ------------------------------------------------------------------------- -- List_Item_Types ------------------------------------------------------------------------- type List_Item_Type is new Gnoga.Gui.Element.Element_Type with private; type List_Item_Access is access all List_Item_Type; type Pointer_To_List_Item_Class is access all List_Item_Type'Class; ------------------------------------------------------------------------- -- List_Item_Type - Creation Methods ------------------------------------------------------------------------- procedure Create (Item : in out List_Item_Type; Parent : in out Ordered_List_Type'Class; Text : in String := ""; ID : in String := ""); -- To properly display parent should be an Ordered_List_Type or an -- Unordered_List_Type ------------------------------------------------------------------------- -- List_Item_Type - Properties ------------------------------------------------------------------------- procedure Value (Element : in out List_Item_Type; Value : in String); function Value (Element : List_Item_Type) return String; -- Ordered list value, List_Item_Types added following set of Value will -- follow in order. ------------------------------------------------------------------------- -- Definition_List_Types ------------------------------------------------------------------------- type Definition_List_Type is new Gnoga.Gui.View.View_Base_Type with private; type Definition_List_Access is access all Definition_List_Type; type Pointer_To_Definition_List_Class is access all Definition_List_Type'Class; ------------------------------------------------------------------------- -- Definition_List_Types - Creation Methods ------------------------------------------------------------------------- procedure Create (List : in out Definition_List_Type; Parent : in out Gnoga.Gui.Base_Type'Class; ID : in String := ""); -- Create a definition list of terms and descriptions ------------------------------------------------------------------------- -- Term_Types ------------------------------------------------------------------------- type Term_Type is new Gnoga.Gui.Element.Element_Type with private; type Term_Access is access all Term_Type; type Pointer_To_Term_Class is access all Term_Type'Class; ------------------------------------------------------------------------- -- Term_Type - Creation Methods ------------------------------------------------------------------------- procedure Create (Item : in out Term_Type; Parent : in out Definition_List_Type'Class; Text : in String := ""; ID : in String := ""); ------------------------------------------------------------------------- -- Description_Types ------------------------------------------------------------------------- type Description_Type is new Gnoga.Gui.Element.Element_Type with private; type Description_Access is access all Description_Type; type Pointer_To_Description_Class is access all Description_Type'Class; ------------------------------------------------------------------------- -- Description_Type - Creation Methods ------------------------------------------------------------------------- procedure Create (Item : in out Description_Type; Parent : in out Definition_List_Type'Class; Text : in String := ""; ID : in String := ""); private type Ordered_List_Type is new Gnoga.Gui.View.View_Base_Type with null record; type Unordered_List_Type is new Ordered_List_Type with null record; type List_Item_Type is new Gnoga.Gui.Element.Element_Type with null record; type Definition_List_Type is new Gnoga.Gui.View.View_Base_Type with null record; type Term_Type is new Gnoga.Gui.Element.Element_Type with null record; type Description_Type is new Gnoga.Gui.Element.Element_Type with null record; end Ada_GUI.Gnoga.Gui.Element.List;
16346
-- Ada_GUI implementation based on Gnoga. Adapted 2021 -- -- -- GNOGA - The GNU Omnificent GUI for Ada -- -- -- -- G N O G A . G U I . E L E M E N T . L I S T S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2014 <NAME> -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- 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/>. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- For more information please go to http://www.gnoga.com -- ------------------------------------------------------------------------------ with Ada_GUI.Gnoga.Gui.View; package Ada_GUI.Gnoga.Gui.Element.List is -- Lists are elements, implemented as views that comprise sub element -- parts. Each list type has a different default display style. -- -- To add elements just Item.Create the sub types. -- To remove from list use Item.Remove -- To place in a specific location use the standard Element.Place_* -- methods. ------------------------------------------------------------------------- -- Ordered_List_Types ------------------------------------------------------------------------- type Ordered_List_Type is new Gnoga.Gui.View.View_Base_Type with private; type Ordered_List_Access is access all Ordered_List_Type; type Pointer_To_Ordered_List_Class is access all Ordered_List_Type'Class; ------------------------------------------------------------------------- -- Ordered_List_Types - Creation Methods ------------------------------------------------------------------------- procedure Create (List : in out Ordered_List_Type; Parent : in out Gnoga.Gui.Base_Type'Class; ID : in String := ""); -- Create an ordered (by default 1,2,3,4..) list ------------------------------------------------------------------------- -- Ordered_List_Types - Properties ------------------------------------------------------------------------- type List_Kind_Type is (Disc, Armenian, Circle, Cjk_Ideographic, Decimal, Decimal_Leading_Zero, Georgian, Hebrew, Hiragana, Hiragana_Iroha, Katakana, Katakana_Iroha, Lower_Alpha, Lower_Greek, Lower_Latin, Lower_Roman, None, Square, Upper_Alpha, Upper_Latin, Upper_Roman); procedure List_Kind (List : in out Ordered_List_Type; Value : in List_Kind_Type); type List_Location_Type is (Inside, Outside); procedure List_Location (List : in out Ordered_List_Type; Value : in List_Location_Type); -- Default is outside ------------------------------------------------------------------------- -- Unordered_List_Types ------------------------------------------------------------------------- type Unordered_List_Type is new Ordered_List_Type with private; type Unordered_List_Access is access all Unordered_List_Type; type Pointer_To_Unordered_List_Class is access all Unordered_List_Type'Class; ------------------------------------------------------------------------- -- Unordered_List_Types - Creation Methods ------------------------------------------------------------------------- overriding procedure Create (List : in out Unordered_List_Type; Parent : in out Gnoga.Gui.Base_Type'Class; ID : in String := ""); -- Create an unordered (by default) bullet/disc list ------------------------------------------------------------------------- -- List_Item_Types ------------------------------------------------------------------------- type List_Item_Type is new Gnoga.Gui.Element.Element_Type with private; type List_Item_Access is access all List_Item_Type; type Pointer_To_List_Item_Class is access all List_Item_Type'Class; ------------------------------------------------------------------------- -- List_Item_Type - Creation Methods ------------------------------------------------------------------------- procedure Create (Item : in out List_Item_Type; Parent : in out Ordered_List_Type'Class; Text : in String := ""; ID : in String := ""); -- To properly display parent should be an Ordered_List_Type or an -- Unordered_List_Type ------------------------------------------------------------------------- -- List_Item_Type - Properties ------------------------------------------------------------------------- procedure Value (Element : in out List_Item_Type; Value : in String); function Value (Element : List_Item_Type) return String; -- Ordered list value, List_Item_Types added following set of Value will -- follow in order. ------------------------------------------------------------------------- -- Definition_List_Types ------------------------------------------------------------------------- type Definition_List_Type is new Gnoga.Gui.View.View_Base_Type with private; type Definition_List_Access is access all Definition_List_Type; type Pointer_To_Definition_List_Class is access all Definition_List_Type'Class; ------------------------------------------------------------------------- -- Definition_List_Types - Creation Methods ------------------------------------------------------------------------- procedure Create (List : in out Definition_List_Type; Parent : in out Gnoga.Gui.Base_Type'Class; ID : in String := ""); -- Create a definition list of terms and descriptions ------------------------------------------------------------------------- -- Term_Types ------------------------------------------------------------------------- type Term_Type is new Gnoga.Gui.Element.Element_Type with private; type Term_Access is access all Term_Type; type Pointer_To_Term_Class is access all Term_Type'Class; ------------------------------------------------------------------------- -- Term_Type - Creation Methods ------------------------------------------------------------------------- procedure Create (Item : in out Term_Type; Parent : in out Definition_List_Type'Class; Text : in String := ""; ID : in String := ""); ------------------------------------------------------------------------- -- Description_Types ------------------------------------------------------------------------- type Description_Type is new Gnoga.Gui.Element.Element_Type with private; type Description_Access is access all Description_Type; type Pointer_To_Description_Class is access all Description_Type'Class; ------------------------------------------------------------------------- -- Description_Type - Creation Methods ------------------------------------------------------------------------- procedure Create (Item : in out Description_Type; Parent : in out Definition_List_Type'Class; Text : in String := ""; ID : in String := ""); private type Ordered_List_Type is new Gnoga.Gui.View.View_Base_Type with null record; type Unordered_List_Type is new Ordered_List_Type with null record; type List_Item_Type is new Gnoga.Gui.Element.Element_Type with null record; type Definition_List_Type is new Gnoga.Gui.View.View_Base_Type with null record; type Term_Type is new Gnoga.Gui.Element.Element_Type with null record; type Description_Type is new Gnoga.Gui.Element.Element_Type with null record; end Ada_GUI.Gnoga.Gui.Element.List;
true
-- Ada_GUI implementation based on Gnoga. Adapted 2021 -- -- -- GNOGA - The GNU Omnificent GUI for Ada -- -- -- -- G N O G A . G U I . E L E M E N T . L I S T S -- -- -- -- S p e c -- -- -- -- -- -- Copyright (C) 2014 PI:NAME:<NAME>END_PI -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- 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/>. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- For more information please go to http://www.gnoga.com -- ------------------------------------------------------------------------------ with Ada_GUI.Gnoga.Gui.View; package Ada_GUI.Gnoga.Gui.Element.List is -- Lists are elements, implemented as views that comprise sub element -- parts. Each list type has a different default display style. -- -- To add elements just Item.Create the sub types. -- To remove from list use Item.Remove -- To place in a specific location use the standard Element.Place_* -- methods. ------------------------------------------------------------------------- -- Ordered_List_Types ------------------------------------------------------------------------- type Ordered_List_Type is new Gnoga.Gui.View.View_Base_Type with private; type Ordered_List_Access is access all Ordered_List_Type; type Pointer_To_Ordered_List_Class is access all Ordered_List_Type'Class; ------------------------------------------------------------------------- -- Ordered_List_Types - Creation Methods ------------------------------------------------------------------------- procedure Create (List : in out Ordered_List_Type; Parent : in out Gnoga.Gui.Base_Type'Class; ID : in String := ""); -- Create an ordered (by default 1,2,3,4..) list ------------------------------------------------------------------------- -- Ordered_List_Types - Properties ------------------------------------------------------------------------- type List_Kind_Type is (Disc, Armenian, Circle, Cjk_Ideographic, Decimal, Decimal_Leading_Zero, Georgian, Hebrew, Hiragana, Hiragana_Iroha, Katakana, Katakana_Iroha, Lower_Alpha, Lower_Greek, Lower_Latin, Lower_Roman, None, Square, Upper_Alpha, Upper_Latin, Upper_Roman); procedure List_Kind (List : in out Ordered_List_Type; Value : in List_Kind_Type); type List_Location_Type is (Inside, Outside); procedure List_Location (List : in out Ordered_List_Type; Value : in List_Location_Type); -- Default is outside ------------------------------------------------------------------------- -- Unordered_List_Types ------------------------------------------------------------------------- type Unordered_List_Type is new Ordered_List_Type with private; type Unordered_List_Access is access all Unordered_List_Type; type Pointer_To_Unordered_List_Class is access all Unordered_List_Type'Class; ------------------------------------------------------------------------- -- Unordered_List_Types - Creation Methods ------------------------------------------------------------------------- overriding procedure Create (List : in out Unordered_List_Type; Parent : in out Gnoga.Gui.Base_Type'Class; ID : in String := ""); -- Create an unordered (by default) bullet/disc list ------------------------------------------------------------------------- -- List_Item_Types ------------------------------------------------------------------------- type List_Item_Type is new Gnoga.Gui.Element.Element_Type with private; type List_Item_Access is access all List_Item_Type; type Pointer_To_List_Item_Class is access all List_Item_Type'Class; ------------------------------------------------------------------------- -- List_Item_Type - Creation Methods ------------------------------------------------------------------------- procedure Create (Item : in out List_Item_Type; Parent : in out Ordered_List_Type'Class; Text : in String := ""; ID : in String := ""); -- To properly display parent should be an Ordered_List_Type or an -- Unordered_List_Type ------------------------------------------------------------------------- -- List_Item_Type - Properties ------------------------------------------------------------------------- procedure Value (Element : in out List_Item_Type; Value : in String); function Value (Element : List_Item_Type) return String; -- Ordered list value, List_Item_Types added following set of Value will -- follow in order. ------------------------------------------------------------------------- -- Definition_List_Types ------------------------------------------------------------------------- type Definition_List_Type is new Gnoga.Gui.View.View_Base_Type with private; type Definition_List_Access is access all Definition_List_Type; type Pointer_To_Definition_List_Class is access all Definition_List_Type'Class; ------------------------------------------------------------------------- -- Definition_List_Types - Creation Methods ------------------------------------------------------------------------- procedure Create (List : in out Definition_List_Type; Parent : in out Gnoga.Gui.Base_Type'Class; ID : in String := ""); -- Create a definition list of terms and descriptions ------------------------------------------------------------------------- -- Term_Types ------------------------------------------------------------------------- type Term_Type is new Gnoga.Gui.Element.Element_Type with private; type Term_Access is access all Term_Type; type Pointer_To_Term_Class is access all Term_Type'Class; ------------------------------------------------------------------------- -- Term_Type - Creation Methods ------------------------------------------------------------------------- procedure Create (Item : in out Term_Type; Parent : in out Definition_List_Type'Class; Text : in String := ""; ID : in String := ""); ------------------------------------------------------------------------- -- Description_Types ------------------------------------------------------------------------- type Description_Type is new Gnoga.Gui.Element.Element_Type with private; type Description_Access is access all Description_Type; type Pointer_To_Description_Class is access all Description_Type'Class; ------------------------------------------------------------------------- -- Description_Type - Creation Methods ------------------------------------------------------------------------- procedure Create (Item : in out Description_Type; Parent : in out Definition_List_Type'Class; Text : in String := ""; ID : in String := ""); private type Ordered_List_Type is new Gnoga.Gui.View.View_Base_Type with null record; type Unordered_List_Type is new Ordered_List_Type with null record; type List_Item_Type is new Gnoga.Gui.Element.Element_Type with null record; type Definition_List_Type is new Gnoga.Gui.View.View_Base_Type with null record; type Term_Type is new Gnoga.Gui.Element.Element_Type with null record; type Description_Type is new Gnoga.Gui.Element.Element_Type with null record; end Ada_GUI.Gnoga.Gui.Element.List;
[ { "context": "da Keystore GTK application\n-- Copyright (C) 2019 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 174, "score": 0.999873161315918, "start": 159, "tag": "NAME", "value": "Stephane Carrez" }, { "context": " Copyright (C) 2019 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 205, "score": 0.9998798370361328, "start": 190, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "9 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 232, "score": 0.9999240636825562, "start": 207, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
gtk/akt-callbacks.ads
thierr26/ada-keystore
25
----------------------------------------------------------------------- -- akt-callbacks -- Callbacks for Ada Keystore GTK application -- Copyright (C) 2019 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Gtkada.Builder; with AKT.Windows; package AKT.Callbacks is -- Initialize and register the callbacks. procedure Initialize (Application : in AKT.Windows.Application_Access; Builder : in Gtkada.Builder.Gtkada_Builder); -- Callback executed when the "quit" action is executed from the menu. procedure On_Menu_Quit (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "about" action is executed from the menu. procedure On_Menu_About (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "menu-new" action is executed from the file menu. procedure On_Menu_New (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "menu-open" action is executed from the file menu. procedure On_Menu_Open (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-add" action is executed from the toolbar. procedure On_Tool_Add (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-save" action is executed from the toolbar. procedure On_Tool_Save (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-edit" action is executed from the toolbar. procedure On_Tool_Edit (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-lock" action is executed from the toolbar. procedure On_Tool_Lock (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-unlock" action is executed from the toolbar. procedure On_Tool_Unlock (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "open-file" action is executed from the open_file dialog. procedure On_Open_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "cancel-open-file" action is executed from the open_file dialog. procedure On_Cancel_Open_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "create-file" action is executed from the open_file dialog. procedure On_Create_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "cancel-create-file" action is executed -- from the open_file dialog. procedure On_Cancel_Create_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "delete-event" action is executed from the main window. function On_Close_Window (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) return Boolean; -- Callback executed when the "close-about" action is executed from the about box. procedure On_Close_About (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "close-password" action is executed from the password dialog. procedure On_Close_Password (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "dialog-password-ok" action is executed from the password dialog. procedure On_Dialog_Password_Ok (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); end AKT.Callbacks;
20141
----------------------------------------------------------------------- -- akt-callbacks -- Callbacks for Ada Keystore GTK application -- Copyright (C) 2019 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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 Gtkada.Builder; with AKT.Windows; package AKT.Callbacks is -- Initialize and register the callbacks. procedure Initialize (Application : in AKT.Windows.Application_Access; Builder : in Gtkada.Builder.Gtkada_Builder); -- Callback executed when the "quit" action is executed from the menu. procedure On_Menu_Quit (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "about" action is executed from the menu. procedure On_Menu_About (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "menu-new" action is executed from the file menu. procedure On_Menu_New (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "menu-open" action is executed from the file menu. procedure On_Menu_Open (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-add" action is executed from the toolbar. procedure On_Tool_Add (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-save" action is executed from the toolbar. procedure On_Tool_Save (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-edit" action is executed from the toolbar. procedure On_Tool_Edit (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-lock" action is executed from the toolbar. procedure On_Tool_Lock (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-unlock" action is executed from the toolbar. procedure On_Tool_Unlock (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "open-file" action is executed from the open_file dialog. procedure On_Open_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "cancel-open-file" action is executed from the open_file dialog. procedure On_Cancel_Open_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "create-file" action is executed from the open_file dialog. procedure On_Create_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "cancel-create-file" action is executed -- from the open_file dialog. procedure On_Cancel_Create_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "delete-event" action is executed from the main window. function On_Close_Window (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) return Boolean; -- Callback executed when the "close-about" action is executed from the about box. procedure On_Close_About (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "close-password" action is executed from the password dialog. procedure On_Close_Password (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "dialog-password-ok" action is executed from the password dialog. procedure On_Dialog_Password_Ok (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); end AKT.Callbacks;
true
----------------------------------------------------------------------- -- akt-callbacks -- Callbacks for Ada Keystore GTK application -- Copyright (C) 2019 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- 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 Gtkada.Builder; with AKT.Windows; package AKT.Callbacks is -- Initialize and register the callbacks. procedure Initialize (Application : in AKT.Windows.Application_Access; Builder : in Gtkada.Builder.Gtkada_Builder); -- Callback executed when the "quit" action is executed from the menu. procedure On_Menu_Quit (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "about" action is executed from the menu. procedure On_Menu_About (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "menu-new" action is executed from the file menu. procedure On_Menu_New (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "menu-open" action is executed from the file menu. procedure On_Menu_Open (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-add" action is executed from the toolbar. procedure On_Tool_Add (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-save" action is executed from the toolbar. procedure On_Tool_Save (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-edit" action is executed from the toolbar. procedure On_Tool_Edit (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-lock" action is executed from the toolbar. procedure On_Tool_Lock (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "tool-unlock" action is executed from the toolbar. procedure On_Tool_Unlock (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "open-file" action is executed from the open_file dialog. procedure On_Open_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "cancel-open-file" action is executed from the open_file dialog. procedure On_Cancel_Open_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "create-file" action is executed from the open_file dialog. procedure On_Create_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "cancel-create-file" action is executed -- from the open_file dialog. procedure On_Cancel_Create_File (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "delete-event" action is executed from the main window. function On_Close_Window (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class) return Boolean; -- Callback executed when the "close-about" action is executed from the about box. procedure On_Close_About (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "close-password" action is executed from the password dialog. procedure On_Close_Password (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); -- Callback executed when the "dialog-password-ok" action is executed from the password dialog. procedure On_Dialog_Password_Ok (Object : access Gtkada.Builder.Gtkada_Builder_Record'Class); end AKT.Callbacks;
[ { "context": "-- Project: StratoX\n-- Authors: Emanuel Regnath (emanuel.regnath@tum.de)\n-- Martin Becke", "end": 49, "score": 0.9998858571052551, "start": 34, "tag": "NAME", "value": "Emanuel Regnath" }, { "context": "- Project: StratoX\n-- Authors: Emanuel Regnath (emanuel.regnath@tum.de)\n-- Martin Becker (becker@rcs.ei.tum.de)", "end": 73, "score": 0.9999315142631531, "start": 51, "tag": "EMAIL", "value": "emanuel.regnath@tum.de" }, { "context": "anuel Regnath (emanuel.regnath@tum.de)\n-- Martin Becker (becker@rcs.ei.tum.de)\n--\n-- Description:\n-- ", "end": 100, "score": 0.9998747706413269, "start": 87, "tag": "NAME", "value": "Martin Becker" }, { "context": "manuel.regnath@tum.de)\n-- Martin Becker (becker@rcs.ei.tum.de)\n--\n-- Description:\n-- allows logging of str", "end": 122, "score": 0.9999334216117859, "start": 102, "tag": "EMAIL", "value": "becker@rcs.ei.tum.de" } ]
prototyping/adaracer/src/modules/logger.adb
TUM-EI-RCS/StratoX
12
-- Project: StratoX -- Authors: Emanuel Regnath (emanuel.regnath@tum.de) -- Martin Becker (becker@rcs.ei.tum.de) -- -- Description: -- allows logging of structured messages at several logging levels. -- -- Usage: -- Logger.init -- initializes the Logger -- Logger.log_console (Logger.INFO, "Program started.") -- writes log on info level to console -- Logger.log_sd (Logger.INFO, gps_msg) -- writes GPS record to SD card with SDLog; with NVRAM; with Buildinfo; with HIL.Devices; with HIL.UART; with System; with Interfaces; use Interfaces; with Ada.Unchecked_Conversion; with Ada.Real_Time; with ULog; pragma Elaborate_All (ULog); pragma Elaborate_All (SDLog); -- @summary Simultaneously writes to UART, and SD card. package body Logger with SPARK_Mode, Refined_State => (LogState => (queue_ulog, Logging_Task, logger_level, With_SDLog)) is -- the type for the queue buffer type Buffer_Ulog is array (Natural range <>) of ULog.Message; type bufpos is mod LOG_QUEUE_LENGTH; -- if GNATprove crashes with reference to that file, -- then you have run into bug KP-160-P601-005. -- workaround: move decl of protected type to package spec. --------------------- -- LOG QUEUE TYPE --------------------- -- protected type to implement the ULog queue protected type Ulog_Queue_T is procedure New_Msg (msg : in ULog.Message); -- enqueue new message. this is not blocking, except to ensure mutex. -- it is fast (only memcpy), but it can silently fail if buffer is full. -- FIXME: how can we specify a precondition on the private variable? -- for now we put an assertion in the body entry Get_Msg (msg : out ULog.Message); -- try to get new message from buffer. if empty, this is blocking -- until buffer has data, and then returns it. -- FIXME: how can we specify a precondition on the private variable? -- for now we put an assertion in the body function Get_Num_Overflows return Natural; -- query how often the buffer overflowed. If this happens, either increase -- the buffer QUEUE_LENGTH, or increase priority of the logger task. function Get_Length return Natural; -- query number of messages waiting in the logging queue. private Buffer : Buffer_Ulog (0 .. LOG_QUEUE_LENGTH - 1); -- cannot use a discriminant for this (would violate No_Implicit_Heap_Allocations) Num_Queued : Natural := 0; Not_Empty : Boolean := False; -- simple barrier (Ravenscar) Pos_Read : bufpos := 0; Pos_Write : bufpos := 0; Num_Overflows : Natural := 0; -- cannot use a dynamic predicate to etablish relationship, because this requires -- a record. But we cannot have a record, since this would make Not_Empty a -- non-simple barrier (=> Ravenscar violation). end Ulog_Queue_T; -- sporadic logging task waking up when message is enqueued task Logging_Task is pragma Priority (System.Priority'First); -- lowest prio for logging end Logging_Task; ---------------------------- -- PROTOTYPES ---------------------------- subtype Img_String is String (1 .. 3); function Image (level : Log_Level) return Img_String; procedure Write_Bytes_To_SD (len : Natural; buf : HIL.Byte_Array) with Pre => buf'Last >= buf'First and then len <= Natural (Unsigned_16'Last) and then buf'Length >= len; ---------------------------- -- INTERNAL STATES ---------------------------- queue_ulog : Ulog_Queue_T; logger_level : Log_Level := DEBUG; With_SDLog : Boolean := False; ----------------------- -- Write_Bytes_To_SD ----------------------- -- slow procedure! Takes Byte_Array, converts to SD data type and writes procedure Write_Bytes_To_SD (len : Natural; buf : HIL.Byte_Array) is begin if len > 0 then declare subtype Bytes_ULog is HIL.Byte_Array (1 .. len); subtype SD_Data_ULog is SDLog.SDLog_Data (1 .. Unsigned_16 (len)); function To_FileData is new Ada.Unchecked_Conversion (Bytes_ULog, SD_Data_ULog); buf_last : constant Integer := buf'First + len - 1; n_wr : Integer; begin SDLog.Write_Log (To_FileData (buf (buf'First .. buf_last)), n_wr); end; end if; end Write_Bytes_To_SD; -------------- -- LOG TASK -------------- -- the task which logs to SD card in the background task body Logging_Task is msg : ULog.Message; BUFLEN : constant := 512; bytes : HIL.Byte_Array (1 .. BUFLEN); len : Natural; type loginfo_ratio is mod 100; r : loginfo_ratio := 0; begin loop queue_ulog.Get_Msg (msg); -- under mutex, must be fast ULog.Serialize_Ulog (msg, len, bytes); -- this can be slow again Write_Bytes_To_SD (len => len, buf => bytes); -- occasionally log queue state (overflows, num_queued). r := r + 1; if r = 0 then declare m : ULog.Message (ULog.LOG_QUEUE); n_ovf : constant Natural := queue_ulog.Get_Num_Overflows; n_que : constant Natural := queue_ulog.Get_Length; begin m.t := Ada.Real_Time.Clock; if n_ovf > Natural (Unsigned_16'Last) then m.n_overflows := Unsigned_16'Last; else m.n_overflows := Unsigned_16 (n_ovf); end if; if n_que > Natural (Unsigned_8'Last) then m.n_queued := Unsigned_8'Last; else m.n_queued := Unsigned_8 (n_que); end if; ULog.Serialize_Ulog (m, len, bytes); Write_Bytes_To_SD (len => len, buf => bytes); end; end if; end loop; end Logging_Task; -- implementation of the message queue protected body Ulog_Queue_T is procedure New_Msg (msg : in ULog.Message) is begin Buffer (Integer (Pos_Write)) := msg; Pos_Write := Pos_Write + 1; if Num_Queued < Buffer'Last then Num_Queued := Num_Queued + 1; else -- =Buffer'Last Pos_Read := Pos_Read + 1; -- overwrite oldest if Num_Overflows < Natural'Last then Num_Overflows := Num_Overflows + 1; end if; end if; Not_Empty := (Num_Queued > 0); pragma Assert ((Not_Empty and (Num_Queued > 0)) or ((not Not_Empty) and (Num_Queued = 0))); end New_Msg; entry Get_Msg (msg : out ULog.Message) when Not_Empty is begin pragma Assume (Num_Queued > 0); -- via barrier and assert in New_Msg msg := Buffer (Integer (Pos_Read)); Pos_Read := Pos_Read + 1; Num_Queued := Num_Queued - 1; Not_Empty := Num_Queued > 0; pragma Assert ((Not_Empty and (Num_Queued > 0)) or ((not Not_Empty) and (Num_Queued = 0))); end Get_Msg; function Get_Num_Overflows return Natural is (Num_Overflows); function Get_Length return Natural is (Num_Queued); end Ulog_Queue_T; ---------------------------- -- Instantiation / Body -- ---------------------------- -- HAL, only change Adapter to port Code package body Adapter is procedure init (status : out Init_Error_Code) is begin -- HIL.UART.configure; already done in CPU.initialize status := SUCCESS; end init; procedure write (message : Message_Type) is CR : constant Character := Character'Val (13); -- ASCII LF : constant Character := Character'Val (10); begin HIL.UART.write (HIL.Devices.CONSOLE, HIL.UART.toData_Type (message & CR & LF)); end write; end Adapter; -------------- -- Init -------------- procedure Init (status : out Init_Error_Code) is begin SDLog.Init; Adapter.init (status); end Init; ----------- -- Image ----------- function Image (level : Log_Level) return Img_String is begin return (case level is when SENSOR => "S: ", when ERROR => "E: ", when WARN => "W: ", when INFO => "I: ", when DEBUG => "D: ", when TRACE => "T: " ); end Image; ----------------- -- log_console ----------------- procedure log_console (msg_level : Log_Level; message : Message_Type) with SPARK_Mode => Off is begin if Log_Level'Pos (msg_level) <= Log_Level'Pos (logger_level) then Adapter.write (Image (msg_level) & message); end if; end log_console; ---------------- -- log_sd ---------------- procedure log_sd (msg_level : Log_Level; message : ULog.Message) is begin if Log_Level'Pos (msg_level) <= Log_Level'Pos (logger_level) then queue_ulog.New_Msg (message); end if; end log_sd; ------------------- -- set_log_level ------------------- procedure Set_Log_Level (level : Log_Level) is begin logger_level := level; end Set_Log_Level; ------------------- -- Start_SDLog ------------------- procedure Start_SDLog is num_boots : HIL.Byte; begin NVRAM.Load (variable => NVRAM.VAR_BOOTCOUNTER, data => num_boots); declare buildstring : constant String := Buildinfo.Short_Datetime; fname : constant String := HIL.Byte'Image (num_boots) & ".log"; BUFLEN : constant := 128; -- header is around 90 bytes long bytes : HIL.Byte_Array (1 .. BUFLEN); len : Natural; valid : Boolean; Logfile_Started : Boolean; begin With_SDLog := False; SDLog.Start_Logfile (dirname => buildstring, filename => fname, ret => Logfile_Started); if not Logfile_Started then log_console (Logger.ERROR, "Cannot create logfile: " & buildstring & "/" & fname); return; else log_console (Logger.INFO, "Log name: " & buildstring & "/" & fname); With_SDLog := True; end if; -- write file header (ULog message definitions) ULog.Init; Get_Ulog_Defs_Loop : loop ULog.Get_Header_Ulog (bytes, len, valid); exit Get_Ulog_Defs_Loop when not valid; Write_Bytes_To_SD (len => len, buf => bytes); end loop Get_Ulog_Defs_Loop; end; end Start_SDLog; end Logger;
14630
-- Project: StratoX -- Authors: <NAME> (<EMAIL>) -- <NAME> (<EMAIL>) -- -- Description: -- allows logging of structured messages at several logging levels. -- -- Usage: -- Logger.init -- initializes the Logger -- Logger.log_console (Logger.INFO, "Program started.") -- writes log on info level to console -- Logger.log_sd (Logger.INFO, gps_msg) -- writes GPS record to SD card with SDLog; with NVRAM; with Buildinfo; with HIL.Devices; with HIL.UART; with System; with Interfaces; use Interfaces; with Ada.Unchecked_Conversion; with Ada.Real_Time; with ULog; pragma Elaborate_All (ULog); pragma Elaborate_All (SDLog); -- @summary Simultaneously writes to UART, and SD card. package body Logger with SPARK_Mode, Refined_State => (LogState => (queue_ulog, Logging_Task, logger_level, With_SDLog)) is -- the type for the queue buffer type Buffer_Ulog is array (Natural range <>) of ULog.Message; type bufpos is mod LOG_QUEUE_LENGTH; -- if GNATprove crashes with reference to that file, -- then you have run into bug KP-160-P601-005. -- workaround: move decl of protected type to package spec. --------------------- -- LOG QUEUE TYPE --------------------- -- protected type to implement the ULog queue protected type Ulog_Queue_T is procedure New_Msg (msg : in ULog.Message); -- enqueue new message. this is not blocking, except to ensure mutex. -- it is fast (only memcpy), but it can silently fail if buffer is full. -- FIXME: how can we specify a precondition on the private variable? -- for now we put an assertion in the body entry Get_Msg (msg : out ULog.Message); -- try to get new message from buffer. if empty, this is blocking -- until buffer has data, and then returns it. -- FIXME: how can we specify a precondition on the private variable? -- for now we put an assertion in the body function Get_Num_Overflows return Natural; -- query how often the buffer overflowed. If this happens, either increase -- the buffer QUEUE_LENGTH, or increase priority of the logger task. function Get_Length return Natural; -- query number of messages waiting in the logging queue. private Buffer : Buffer_Ulog (0 .. LOG_QUEUE_LENGTH - 1); -- cannot use a discriminant for this (would violate No_Implicit_Heap_Allocations) Num_Queued : Natural := 0; Not_Empty : Boolean := False; -- simple barrier (Ravenscar) Pos_Read : bufpos := 0; Pos_Write : bufpos := 0; Num_Overflows : Natural := 0; -- cannot use a dynamic predicate to etablish relationship, because this requires -- a record. But we cannot have a record, since this would make Not_Empty a -- non-simple barrier (=> Ravenscar violation). end Ulog_Queue_T; -- sporadic logging task waking up when message is enqueued task Logging_Task is pragma Priority (System.Priority'First); -- lowest prio for logging end Logging_Task; ---------------------------- -- PROTOTYPES ---------------------------- subtype Img_String is String (1 .. 3); function Image (level : Log_Level) return Img_String; procedure Write_Bytes_To_SD (len : Natural; buf : HIL.Byte_Array) with Pre => buf'Last >= buf'First and then len <= Natural (Unsigned_16'Last) and then buf'Length >= len; ---------------------------- -- INTERNAL STATES ---------------------------- queue_ulog : Ulog_Queue_T; logger_level : Log_Level := DEBUG; With_SDLog : Boolean := False; ----------------------- -- Write_Bytes_To_SD ----------------------- -- slow procedure! Takes Byte_Array, converts to SD data type and writes procedure Write_Bytes_To_SD (len : Natural; buf : HIL.Byte_Array) is begin if len > 0 then declare subtype Bytes_ULog is HIL.Byte_Array (1 .. len); subtype SD_Data_ULog is SDLog.SDLog_Data (1 .. Unsigned_16 (len)); function To_FileData is new Ada.Unchecked_Conversion (Bytes_ULog, SD_Data_ULog); buf_last : constant Integer := buf'First + len - 1; n_wr : Integer; begin SDLog.Write_Log (To_FileData (buf (buf'First .. buf_last)), n_wr); end; end if; end Write_Bytes_To_SD; -------------- -- LOG TASK -------------- -- the task which logs to SD card in the background task body Logging_Task is msg : ULog.Message; BUFLEN : constant := 512; bytes : HIL.Byte_Array (1 .. BUFLEN); len : Natural; type loginfo_ratio is mod 100; r : loginfo_ratio := 0; begin loop queue_ulog.Get_Msg (msg); -- under mutex, must be fast ULog.Serialize_Ulog (msg, len, bytes); -- this can be slow again Write_Bytes_To_SD (len => len, buf => bytes); -- occasionally log queue state (overflows, num_queued). r := r + 1; if r = 0 then declare m : ULog.Message (ULog.LOG_QUEUE); n_ovf : constant Natural := queue_ulog.Get_Num_Overflows; n_que : constant Natural := queue_ulog.Get_Length; begin m.t := Ada.Real_Time.Clock; if n_ovf > Natural (Unsigned_16'Last) then m.n_overflows := Unsigned_16'Last; else m.n_overflows := Unsigned_16 (n_ovf); end if; if n_que > Natural (Unsigned_8'Last) then m.n_queued := Unsigned_8'Last; else m.n_queued := Unsigned_8 (n_que); end if; ULog.Serialize_Ulog (m, len, bytes); Write_Bytes_To_SD (len => len, buf => bytes); end; end if; end loop; end Logging_Task; -- implementation of the message queue protected body Ulog_Queue_T is procedure New_Msg (msg : in ULog.Message) is begin Buffer (Integer (Pos_Write)) := msg; Pos_Write := Pos_Write + 1; if Num_Queued < Buffer'Last then Num_Queued := Num_Queued + 1; else -- =Buffer'Last Pos_Read := Pos_Read + 1; -- overwrite oldest if Num_Overflows < Natural'Last then Num_Overflows := Num_Overflows + 1; end if; end if; Not_Empty := (Num_Queued > 0); pragma Assert ((Not_Empty and (Num_Queued > 0)) or ((not Not_Empty) and (Num_Queued = 0))); end New_Msg; entry Get_Msg (msg : out ULog.Message) when Not_Empty is begin pragma Assume (Num_Queued > 0); -- via barrier and assert in New_Msg msg := Buffer (Integer (Pos_Read)); Pos_Read := Pos_Read + 1; Num_Queued := Num_Queued - 1; Not_Empty := Num_Queued > 0; pragma Assert ((Not_Empty and (Num_Queued > 0)) or ((not Not_Empty) and (Num_Queued = 0))); end Get_Msg; function Get_Num_Overflows return Natural is (Num_Overflows); function Get_Length return Natural is (Num_Queued); end Ulog_Queue_T; ---------------------------- -- Instantiation / Body -- ---------------------------- -- HAL, only change Adapter to port Code package body Adapter is procedure init (status : out Init_Error_Code) is begin -- HIL.UART.configure; already done in CPU.initialize status := SUCCESS; end init; procedure write (message : Message_Type) is CR : constant Character := Character'Val (13); -- ASCII LF : constant Character := Character'Val (10); begin HIL.UART.write (HIL.Devices.CONSOLE, HIL.UART.toData_Type (message & CR & LF)); end write; end Adapter; -------------- -- Init -------------- procedure Init (status : out Init_Error_Code) is begin SDLog.Init; Adapter.init (status); end Init; ----------- -- Image ----------- function Image (level : Log_Level) return Img_String is begin return (case level is when SENSOR => "S: ", when ERROR => "E: ", when WARN => "W: ", when INFO => "I: ", when DEBUG => "D: ", when TRACE => "T: " ); end Image; ----------------- -- log_console ----------------- procedure log_console (msg_level : Log_Level; message : Message_Type) with SPARK_Mode => Off is begin if Log_Level'Pos (msg_level) <= Log_Level'Pos (logger_level) then Adapter.write (Image (msg_level) & message); end if; end log_console; ---------------- -- log_sd ---------------- procedure log_sd (msg_level : Log_Level; message : ULog.Message) is begin if Log_Level'Pos (msg_level) <= Log_Level'Pos (logger_level) then queue_ulog.New_Msg (message); end if; end log_sd; ------------------- -- set_log_level ------------------- procedure Set_Log_Level (level : Log_Level) is begin logger_level := level; end Set_Log_Level; ------------------- -- Start_SDLog ------------------- procedure Start_SDLog is num_boots : HIL.Byte; begin NVRAM.Load (variable => NVRAM.VAR_BOOTCOUNTER, data => num_boots); declare buildstring : constant String := Buildinfo.Short_Datetime; fname : constant String := HIL.Byte'Image (num_boots) & ".log"; BUFLEN : constant := 128; -- header is around 90 bytes long bytes : HIL.Byte_Array (1 .. BUFLEN); len : Natural; valid : Boolean; Logfile_Started : Boolean; begin With_SDLog := False; SDLog.Start_Logfile (dirname => buildstring, filename => fname, ret => Logfile_Started); if not Logfile_Started then log_console (Logger.ERROR, "Cannot create logfile: " & buildstring & "/" & fname); return; else log_console (Logger.INFO, "Log name: " & buildstring & "/" & fname); With_SDLog := True; end if; -- write file header (ULog message definitions) ULog.Init; Get_Ulog_Defs_Loop : loop ULog.Get_Header_Ulog (bytes, len, valid); exit Get_Ulog_Defs_Loop when not valid; Write_Bytes_To_SD (len => len, buf => bytes); end loop Get_Ulog_Defs_Loop; end; end Start_SDLog; end Logger;
true
-- Project: StratoX -- Authors: PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Description: -- allows logging of structured messages at several logging levels. -- -- Usage: -- Logger.init -- initializes the Logger -- Logger.log_console (Logger.INFO, "Program started.") -- writes log on info level to console -- Logger.log_sd (Logger.INFO, gps_msg) -- writes GPS record to SD card with SDLog; with NVRAM; with Buildinfo; with HIL.Devices; with HIL.UART; with System; with Interfaces; use Interfaces; with Ada.Unchecked_Conversion; with Ada.Real_Time; with ULog; pragma Elaborate_All (ULog); pragma Elaborate_All (SDLog); -- @summary Simultaneously writes to UART, and SD card. package body Logger with SPARK_Mode, Refined_State => (LogState => (queue_ulog, Logging_Task, logger_level, With_SDLog)) is -- the type for the queue buffer type Buffer_Ulog is array (Natural range <>) of ULog.Message; type bufpos is mod LOG_QUEUE_LENGTH; -- if GNATprove crashes with reference to that file, -- then you have run into bug KP-160-P601-005. -- workaround: move decl of protected type to package spec. --------------------- -- LOG QUEUE TYPE --------------------- -- protected type to implement the ULog queue protected type Ulog_Queue_T is procedure New_Msg (msg : in ULog.Message); -- enqueue new message. this is not blocking, except to ensure mutex. -- it is fast (only memcpy), but it can silently fail if buffer is full. -- FIXME: how can we specify a precondition on the private variable? -- for now we put an assertion in the body entry Get_Msg (msg : out ULog.Message); -- try to get new message from buffer. if empty, this is blocking -- until buffer has data, and then returns it. -- FIXME: how can we specify a precondition on the private variable? -- for now we put an assertion in the body function Get_Num_Overflows return Natural; -- query how often the buffer overflowed. If this happens, either increase -- the buffer QUEUE_LENGTH, or increase priority of the logger task. function Get_Length return Natural; -- query number of messages waiting in the logging queue. private Buffer : Buffer_Ulog (0 .. LOG_QUEUE_LENGTH - 1); -- cannot use a discriminant for this (would violate No_Implicit_Heap_Allocations) Num_Queued : Natural := 0; Not_Empty : Boolean := False; -- simple barrier (Ravenscar) Pos_Read : bufpos := 0; Pos_Write : bufpos := 0; Num_Overflows : Natural := 0; -- cannot use a dynamic predicate to etablish relationship, because this requires -- a record. But we cannot have a record, since this would make Not_Empty a -- non-simple barrier (=> Ravenscar violation). end Ulog_Queue_T; -- sporadic logging task waking up when message is enqueued task Logging_Task is pragma Priority (System.Priority'First); -- lowest prio for logging end Logging_Task; ---------------------------- -- PROTOTYPES ---------------------------- subtype Img_String is String (1 .. 3); function Image (level : Log_Level) return Img_String; procedure Write_Bytes_To_SD (len : Natural; buf : HIL.Byte_Array) with Pre => buf'Last >= buf'First and then len <= Natural (Unsigned_16'Last) and then buf'Length >= len; ---------------------------- -- INTERNAL STATES ---------------------------- queue_ulog : Ulog_Queue_T; logger_level : Log_Level := DEBUG; With_SDLog : Boolean := False; ----------------------- -- Write_Bytes_To_SD ----------------------- -- slow procedure! Takes Byte_Array, converts to SD data type and writes procedure Write_Bytes_To_SD (len : Natural; buf : HIL.Byte_Array) is begin if len > 0 then declare subtype Bytes_ULog is HIL.Byte_Array (1 .. len); subtype SD_Data_ULog is SDLog.SDLog_Data (1 .. Unsigned_16 (len)); function To_FileData is new Ada.Unchecked_Conversion (Bytes_ULog, SD_Data_ULog); buf_last : constant Integer := buf'First + len - 1; n_wr : Integer; begin SDLog.Write_Log (To_FileData (buf (buf'First .. buf_last)), n_wr); end; end if; end Write_Bytes_To_SD; -------------- -- LOG TASK -------------- -- the task which logs to SD card in the background task body Logging_Task is msg : ULog.Message; BUFLEN : constant := 512; bytes : HIL.Byte_Array (1 .. BUFLEN); len : Natural; type loginfo_ratio is mod 100; r : loginfo_ratio := 0; begin loop queue_ulog.Get_Msg (msg); -- under mutex, must be fast ULog.Serialize_Ulog (msg, len, bytes); -- this can be slow again Write_Bytes_To_SD (len => len, buf => bytes); -- occasionally log queue state (overflows, num_queued). r := r + 1; if r = 0 then declare m : ULog.Message (ULog.LOG_QUEUE); n_ovf : constant Natural := queue_ulog.Get_Num_Overflows; n_que : constant Natural := queue_ulog.Get_Length; begin m.t := Ada.Real_Time.Clock; if n_ovf > Natural (Unsigned_16'Last) then m.n_overflows := Unsigned_16'Last; else m.n_overflows := Unsigned_16 (n_ovf); end if; if n_que > Natural (Unsigned_8'Last) then m.n_queued := Unsigned_8'Last; else m.n_queued := Unsigned_8 (n_que); end if; ULog.Serialize_Ulog (m, len, bytes); Write_Bytes_To_SD (len => len, buf => bytes); end; end if; end loop; end Logging_Task; -- implementation of the message queue protected body Ulog_Queue_T is procedure New_Msg (msg : in ULog.Message) is begin Buffer (Integer (Pos_Write)) := msg; Pos_Write := Pos_Write + 1; if Num_Queued < Buffer'Last then Num_Queued := Num_Queued + 1; else -- =Buffer'Last Pos_Read := Pos_Read + 1; -- overwrite oldest if Num_Overflows < Natural'Last then Num_Overflows := Num_Overflows + 1; end if; end if; Not_Empty := (Num_Queued > 0); pragma Assert ((Not_Empty and (Num_Queued > 0)) or ((not Not_Empty) and (Num_Queued = 0))); end New_Msg; entry Get_Msg (msg : out ULog.Message) when Not_Empty is begin pragma Assume (Num_Queued > 0); -- via barrier and assert in New_Msg msg := Buffer (Integer (Pos_Read)); Pos_Read := Pos_Read + 1; Num_Queued := Num_Queued - 1; Not_Empty := Num_Queued > 0; pragma Assert ((Not_Empty and (Num_Queued > 0)) or ((not Not_Empty) and (Num_Queued = 0))); end Get_Msg; function Get_Num_Overflows return Natural is (Num_Overflows); function Get_Length return Natural is (Num_Queued); end Ulog_Queue_T; ---------------------------- -- Instantiation / Body -- ---------------------------- -- HAL, only change Adapter to port Code package body Adapter is procedure init (status : out Init_Error_Code) is begin -- HIL.UART.configure; already done in CPU.initialize status := SUCCESS; end init; procedure write (message : Message_Type) is CR : constant Character := Character'Val (13); -- ASCII LF : constant Character := Character'Val (10); begin HIL.UART.write (HIL.Devices.CONSOLE, HIL.UART.toData_Type (message & CR & LF)); end write; end Adapter; -------------- -- Init -------------- procedure Init (status : out Init_Error_Code) is begin SDLog.Init; Adapter.init (status); end Init; ----------- -- Image ----------- function Image (level : Log_Level) return Img_String is begin return (case level is when SENSOR => "S: ", when ERROR => "E: ", when WARN => "W: ", when INFO => "I: ", when DEBUG => "D: ", when TRACE => "T: " ); end Image; ----------------- -- log_console ----------------- procedure log_console (msg_level : Log_Level; message : Message_Type) with SPARK_Mode => Off is begin if Log_Level'Pos (msg_level) <= Log_Level'Pos (logger_level) then Adapter.write (Image (msg_level) & message); end if; end log_console; ---------------- -- log_sd ---------------- procedure log_sd (msg_level : Log_Level; message : ULog.Message) is begin if Log_Level'Pos (msg_level) <= Log_Level'Pos (logger_level) then queue_ulog.New_Msg (message); end if; end log_sd; ------------------- -- set_log_level ------------------- procedure Set_Log_Level (level : Log_Level) is begin logger_level := level; end Set_Log_Level; ------------------- -- Start_SDLog ------------------- procedure Start_SDLog is num_boots : HIL.Byte; begin NVRAM.Load (variable => NVRAM.VAR_BOOTCOUNTER, data => num_boots); declare buildstring : constant String := Buildinfo.Short_Datetime; fname : constant String := HIL.Byte'Image (num_boots) & ".log"; BUFLEN : constant := 128; -- header is around 90 bytes long bytes : HIL.Byte_Array (1 .. BUFLEN); len : Natural; valid : Boolean; Logfile_Started : Boolean; begin With_SDLog := False; SDLog.Start_Logfile (dirname => buildstring, filename => fname, ret => Logfile_Started); if not Logfile_Started then log_console (Logger.ERROR, "Cannot create logfile: " & buildstring & "/" & fname); return; else log_console (Logger.INFO, "Log name: " & buildstring & "/" & fname); With_SDLog := True; end if; -- write file header (ULog message definitions) ULog.Init; Get_Ulog_Defs_Loop : loop ULog.Get_Header_Ulog (bytes, len, valid); exit Get_Ulog_Defs_Loop when not valid; Write_Bytes_To_SD (len => len, buf => bytes); end loop Get_Ulog_Defs_Loop; end; end Start_SDLog; end Logger;
[ { "context": "nID\n-- Copyright (C) 2009, 2010, 2011, 2012, 2013 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 173, "score": 0.9998791813850403, "start": 158, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "0, 2011, 2012, 2013 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 204, "score": 0.9998868703842163, "start": 189, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "3 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 231, "score": 0.9999292492866516, "start": 206, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
regtests/security-auth-tests.ads
jquorning/ada-security
19
----------------------------------------------------------------------- -- security-openid - Tests for OpenID -- Copyright (C) 2009, 2010, 2011, 2012, 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Strings.Maps; with Util.Tests; package Security.Auth.Tests is use Ada.Strings.Unbounded; procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; procedure Test_Discovery (T : in out Test); procedure Test_Verify_Signature (T : in out Test); type Test_Parameters is new Security.Auth.Parameters with record Params : Util.Strings.Maps.Map; end record; overriding function Get_Parameter (Params : in Test_Parameters; Name : in String) return String; procedure Set_Parameter (Params : in out Test_Parameters; Name : in String; Value : in String); end Security.Auth.Tests;
28422
----------------------------------------------------------------------- -- security-openid - Tests for OpenID -- Copyright (C) 2009, 2010, 2011, 2012, 2013 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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.Strings.Maps; with Util.Tests; package Security.Auth.Tests is use Ada.Strings.Unbounded; procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; procedure Test_Discovery (T : in out Test); procedure Test_Verify_Signature (T : in out Test); type Test_Parameters is new Security.Auth.Parameters with record Params : Util.Strings.Maps.Map; end record; overriding function Get_Parameter (Params : in Test_Parameters; Name : in String) return String; procedure Set_Parameter (Params : in out Test_Parameters; Name : in String; Value : in String); end Security.Auth.Tests;
true
----------------------------------------------------------------------- -- security-openid - Tests for OpenID -- Copyright (C) 2009, 2010, 2011, 2012, 2013 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- 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.Strings.Maps; with Util.Tests; package Security.Auth.Tests is use Ada.Strings.Unbounded; procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; procedure Test_Discovery (T : in out Test); procedure Test_Verify_Signature (T : in out Test); type Test_Parameters is new Security.Auth.Parameters with record Params : Util.Strings.Maps.Map; end record; overriding function Get_Parameter (Params : in Test_Parameters; Name : in String) return String; procedure Set_Parameter (Params : in out Test_Parameters; Name : in String; Value : in String); end Security.Auth.Tests;
[ { "context": "-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 35, "score": 0.9998546838760376, "start": 23, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 55, "score": 0.9999309778213501, "start": 37, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
source/oasis/program-elements-indexed_components.ads
optikos/oasis
0
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Expressions; with Program.Lexical_Elements; package Program.Elements.Indexed_Components is pragma Pure (Program.Elements.Indexed_Components); type Indexed_Component is limited interface and Program.Elements.Expressions.Expression; type Indexed_Component_Access is access all Indexed_Component'Class with Storage_Size => 0; not overriding function Prefix (Self : Indexed_Component) return not null Program.Elements.Expressions.Expression_Access is abstract; not overriding function Expressions (Self : Indexed_Component) return Program.Elements.Expressions.Expression_Vector_Access is abstract; type Indexed_Component_Text is limited interface; type Indexed_Component_Text_Access is access all Indexed_Component_Text'Class with Storage_Size => 0; not overriding function To_Indexed_Component_Text (Self : aliased in out Indexed_Component) return Indexed_Component_Text_Access is abstract; not overriding function Left_Bracket_Token (Self : Indexed_Component_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Right_Bracket_Token (Self : Indexed_Component_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Indexed_Components;
29848
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Expressions; with Program.Lexical_Elements; package Program.Elements.Indexed_Components is pragma Pure (Program.Elements.Indexed_Components); type Indexed_Component is limited interface and Program.Elements.Expressions.Expression; type Indexed_Component_Access is access all Indexed_Component'Class with Storage_Size => 0; not overriding function Prefix (Self : Indexed_Component) return not null Program.Elements.Expressions.Expression_Access is abstract; not overriding function Expressions (Self : Indexed_Component) return Program.Elements.Expressions.Expression_Vector_Access is abstract; type Indexed_Component_Text is limited interface; type Indexed_Component_Text_Access is access all Indexed_Component_Text'Class with Storage_Size => 0; not overriding function To_Indexed_Component_Text (Self : aliased in out Indexed_Component) return Indexed_Component_Text_Access is abstract; not overriding function Left_Bracket_Token (Self : Indexed_Component_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Right_Bracket_Token (Self : Indexed_Component_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Indexed_Components;
true
-- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Expressions; with Program.Lexical_Elements; package Program.Elements.Indexed_Components is pragma Pure (Program.Elements.Indexed_Components); type Indexed_Component is limited interface and Program.Elements.Expressions.Expression; type Indexed_Component_Access is access all Indexed_Component'Class with Storage_Size => 0; not overriding function Prefix (Self : Indexed_Component) return not null Program.Elements.Expressions.Expression_Access is abstract; not overriding function Expressions (Self : Indexed_Component) return Program.Elements.Expressions.Expression_Vector_Access is abstract; type Indexed_Component_Text is limited interface; type Indexed_Component_Text_Access is access all Indexed_Component_Text'Class with Storage_Size => 0; not overriding function To_Indexed_Component_Text (Self : aliased in out Indexed_Component) return Indexed_Component_Text_Access is abstract; not overriding function Left_Bracket_Token (Self : Indexed_Component_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Right_Bracket_Token (Self : Indexed_Component_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; end Program.Elements.Indexed_Components;
[ { "context": "----------------------\n-- Copyright (c) 2013-2014, Natacha Porté --\n-- ", "end": 120, "score": 0.9998474717140198, "start": 107, "tag": "NAME", "value": "Natacha Porté" } ]
src/natools-s_expressions-parsers.adb
faelys/natools
0
------------------------------------------------------------------------------ -- Copyright (c) 2013-2014, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Natools.S_Expressions.Encodings; package body Natools.S_Expressions.Parsers is ---------------------- -- Parser Interface -- ---------------------- procedure Reset (Self : in out Parser; Hard : in Boolean := False) is Null_Stack : Lockable.Lock_Stack; begin Self.Internal := (State => Waiting); Self.Next_Event := Events.End_Of_Input; Self.Latest := Events.Error; Self.Level := 0; Self.Lock_Stack := Null_Stack; Self.Locked := False; if Hard then Self.Pending.Hard_Reset; Self.Buffer.Hard_Reset; else Self.Pending.Soft_Reset; Self.Buffer.Soft_Reset; end if; end Reset; overriding function Current_Event (Self : in Parser) return Events.Event is begin if Self.Locked then return Events.End_Of_Input; else return Self.Latest; end if; end Current_Event; overriding function Current_Atom (Self : in Parser) return Atom is begin if Self.Locked or Self.Latest /= Events.Add_Atom then raise Program_Error; end if; return Self.Buffer.Data; end Current_Atom; overriding function Current_Level (Self : in Parser) return Natural is begin if Self.Locked then return 0; else return Self.Level - Lockable.Current_Level (Self.Lock_Stack); end if; end Current_Level; overriding procedure Query_Atom (Self : in Parser; Process : not null access procedure (Data : in Atom)) is begin if Self.Locked or Self.Latest /= Events.Add_Atom then raise Program_Error; end if; Self.Buffer.Query (Process); end Query_Atom; overriding procedure Read_Atom (Self : in Parser; Data : out Atom; Length : out Count) is begin if Self.Locked or Self.Latest /= Events.Add_Atom then raise Program_Error; end if; Self.Buffer.Peek (Data, Length); end Read_Atom; overriding procedure Next (Self : in out Parser; Event : out Events.Event) is O : Octet; begin if Self.Locked then Event := Events.End_Of_Input; return; end if; Self.Latest := Events.Error; loop -- Process pending events if Self.Next_Event /= Events.End_Of_Input then Self.Latest := Self.Next_Event; Self.Next_Event := Events.End_Of_Input; case Self.Latest is when Events.Open_List => Self.Level := Self.Level + 1; when Events.Close_List => if Self.Level > 0 then Self.Level := Self.Level - 1; end if; when others => null; end case; exit; end if; -- Read a single octet from source if Self.Pending.Length = 0 then Read_More (Parser'Class (Self), Self.Pending); if Self.Pending.Length = 0 then Self.Latest := Events.End_Of_Input; exit; end if; Self.Pending.Invert; end if; Self.Pending.Pop (O); -- Process octet case Self.Internal.State is when Waiting => Self.Buffer.Soft_Reset; case O is when 0 | Encodings.Space | Encodings.HT | Encodings.CR | Encodings.LF | Encodings.VT | Encodings.FF => null; when Encodings.List_Begin => Self.Latest := Events.Open_List; Self.Level := Self.Level + 1; when Encodings.List_End => Self.Latest := Events.Close_List; if Self.Level > 0 then Self.Level := Self.Level - 1; end if; when Encodings.Base64_Atom_Begin => Self.Internal := (State => Base64_Atom, Chunk => (Data => <>, Length => 0)); when Encodings.Base64_Expr_Begin => Self.Internal := (State => Base64_Expr, Chunk => (Data => <>, Length => 0)); when Encodings.Hex_Atom_Begin => Self.Internal := (State => Hex_Atom, Nibble_Buffer => 0); when Encodings.Quoted_Atom_Begin => Self.Internal := (State => Quoted_Atom, Escape => (Data => <>, Length => 0)); when Encodings.Digit_0 .. Encodings.Digit_9 => Self.Internal := (State => Number); Atom_Buffers.Append (Self.Buffer, O); when others => Self.Internal := (State => Token); Atom_Buffers.Append (Self.Buffer, O); end case; when Base64_Atom | Base64_Expr => if Encodings.Is_Base64_Digit (O) then Self.Internal.Chunk.Data (Self.Internal.Chunk.Length) := O; Self.Internal.Chunk.Length := Self.Internal.Chunk.Length + 1; if Self.Internal.Chunk.Length = 4 then Self.Buffer.Append (Encodings.Decode_Base64 (Self.Internal.Chunk.Data)); Self.Internal.Chunk.Length := 0; end if; elsif (O = Encodings.Base64_Atom_End and Self.Internal.State = Base64_Atom) or (O = Encodings.Base64_Expr_End and Self.Internal.State = Base64_Expr) then Self.Buffer.Append (Encodings.Decode_Base64 (Self.Internal.Chunk.Data (0 .. Self.Internal.Chunk.Length - 1))); if Self.Internal.State = Base64_Atom then Self.Latest := Events.Add_Atom; else Self.Pending.Append_Reverse (Self.Buffer.Data); Self.Buffer.Soft_Reset; end if; Self.Internal := (State => Waiting); end if; when Hex_Atom => if Encodings.Is_Hex_Digit (O) then if Encodings.Is_Hex_Digit (Self.Internal.Nibble_Buffer) then Self.Buffer.Append (Encodings.Decode_Hex (Self.Internal.Nibble_Buffer, O)); Self.Internal.Nibble_Buffer := 0; else Self.Internal.Nibble_Buffer := O; end if; elsif O = Encodings.Hex_Atom_End then Self.Latest := Events.Add_Atom; Self.Internal := (State => Waiting); end if; when Number => case O is when Encodings.Digit_0 .. Encodings.Digit_9 => Self.Buffer.Append (O); when Encodings.Verbatim_Begin => Self.Internal := (State => Verbatim_Atom, Size => 0); for I in 1 .. Self.Buffer.Length loop Self.Internal.Size := Self.Internal.Size * 10 + Count (Self.Buffer.Element (I) - Encodings.Digit_0); end loop; Self.Buffer.Soft_Reset; if Self.Internal.Size = 0 then Self.Latest := Events.Add_Atom; Self.Internal := (State => Waiting); else Self.Buffer.Preallocate (Self.Internal.Size); end if; when 0 | Encodings.Space | Encodings.HT | Encodings.CR | Encodings.LF | Encodings.VT | Encodings.FF => Self.Latest := Events.Add_Atom; Self.Internal := (State => Waiting); when Encodings.List_Begin => Self.Internal := (State => Waiting); Self.Next_Event := Events.Open_List; Self.Latest := Events.Add_Atom; when Encodings.List_End => Self.Internal := (State => Waiting); Self.Next_Event := Events.Close_List; Self.Latest := Events.Add_Atom; when Encodings.Base64_Atom_Begin => Self.Internal := (State => Base64_Atom, Chunk => (Data => <>, Length => 0)); Self.Buffer.Soft_Reset; when Encodings.Base64_Expr_Begin => Self.Internal := (State => Base64_Expr, Chunk => (Data => <>, Length => 0)); Self.Buffer.Soft_Reset; when Encodings.Hex_Atom_Begin => Self.Internal := (State => Hex_Atom, Nibble_Buffer => 0); Self.Buffer.Soft_Reset; when Encodings.Quoted_Atom_Begin => Self.Internal := (State => Quoted_Atom, Escape => (Data => <>, Length => 0)); Self.Buffer.Soft_Reset; when others => Self.Buffer.Append (O); Self.Internal := (State => Token); end case; when Quoted_Atom => case Self.Internal.Escape.Length is when 0 => case O is when Encodings.Escape => Self.Internal.Escape.Data (0) := O; Self.Internal.Escape.Length := 1; when Encodings.Quoted_Atom_End => Self.Internal := (State => Waiting); Self.Latest := Events.Add_Atom; when others => Self.Buffer.Append (O); end case; when 1 => case O is when Character'Pos ('b') => Self.Buffer.Append (8); Self.Internal.Escape.Length := 0; when Character'Pos ('t') => Self.Buffer.Append (9); Self.Internal.Escape.Length := 0; when Character'Pos ('n') => Self.Buffer.Append (10); Self.Internal.Escape.Length := 0; when Character'Pos ('v') => Self.Buffer.Append (11); Self.Internal.Escape.Length := 0; when Character'Pos ('f') => Self.Buffer.Append (12); Self.Internal.Escape.Length := 0; when Character'Pos ('r') => Self.Buffer.Append (13); Self.Internal.Escape.Length := 0; when Character'Pos (''') | Encodings.Escape | Encodings.Quoted_Atom_End => Self.Buffer.Append (O); Self.Internal.Escape.Length := 0; when Encodings.Digit_0 .. Encodings.Digit_0 + 3 | Character'Pos ('x') | Encodings.CR | Encodings.LF => Self.Internal.Escape.Data (1) := O; Self.Internal.Escape.Length := 2; when others => Self.Buffer.Append (Self.Internal.Escape.Data (0)); Self.Pending.Append (O); Self.Internal.Escape.Length := 0; end case; when 2 => if (Self.Internal.Escape.Data (1) in Encodings.Digit_0 .. Encodings.Digit_0 + 3 and O in Encodings.Digit_0 .. Encodings.Digit_0 + 7) or (Self.Internal.Escape.Data (1) = Character'Pos ('x') and then Encodings.Is_Hex_Digit (O)) then Self.Internal.Escape.Data (2) := O; Self.Internal.Escape.Length := 3; elsif Self.Internal.Escape.Data (1) = Encodings.CR or Self.Internal.Escape.Data (1) = Encodings.LF then Self.Internal.Escape.Length := 0; if not ((O = Encodings.CR or O = Encodings.LF) and O /= Self.Internal.Escape.Data (1)) then Self.Pending.Append (O); end if; else Self.Buffer.Append ((Self.Internal.Escape.Data (0), Self.Internal.Escape.Data (1))); Self.Pending.Append (O); Self.Internal.Escape.Length := 0; end if; when 3 => if Self.Internal.Escape.Data (1) = Character'Pos ('x') then if Encodings.Is_Hex_Digit (O) then Self.Buffer.Append (Encodings.Decode_Hex (Self.Internal.Escape.Data (2), O)); else Self.Buffer.Append ((Self.Internal.Escape.Data (0), Self.Internal.Escape.Data (1), Self.Internal.Escape.Data (2))); Self.Pending.Append (O); end if; else pragma Assert (Self.Internal.Escape.Data (1) in Encodings.Digit_0 .. Encodings.Digit_0 + 3); if O in Encodings.Digit_0 .. Encodings.Digit_0 + 7 then Atom_Buffers.Append (Self.Buffer, (Self.Internal.Escape.Data (1) - Encodings.Digit_0) * 2**6 + (Self.Internal.Escape.Data (2) - Encodings.Digit_0) * 2**3 + (O - Encodings.Digit_0)); else Self.Buffer.Append ((Self.Internal.Escape.Data (0), Self.Internal.Escape.Data (1), Self.Internal.Escape.Data (2))); Self.Pending.Append (O); end if; end if; Self.Internal.Escape.Length := 0; when 4 => raise Program_Error; end case; when Token => case O is when 0 | Encodings.Space | Encodings.HT | Encodings.CR | Encodings.LF | Encodings.VT | Encodings.FF => Self.Internal := (State => Waiting); Self.Latest := Events.Add_Atom; when Encodings.List_Begin => Self.Internal := (State => Waiting); Self.Next_Event := Events.Open_List; Self.Latest := Events.Add_Atom; when Encodings.List_End => Self.Internal := (State => Waiting); Self.Next_Event := Events.Close_List; Self.Latest := Events.Add_Atom; when others => Self.Buffer.Append (O); end case; when Verbatim_Atom => Self.Buffer.Append (O); pragma Assert (Self.Buffer.Length <= Self.Internal.Size); if Self.Buffer.Length = Self.Internal.Size then Self.Internal := (State => Waiting); Self.Latest := Events.Add_Atom; end if; end case; exit when Self.Latest /= Events.Error; end loop; if Self.Latest = Events.Close_List and then Self.Level < Lockable.Current_Level (Self.Lock_Stack) then Self.Locked := True; Event := Events.End_Of_Input; else Event := Self.Latest; end if; end Next; overriding procedure Lock (Self : in out Parser; State : out Lockable.Lock_State) is begin Lockable.Push_Level (Self.Lock_Stack, Self.Level, State); end Lock; overriding procedure Unlock (Self : in out Parser; State : in out Lockable.Lock_State; Finish : in Boolean := True) is Previous_Level : constant Natural := Lockable.Current_Level (Self.Lock_Stack); Event : Events.Event; begin Lockable.Pop_Level (Self.Lock_Stack, State); State := Lockable.Null_State; if Finish then Event := Self.Current_Event; loop case Event is when Events.Open_List | Events.Add_Atom => null; when Events.Close_List => exit when Self.Level < Previous_Level; when Events.Error | Events.End_Of_Input => exit; end case; Self.Next (Event); end loop; end if; Self.Locked := Self.Level < Lockable.Current_Level (Self.Lock_Stack); end Unlock; ------------------- -- Stream Parser -- ------------------- overriding procedure Read_More (Self : in out Stream_Parser; Buffer : out Atom_Buffers.Atom_Buffer) is Item : Ada.Streams.Stream_Element_Array (1 .. 128); Last : Ada.Streams.Stream_Element_Offset; begin Self.Input.Read (Item, Last); if Last in Item'Range then Buffer.Append (Item (Item'First .. Last)); end if; end Read_More; ------------------- -- Memory Parser -- ------------------- not overriding function Create (Data : in Ada.Streams.Stream_Element_Array) return Memory_Parser is begin return P : Memory_Parser do P.Pending.Append (Data); P.Pending.Invert; end return; end Create; not overriding function Create_From_String (Data : in String) return Memory_Parser is begin return Create (To_Atom (Data)); end Create_From_String; end Natools.S_Expressions.Parsers;
9586
------------------------------------------------------------------------------ -- Copyright (c) 2013-2014, <NAME> -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Natools.S_Expressions.Encodings; package body Natools.S_Expressions.Parsers is ---------------------- -- Parser Interface -- ---------------------- procedure Reset (Self : in out Parser; Hard : in Boolean := False) is Null_Stack : Lockable.Lock_Stack; begin Self.Internal := (State => Waiting); Self.Next_Event := Events.End_Of_Input; Self.Latest := Events.Error; Self.Level := 0; Self.Lock_Stack := Null_Stack; Self.Locked := False; if Hard then Self.Pending.Hard_Reset; Self.Buffer.Hard_Reset; else Self.Pending.Soft_Reset; Self.Buffer.Soft_Reset; end if; end Reset; overriding function Current_Event (Self : in Parser) return Events.Event is begin if Self.Locked then return Events.End_Of_Input; else return Self.Latest; end if; end Current_Event; overriding function Current_Atom (Self : in Parser) return Atom is begin if Self.Locked or Self.Latest /= Events.Add_Atom then raise Program_Error; end if; return Self.Buffer.Data; end Current_Atom; overriding function Current_Level (Self : in Parser) return Natural is begin if Self.Locked then return 0; else return Self.Level - Lockable.Current_Level (Self.Lock_Stack); end if; end Current_Level; overriding procedure Query_Atom (Self : in Parser; Process : not null access procedure (Data : in Atom)) is begin if Self.Locked or Self.Latest /= Events.Add_Atom then raise Program_Error; end if; Self.Buffer.Query (Process); end Query_Atom; overriding procedure Read_Atom (Self : in Parser; Data : out Atom; Length : out Count) is begin if Self.Locked or Self.Latest /= Events.Add_Atom then raise Program_Error; end if; Self.Buffer.Peek (Data, Length); end Read_Atom; overriding procedure Next (Self : in out Parser; Event : out Events.Event) is O : Octet; begin if Self.Locked then Event := Events.End_Of_Input; return; end if; Self.Latest := Events.Error; loop -- Process pending events if Self.Next_Event /= Events.End_Of_Input then Self.Latest := Self.Next_Event; Self.Next_Event := Events.End_Of_Input; case Self.Latest is when Events.Open_List => Self.Level := Self.Level + 1; when Events.Close_List => if Self.Level > 0 then Self.Level := Self.Level - 1; end if; when others => null; end case; exit; end if; -- Read a single octet from source if Self.Pending.Length = 0 then Read_More (Parser'Class (Self), Self.Pending); if Self.Pending.Length = 0 then Self.Latest := Events.End_Of_Input; exit; end if; Self.Pending.Invert; end if; Self.Pending.Pop (O); -- Process octet case Self.Internal.State is when Waiting => Self.Buffer.Soft_Reset; case O is when 0 | Encodings.Space | Encodings.HT | Encodings.CR | Encodings.LF | Encodings.VT | Encodings.FF => null; when Encodings.List_Begin => Self.Latest := Events.Open_List; Self.Level := Self.Level + 1; when Encodings.List_End => Self.Latest := Events.Close_List; if Self.Level > 0 then Self.Level := Self.Level - 1; end if; when Encodings.Base64_Atom_Begin => Self.Internal := (State => Base64_Atom, Chunk => (Data => <>, Length => 0)); when Encodings.Base64_Expr_Begin => Self.Internal := (State => Base64_Expr, Chunk => (Data => <>, Length => 0)); when Encodings.Hex_Atom_Begin => Self.Internal := (State => Hex_Atom, Nibble_Buffer => 0); when Encodings.Quoted_Atom_Begin => Self.Internal := (State => Quoted_Atom, Escape => (Data => <>, Length => 0)); when Encodings.Digit_0 .. Encodings.Digit_9 => Self.Internal := (State => Number); Atom_Buffers.Append (Self.Buffer, O); when others => Self.Internal := (State => Token); Atom_Buffers.Append (Self.Buffer, O); end case; when Base64_Atom | Base64_Expr => if Encodings.Is_Base64_Digit (O) then Self.Internal.Chunk.Data (Self.Internal.Chunk.Length) := O; Self.Internal.Chunk.Length := Self.Internal.Chunk.Length + 1; if Self.Internal.Chunk.Length = 4 then Self.Buffer.Append (Encodings.Decode_Base64 (Self.Internal.Chunk.Data)); Self.Internal.Chunk.Length := 0; end if; elsif (O = Encodings.Base64_Atom_End and Self.Internal.State = Base64_Atom) or (O = Encodings.Base64_Expr_End and Self.Internal.State = Base64_Expr) then Self.Buffer.Append (Encodings.Decode_Base64 (Self.Internal.Chunk.Data (0 .. Self.Internal.Chunk.Length - 1))); if Self.Internal.State = Base64_Atom then Self.Latest := Events.Add_Atom; else Self.Pending.Append_Reverse (Self.Buffer.Data); Self.Buffer.Soft_Reset; end if; Self.Internal := (State => Waiting); end if; when Hex_Atom => if Encodings.Is_Hex_Digit (O) then if Encodings.Is_Hex_Digit (Self.Internal.Nibble_Buffer) then Self.Buffer.Append (Encodings.Decode_Hex (Self.Internal.Nibble_Buffer, O)); Self.Internal.Nibble_Buffer := 0; else Self.Internal.Nibble_Buffer := O; end if; elsif O = Encodings.Hex_Atom_End then Self.Latest := Events.Add_Atom; Self.Internal := (State => Waiting); end if; when Number => case O is when Encodings.Digit_0 .. Encodings.Digit_9 => Self.Buffer.Append (O); when Encodings.Verbatim_Begin => Self.Internal := (State => Verbatim_Atom, Size => 0); for I in 1 .. Self.Buffer.Length loop Self.Internal.Size := Self.Internal.Size * 10 + Count (Self.Buffer.Element (I) - Encodings.Digit_0); end loop; Self.Buffer.Soft_Reset; if Self.Internal.Size = 0 then Self.Latest := Events.Add_Atom; Self.Internal := (State => Waiting); else Self.Buffer.Preallocate (Self.Internal.Size); end if; when 0 | Encodings.Space | Encodings.HT | Encodings.CR | Encodings.LF | Encodings.VT | Encodings.FF => Self.Latest := Events.Add_Atom; Self.Internal := (State => Waiting); when Encodings.List_Begin => Self.Internal := (State => Waiting); Self.Next_Event := Events.Open_List; Self.Latest := Events.Add_Atom; when Encodings.List_End => Self.Internal := (State => Waiting); Self.Next_Event := Events.Close_List; Self.Latest := Events.Add_Atom; when Encodings.Base64_Atom_Begin => Self.Internal := (State => Base64_Atom, Chunk => (Data => <>, Length => 0)); Self.Buffer.Soft_Reset; when Encodings.Base64_Expr_Begin => Self.Internal := (State => Base64_Expr, Chunk => (Data => <>, Length => 0)); Self.Buffer.Soft_Reset; when Encodings.Hex_Atom_Begin => Self.Internal := (State => Hex_Atom, Nibble_Buffer => 0); Self.Buffer.Soft_Reset; when Encodings.Quoted_Atom_Begin => Self.Internal := (State => Quoted_Atom, Escape => (Data => <>, Length => 0)); Self.Buffer.Soft_Reset; when others => Self.Buffer.Append (O); Self.Internal := (State => Token); end case; when Quoted_Atom => case Self.Internal.Escape.Length is when 0 => case O is when Encodings.Escape => Self.Internal.Escape.Data (0) := O; Self.Internal.Escape.Length := 1; when Encodings.Quoted_Atom_End => Self.Internal := (State => Waiting); Self.Latest := Events.Add_Atom; when others => Self.Buffer.Append (O); end case; when 1 => case O is when Character'Pos ('b') => Self.Buffer.Append (8); Self.Internal.Escape.Length := 0; when Character'Pos ('t') => Self.Buffer.Append (9); Self.Internal.Escape.Length := 0; when Character'Pos ('n') => Self.Buffer.Append (10); Self.Internal.Escape.Length := 0; when Character'Pos ('v') => Self.Buffer.Append (11); Self.Internal.Escape.Length := 0; when Character'Pos ('f') => Self.Buffer.Append (12); Self.Internal.Escape.Length := 0; when Character'Pos ('r') => Self.Buffer.Append (13); Self.Internal.Escape.Length := 0; when Character'Pos (''') | Encodings.Escape | Encodings.Quoted_Atom_End => Self.Buffer.Append (O); Self.Internal.Escape.Length := 0; when Encodings.Digit_0 .. Encodings.Digit_0 + 3 | Character'Pos ('x') | Encodings.CR | Encodings.LF => Self.Internal.Escape.Data (1) := O; Self.Internal.Escape.Length := 2; when others => Self.Buffer.Append (Self.Internal.Escape.Data (0)); Self.Pending.Append (O); Self.Internal.Escape.Length := 0; end case; when 2 => if (Self.Internal.Escape.Data (1) in Encodings.Digit_0 .. Encodings.Digit_0 + 3 and O in Encodings.Digit_0 .. Encodings.Digit_0 + 7) or (Self.Internal.Escape.Data (1) = Character'Pos ('x') and then Encodings.Is_Hex_Digit (O)) then Self.Internal.Escape.Data (2) := O; Self.Internal.Escape.Length := 3; elsif Self.Internal.Escape.Data (1) = Encodings.CR or Self.Internal.Escape.Data (1) = Encodings.LF then Self.Internal.Escape.Length := 0; if not ((O = Encodings.CR or O = Encodings.LF) and O /= Self.Internal.Escape.Data (1)) then Self.Pending.Append (O); end if; else Self.Buffer.Append ((Self.Internal.Escape.Data (0), Self.Internal.Escape.Data (1))); Self.Pending.Append (O); Self.Internal.Escape.Length := 0; end if; when 3 => if Self.Internal.Escape.Data (1) = Character'Pos ('x') then if Encodings.Is_Hex_Digit (O) then Self.Buffer.Append (Encodings.Decode_Hex (Self.Internal.Escape.Data (2), O)); else Self.Buffer.Append ((Self.Internal.Escape.Data (0), Self.Internal.Escape.Data (1), Self.Internal.Escape.Data (2))); Self.Pending.Append (O); end if; else pragma Assert (Self.Internal.Escape.Data (1) in Encodings.Digit_0 .. Encodings.Digit_0 + 3); if O in Encodings.Digit_0 .. Encodings.Digit_0 + 7 then Atom_Buffers.Append (Self.Buffer, (Self.Internal.Escape.Data (1) - Encodings.Digit_0) * 2**6 + (Self.Internal.Escape.Data (2) - Encodings.Digit_0) * 2**3 + (O - Encodings.Digit_0)); else Self.Buffer.Append ((Self.Internal.Escape.Data (0), Self.Internal.Escape.Data (1), Self.Internal.Escape.Data (2))); Self.Pending.Append (O); end if; end if; Self.Internal.Escape.Length := 0; when 4 => raise Program_Error; end case; when Token => case O is when 0 | Encodings.Space | Encodings.HT | Encodings.CR | Encodings.LF | Encodings.VT | Encodings.FF => Self.Internal := (State => Waiting); Self.Latest := Events.Add_Atom; when Encodings.List_Begin => Self.Internal := (State => Waiting); Self.Next_Event := Events.Open_List; Self.Latest := Events.Add_Atom; when Encodings.List_End => Self.Internal := (State => Waiting); Self.Next_Event := Events.Close_List; Self.Latest := Events.Add_Atom; when others => Self.Buffer.Append (O); end case; when Verbatim_Atom => Self.Buffer.Append (O); pragma Assert (Self.Buffer.Length <= Self.Internal.Size); if Self.Buffer.Length = Self.Internal.Size then Self.Internal := (State => Waiting); Self.Latest := Events.Add_Atom; end if; end case; exit when Self.Latest /= Events.Error; end loop; if Self.Latest = Events.Close_List and then Self.Level < Lockable.Current_Level (Self.Lock_Stack) then Self.Locked := True; Event := Events.End_Of_Input; else Event := Self.Latest; end if; end Next; overriding procedure Lock (Self : in out Parser; State : out Lockable.Lock_State) is begin Lockable.Push_Level (Self.Lock_Stack, Self.Level, State); end Lock; overriding procedure Unlock (Self : in out Parser; State : in out Lockable.Lock_State; Finish : in Boolean := True) is Previous_Level : constant Natural := Lockable.Current_Level (Self.Lock_Stack); Event : Events.Event; begin Lockable.Pop_Level (Self.Lock_Stack, State); State := Lockable.Null_State; if Finish then Event := Self.Current_Event; loop case Event is when Events.Open_List | Events.Add_Atom => null; when Events.Close_List => exit when Self.Level < Previous_Level; when Events.Error | Events.End_Of_Input => exit; end case; Self.Next (Event); end loop; end if; Self.Locked := Self.Level < Lockable.Current_Level (Self.Lock_Stack); end Unlock; ------------------- -- Stream Parser -- ------------------- overriding procedure Read_More (Self : in out Stream_Parser; Buffer : out Atom_Buffers.Atom_Buffer) is Item : Ada.Streams.Stream_Element_Array (1 .. 128); Last : Ada.Streams.Stream_Element_Offset; begin Self.Input.Read (Item, Last); if Last in Item'Range then Buffer.Append (Item (Item'First .. Last)); end if; end Read_More; ------------------- -- Memory Parser -- ------------------- not overriding function Create (Data : in Ada.Streams.Stream_Element_Array) return Memory_Parser is begin return P : Memory_Parser do P.Pending.Append (Data); P.Pending.Invert; end return; end Create; not overriding function Create_From_String (Data : in String) return Memory_Parser is begin return Create (To_Atom (Data)); end Create_From_String; end Natools.S_Expressions.Parsers;
true
------------------------------------------------------------------------------ -- Copyright (c) 2013-2014, PI:NAME:<NAME>END_PI -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Natools.S_Expressions.Encodings; package body Natools.S_Expressions.Parsers is ---------------------- -- Parser Interface -- ---------------------- procedure Reset (Self : in out Parser; Hard : in Boolean := False) is Null_Stack : Lockable.Lock_Stack; begin Self.Internal := (State => Waiting); Self.Next_Event := Events.End_Of_Input; Self.Latest := Events.Error; Self.Level := 0; Self.Lock_Stack := Null_Stack; Self.Locked := False; if Hard then Self.Pending.Hard_Reset; Self.Buffer.Hard_Reset; else Self.Pending.Soft_Reset; Self.Buffer.Soft_Reset; end if; end Reset; overriding function Current_Event (Self : in Parser) return Events.Event is begin if Self.Locked then return Events.End_Of_Input; else return Self.Latest; end if; end Current_Event; overriding function Current_Atom (Self : in Parser) return Atom is begin if Self.Locked or Self.Latest /= Events.Add_Atom then raise Program_Error; end if; return Self.Buffer.Data; end Current_Atom; overriding function Current_Level (Self : in Parser) return Natural is begin if Self.Locked then return 0; else return Self.Level - Lockable.Current_Level (Self.Lock_Stack); end if; end Current_Level; overriding procedure Query_Atom (Self : in Parser; Process : not null access procedure (Data : in Atom)) is begin if Self.Locked or Self.Latest /= Events.Add_Atom then raise Program_Error; end if; Self.Buffer.Query (Process); end Query_Atom; overriding procedure Read_Atom (Self : in Parser; Data : out Atom; Length : out Count) is begin if Self.Locked or Self.Latest /= Events.Add_Atom then raise Program_Error; end if; Self.Buffer.Peek (Data, Length); end Read_Atom; overriding procedure Next (Self : in out Parser; Event : out Events.Event) is O : Octet; begin if Self.Locked then Event := Events.End_Of_Input; return; end if; Self.Latest := Events.Error; loop -- Process pending events if Self.Next_Event /= Events.End_Of_Input then Self.Latest := Self.Next_Event; Self.Next_Event := Events.End_Of_Input; case Self.Latest is when Events.Open_List => Self.Level := Self.Level + 1; when Events.Close_List => if Self.Level > 0 then Self.Level := Self.Level - 1; end if; when others => null; end case; exit; end if; -- Read a single octet from source if Self.Pending.Length = 0 then Read_More (Parser'Class (Self), Self.Pending); if Self.Pending.Length = 0 then Self.Latest := Events.End_Of_Input; exit; end if; Self.Pending.Invert; end if; Self.Pending.Pop (O); -- Process octet case Self.Internal.State is when Waiting => Self.Buffer.Soft_Reset; case O is when 0 | Encodings.Space | Encodings.HT | Encodings.CR | Encodings.LF | Encodings.VT | Encodings.FF => null; when Encodings.List_Begin => Self.Latest := Events.Open_List; Self.Level := Self.Level + 1; when Encodings.List_End => Self.Latest := Events.Close_List; if Self.Level > 0 then Self.Level := Self.Level - 1; end if; when Encodings.Base64_Atom_Begin => Self.Internal := (State => Base64_Atom, Chunk => (Data => <>, Length => 0)); when Encodings.Base64_Expr_Begin => Self.Internal := (State => Base64_Expr, Chunk => (Data => <>, Length => 0)); when Encodings.Hex_Atom_Begin => Self.Internal := (State => Hex_Atom, Nibble_Buffer => 0); when Encodings.Quoted_Atom_Begin => Self.Internal := (State => Quoted_Atom, Escape => (Data => <>, Length => 0)); when Encodings.Digit_0 .. Encodings.Digit_9 => Self.Internal := (State => Number); Atom_Buffers.Append (Self.Buffer, O); when others => Self.Internal := (State => Token); Atom_Buffers.Append (Self.Buffer, O); end case; when Base64_Atom | Base64_Expr => if Encodings.Is_Base64_Digit (O) then Self.Internal.Chunk.Data (Self.Internal.Chunk.Length) := O; Self.Internal.Chunk.Length := Self.Internal.Chunk.Length + 1; if Self.Internal.Chunk.Length = 4 then Self.Buffer.Append (Encodings.Decode_Base64 (Self.Internal.Chunk.Data)); Self.Internal.Chunk.Length := 0; end if; elsif (O = Encodings.Base64_Atom_End and Self.Internal.State = Base64_Atom) or (O = Encodings.Base64_Expr_End and Self.Internal.State = Base64_Expr) then Self.Buffer.Append (Encodings.Decode_Base64 (Self.Internal.Chunk.Data (0 .. Self.Internal.Chunk.Length - 1))); if Self.Internal.State = Base64_Atom then Self.Latest := Events.Add_Atom; else Self.Pending.Append_Reverse (Self.Buffer.Data); Self.Buffer.Soft_Reset; end if; Self.Internal := (State => Waiting); end if; when Hex_Atom => if Encodings.Is_Hex_Digit (O) then if Encodings.Is_Hex_Digit (Self.Internal.Nibble_Buffer) then Self.Buffer.Append (Encodings.Decode_Hex (Self.Internal.Nibble_Buffer, O)); Self.Internal.Nibble_Buffer := 0; else Self.Internal.Nibble_Buffer := O; end if; elsif O = Encodings.Hex_Atom_End then Self.Latest := Events.Add_Atom; Self.Internal := (State => Waiting); end if; when Number => case O is when Encodings.Digit_0 .. Encodings.Digit_9 => Self.Buffer.Append (O); when Encodings.Verbatim_Begin => Self.Internal := (State => Verbatim_Atom, Size => 0); for I in 1 .. Self.Buffer.Length loop Self.Internal.Size := Self.Internal.Size * 10 + Count (Self.Buffer.Element (I) - Encodings.Digit_0); end loop; Self.Buffer.Soft_Reset; if Self.Internal.Size = 0 then Self.Latest := Events.Add_Atom; Self.Internal := (State => Waiting); else Self.Buffer.Preallocate (Self.Internal.Size); end if; when 0 | Encodings.Space | Encodings.HT | Encodings.CR | Encodings.LF | Encodings.VT | Encodings.FF => Self.Latest := Events.Add_Atom; Self.Internal := (State => Waiting); when Encodings.List_Begin => Self.Internal := (State => Waiting); Self.Next_Event := Events.Open_List; Self.Latest := Events.Add_Atom; when Encodings.List_End => Self.Internal := (State => Waiting); Self.Next_Event := Events.Close_List; Self.Latest := Events.Add_Atom; when Encodings.Base64_Atom_Begin => Self.Internal := (State => Base64_Atom, Chunk => (Data => <>, Length => 0)); Self.Buffer.Soft_Reset; when Encodings.Base64_Expr_Begin => Self.Internal := (State => Base64_Expr, Chunk => (Data => <>, Length => 0)); Self.Buffer.Soft_Reset; when Encodings.Hex_Atom_Begin => Self.Internal := (State => Hex_Atom, Nibble_Buffer => 0); Self.Buffer.Soft_Reset; when Encodings.Quoted_Atom_Begin => Self.Internal := (State => Quoted_Atom, Escape => (Data => <>, Length => 0)); Self.Buffer.Soft_Reset; when others => Self.Buffer.Append (O); Self.Internal := (State => Token); end case; when Quoted_Atom => case Self.Internal.Escape.Length is when 0 => case O is when Encodings.Escape => Self.Internal.Escape.Data (0) := O; Self.Internal.Escape.Length := 1; when Encodings.Quoted_Atom_End => Self.Internal := (State => Waiting); Self.Latest := Events.Add_Atom; when others => Self.Buffer.Append (O); end case; when 1 => case O is when Character'Pos ('b') => Self.Buffer.Append (8); Self.Internal.Escape.Length := 0; when Character'Pos ('t') => Self.Buffer.Append (9); Self.Internal.Escape.Length := 0; when Character'Pos ('n') => Self.Buffer.Append (10); Self.Internal.Escape.Length := 0; when Character'Pos ('v') => Self.Buffer.Append (11); Self.Internal.Escape.Length := 0; when Character'Pos ('f') => Self.Buffer.Append (12); Self.Internal.Escape.Length := 0; when Character'Pos ('r') => Self.Buffer.Append (13); Self.Internal.Escape.Length := 0; when Character'Pos (''') | Encodings.Escape | Encodings.Quoted_Atom_End => Self.Buffer.Append (O); Self.Internal.Escape.Length := 0; when Encodings.Digit_0 .. Encodings.Digit_0 + 3 | Character'Pos ('x') | Encodings.CR | Encodings.LF => Self.Internal.Escape.Data (1) := O; Self.Internal.Escape.Length := 2; when others => Self.Buffer.Append (Self.Internal.Escape.Data (0)); Self.Pending.Append (O); Self.Internal.Escape.Length := 0; end case; when 2 => if (Self.Internal.Escape.Data (1) in Encodings.Digit_0 .. Encodings.Digit_0 + 3 and O in Encodings.Digit_0 .. Encodings.Digit_0 + 7) or (Self.Internal.Escape.Data (1) = Character'Pos ('x') and then Encodings.Is_Hex_Digit (O)) then Self.Internal.Escape.Data (2) := O; Self.Internal.Escape.Length := 3; elsif Self.Internal.Escape.Data (1) = Encodings.CR or Self.Internal.Escape.Data (1) = Encodings.LF then Self.Internal.Escape.Length := 0; if not ((O = Encodings.CR or O = Encodings.LF) and O /= Self.Internal.Escape.Data (1)) then Self.Pending.Append (O); end if; else Self.Buffer.Append ((Self.Internal.Escape.Data (0), Self.Internal.Escape.Data (1))); Self.Pending.Append (O); Self.Internal.Escape.Length := 0; end if; when 3 => if Self.Internal.Escape.Data (1) = Character'Pos ('x') then if Encodings.Is_Hex_Digit (O) then Self.Buffer.Append (Encodings.Decode_Hex (Self.Internal.Escape.Data (2), O)); else Self.Buffer.Append ((Self.Internal.Escape.Data (0), Self.Internal.Escape.Data (1), Self.Internal.Escape.Data (2))); Self.Pending.Append (O); end if; else pragma Assert (Self.Internal.Escape.Data (1) in Encodings.Digit_0 .. Encodings.Digit_0 + 3); if O in Encodings.Digit_0 .. Encodings.Digit_0 + 7 then Atom_Buffers.Append (Self.Buffer, (Self.Internal.Escape.Data (1) - Encodings.Digit_0) * 2**6 + (Self.Internal.Escape.Data (2) - Encodings.Digit_0) * 2**3 + (O - Encodings.Digit_0)); else Self.Buffer.Append ((Self.Internal.Escape.Data (0), Self.Internal.Escape.Data (1), Self.Internal.Escape.Data (2))); Self.Pending.Append (O); end if; end if; Self.Internal.Escape.Length := 0; when 4 => raise Program_Error; end case; when Token => case O is when 0 | Encodings.Space | Encodings.HT | Encodings.CR | Encodings.LF | Encodings.VT | Encodings.FF => Self.Internal := (State => Waiting); Self.Latest := Events.Add_Atom; when Encodings.List_Begin => Self.Internal := (State => Waiting); Self.Next_Event := Events.Open_List; Self.Latest := Events.Add_Atom; when Encodings.List_End => Self.Internal := (State => Waiting); Self.Next_Event := Events.Close_List; Self.Latest := Events.Add_Atom; when others => Self.Buffer.Append (O); end case; when Verbatim_Atom => Self.Buffer.Append (O); pragma Assert (Self.Buffer.Length <= Self.Internal.Size); if Self.Buffer.Length = Self.Internal.Size then Self.Internal := (State => Waiting); Self.Latest := Events.Add_Atom; end if; end case; exit when Self.Latest /= Events.Error; end loop; if Self.Latest = Events.Close_List and then Self.Level < Lockable.Current_Level (Self.Lock_Stack) then Self.Locked := True; Event := Events.End_Of_Input; else Event := Self.Latest; end if; end Next; overriding procedure Lock (Self : in out Parser; State : out Lockable.Lock_State) is begin Lockable.Push_Level (Self.Lock_Stack, Self.Level, State); end Lock; overriding procedure Unlock (Self : in out Parser; State : in out Lockable.Lock_State; Finish : in Boolean := True) is Previous_Level : constant Natural := Lockable.Current_Level (Self.Lock_Stack); Event : Events.Event; begin Lockable.Pop_Level (Self.Lock_Stack, State); State := Lockable.Null_State; if Finish then Event := Self.Current_Event; loop case Event is when Events.Open_List | Events.Add_Atom => null; when Events.Close_List => exit when Self.Level < Previous_Level; when Events.Error | Events.End_Of_Input => exit; end case; Self.Next (Event); end loop; end if; Self.Locked := Self.Level < Lockable.Current_Level (Self.Lock_Stack); end Unlock; ------------------- -- Stream Parser -- ------------------- overriding procedure Read_More (Self : in out Stream_Parser; Buffer : out Atom_Buffers.Atom_Buffer) is Item : Ada.Streams.Stream_Element_Array (1 .. 128); Last : Ada.Streams.Stream_Element_Offset; begin Self.Input.Read (Item, Last); if Last in Item'Range then Buffer.Append (Item (Item'First .. Last)); end if; end Read_More; ------------------- -- Memory Parser -- ------------------- not overriding function Create (Data : in Ada.Streams.Stream_Element_Array) return Memory_Parser is begin return P : Memory_Parser do P.Pending.Append (Data); P.Pending.Invert; end return; end Create; not overriding function Create_From_String (Data : in String) return Memory_Parser is begin return Create (To_Atom (Data)); end Create_From_String; end Natools.S_Expressions.Parsers;
[ { "context": "er Events Description\n-- Copyright (C) 2014, 2015 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 167, "score": 0.9998788833618164, "start": 152, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "ight (C) 2014, 2015 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 198, "score": 0.999882698059082, "start": 183, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "5 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 225, "score": 0.9999240040779114, "start": 200, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
mat/src/events/mat-events-tools.ads
stcarrez/mat
7
----------------------------------------------------------------------- -- mat-events-tools - Profiler Events Description -- Copyright (C) 2014, 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Containers.Ordered_Maps; with Ada.Containers.Vectors; package MAT.Events.Tools is Not_Found : exception; package Target_Event_Vectors is new Ada.Containers.Vectors (Positive, Target_Event_Type); subtype Target_Event_Vector is Target_Event_Vectors.Vector; subtype Target_Event_Cursor is Target_Event_Vectors.Cursor; -- Find in the list the first event with the given type. -- Raise <tt>Not_Found</tt> if the list does not contain such event. function Find (List : in Target_Event_Vector; Kind : in Probe_Index_Type) return Target_Event_Type; type Event_Info_Type is record First_Event : Target_Event_Type; Last_Event : Target_Event_Type; Count : Natural := 0; Malloc_Count : Natural := 0; Realloc_Count : Natural := 0; Free_Count : Natural := 0; Alloc_Size : MAT.Types.Target_Size := 0; Free_Size : MAT.Types.Target_Size := 0; end record; -- Collect statistics information about events. procedure Collect_Info (Into : in out Event_Info_Type; Event : in MAT.Events.Target_Event_Type); package Size_Event_Info_Maps is new Ada.Containers.Ordered_Maps (Key_Type => MAT.Types.Target_Size, Element_Type => Event_Info_Type); subtype Size_Event_Info_Map is Size_Event_Info_Maps.Map; subtype Size_Event_Info_Cursor is Size_Event_Info_Maps.Cursor; -- The frame key is composed of the frame address and the frame level. type Frame_Key_Type is record Addr : MAT.Types.Target_Addr; Level : Natural; end record; function "<" (Left, Right : in Frame_Key_Type) return Boolean; -- Ordered map to collect event info statistics by <frame, level> pair. package Frame_Event_Info_Maps is new Ada.Containers.Ordered_Maps (Key_Type => Frame_Key_Type, Element_Type => Event_Info_Type); subtype Frame_Event_Info_Map is Frame_Event_Info_Maps.Map; subtype Frame_Event_Info_Cursor is Frame_Event_Info_Maps.Cursor; package Event_Info_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Event_Info_Type); subtype Event_Info_Vector is Event_Info_Vectors.Vector; subtype Event_Info_Cursor is Event_Info_Vectors.Cursor; -- Extract from the frame info map, the list of event info sorted on the count. procedure Build_Event_Info (Map : in Frame_Event_Info_Map; List : in out Event_Info_Vector); type Frame_Info_Type is record Key : Frame_Key_Type; Info : Event_Info_Type; end record; package Frame_Info_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Frame_Info_Type); subtype Frame_Info_Vector is Frame_Info_Vectors.Vector; subtype Frame_Info_Cursor is Frame_Info_Vectors.Cursor; -- Extract from the frame info map, the list of frame event info sorted -- on the frame level and slot size. procedure Build_Frame_Info (Map : in Frame_Event_Info_Map; List : in out Frame_Info_Vector); end MAT.Events.Tools;
25765
----------------------------------------------------------------------- -- mat-events-tools - Profiler Events Description -- Copyright (C) 2014, 2015 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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.Ordered_Maps; with Ada.Containers.Vectors; package MAT.Events.Tools is Not_Found : exception; package Target_Event_Vectors is new Ada.Containers.Vectors (Positive, Target_Event_Type); subtype Target_Event_Vector is Target_Event_Vectors.Vector; subtype Target_Event_Cursor is Target_Event_Vectors.Cursor; -- Find in the list the first event with the given type. -- Raise <tt>Not_Found</tt> if the list does not contain such event. function Find (List : in Target_Event_Vector; Kind : in Probe_Index_Type) return Target_Event_Type; type Event_Info_Type is record First_Event : Target_Event_Type; Last_Event : Target_Event_Type; Count : Natural := 0; Malloc_Count : Natural := 0; Realloc_Count : Natural := 0; Free_Count : Natural := 0; Alloc_Size : MAT.Types.Target_Size := 0; Free_Size : MAT.Types.Target_Size := 0; end record; -- Collect statistics information about events. procedure Collect_Info (Into : in out Event_Info_Type; Event : in MAT.Events.Target_Event_Type); package Size_Event_Info_Maps is new Ada.Containers.Ordered_Maps (Key_Type => MAT.Types.Target_Size, Element_Type => Event_Info_Type); subtype Size_Event_Info_Map is Size_Event_Info_Maps.Map; subtype Size_Event_Info_Cursor is Size_Event_Info_Maps.Cursor; -- The frame key is composed of the frame address and the frame level. type Frame_Key_Type is record Addr : MAT.Types.Target_Addr; Level : Natural; end record; function "<" (Left, Right : in Frame_Key_Type) return Boolean; -- Ordered map to collect event info statistics by <frame, level> pair. package Frame_Event_Info_Maps is new Ada.Containers.Ordered_Maps (Key_Type => Frame_Key_Type, Element_Type => Event_Info_Type); subtype Frame_Event_Info_Map is Frame_Event_Info_Maps.Map; subtype Frame_Event_Info_Cursor is Frame_Event_Info_Maps.Cursor; package Event_Info_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Event_Info_Type); subtype Event_Info_Vector is Event_Info_Vectors.Vector; subtype Event_Info_Cursor is Event_Info_Vectors.Cursor; -- Extract from the frame info map, the list of event info sorted on the count. procedure Build_Event_Info (Map : in Frame_Event_Info_Map; List : in out Event_Info_Vector); type Frame_Info_Type is record Key : Frame_Key_Type; Info : Event_Info_Type; end record; package Frame_Info_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Frame_Info_Type); subtype Frame_Info_Vector is Frame_Info_Vectors.Vector; subtype Frame_Info_Cursor is Frame_Info_Vectors.Cursor; -- Extract from the frame info map, the list of frame event info sorted -- on the frame level and slot size. procedure Build_Frame_Info (Map : in Frame_Event_Info_Map; List : in out Frame_Info_Vector); end MAT.Events.Tools;
true
----------------------------------------------------------------------- -- mat-events-tools - Profiler Events Description -- Copyright (C) 2014, 2015 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- 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.Ordered_Maps; with Ada.Containers.Vectors; package MAT.Events.Tools is Not_Found : exception; package Target_Event_Vectors is new Ada.Containers.Vectors (Positive, Target_Event_Type); subtype Target_Event_Vector is Target_Event_Vectors.Vector; subtype Target_Event_Cursor is Target_Event_Vectors.Cursor; -- Find in the list the first event with the given type. -- Raise <tt>Not_Found</tt> if the list does not contain such event. function Find (List : in Target_Event_Vector; Kind : in Probe_Index_Type) return Target_Event_Type; type Event_Info_Type is record First_Event : Target_Event_Type; Last_Event : Target_Event_Type; Count : Natural := 0; Malloc_Count : Natural := 0; Realloc_Count : Natural := 0; Free_Count : Natural := 0; Alloc_Size : MAT.Types.Target_Size := 0; Free_Size : MAT.Types.Target_Size := 0; end record; -- Collect statistics information about events. procedure Collect_Info (Into : in out Event_Info_Type; Event : in MAT.Events.Target_Event_Type); package Size_Event_Info_Maps is new Ada.Containers.Ordered_Maps (Key_Type => MAT.Types.Target_Size, Element_Type => Event_Info_Type); subtype Size_Event_Info_Map is Size_Event_Info_Maps.Map; subtype Size_Event_Info_Cursor is Size_Event_Info_Maps.Cursor; -- The frame key is composed of the frame address and the frame level. type Frame_Key_Type is record Addr : MAT.Types.Target_Addr; Level : Natural; end record; function "<" (Left, Right : in Frame_Key_Type) return Boolean; -- Ordered map to collect event info statistics by <frame, level> pair. package Frame_Event_Info_Maps is new Ada.Containers.Ordered_Maps (Key_Type => Frame_Key_Type, Element_Type => Event_Info_Type); subtype Frame_Event_Info_Map is Frame_Event_Info_Maps.Map; subtype Frame_Event_Info_Cursor is Frame_Event_Info_Maps.Cursor; package Event_Info_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Event_Info_Type); subtype Event_Info_Vector is Event_Info_Vectors.Vector; subtype Event_Info_Cursor is Event_Info_Vectors.Cursor; -- Extract from the frame info map, the list of event info sorted on the count. procedure Build_Event_Info (Map : in Frame_Event_Info_Map; List : in out Event_Info_Vector); type Frame_Info_Type is record Key : Frame_Key_Type; Info : Event_Info_Type; end record; package Frame_Info_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Frame_Info_Type); subtype Frame_Info_Vector is Frame_Info_Vectors.Vector; subtype Frame_Info_Cursor is Frame_Info_Vectors.Cursor; -- Extract from the frame info map, the list of frame event info sorted -- on the frame level and slot size. procedure Build_Frame_Info (Map : in Frame_Event_Info_Map; List : in out Frame_Info_Vector); end MAT.Events.Tools;
[ { "context": " --\n-- M A K E G P R --\n-- ", "end": 361, "score": 0.8017712831497192, "start": 348, "tag": "NAME", "value": "M A K E G P R" }, { "context": "an,\n No_Element => False,\n Key => Name_Id,\n Hash => Hash,\n Equal => \"=", "end": 9644, "score": 0.9636292457580566, "start": 9637, "tag": "NAME", "value": "Name_Id" } ]
llvm-gcc-4.2-2.9/gcc/ada/makegpr.adb
vidkidz/crossbridge
1
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- M A K E G P R -- -- -- -- B o d y -- -- -- -- Copyright (C) 2004-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Command_Line; use Ada.Command_Line; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Text_IO; use Ada.Text_IO; with Ada.Unchecked_Deallocation; with Csets; with Gnatvsn; with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Dynamic_Tables; with GNAT.Expect; use GNAT.Expect; with GNAT.HTable; with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.Regpat; use GNAT.Regpat; with Makeutl; use Makeutl; with MLib.Tgt; use MLib.Tgt; with Namet; use Namet; with Output; use Output; with Opt; use Opt; with Osint; use Osint; with Prj; use Prj; with Prj.Pars; with Prj.Util; use Prj.Util; with Snames; use Snames; with System; with System.Case_Util; use System.Case_Util; with Table; with Types; use Types; package body Makegpr is Max_In_Archives : constant := 50; -- The maximum number of arguments for a single invocation of the -- Archive Indexer (ar). No_Argument : aliased Argument_List := (1 .. 0 => null); -- Null argument list representing case of no arguments FD : Process_Descriptor; -- The process descriptor used when invoking a non GNU compiler with -M -- and getting the output with GNAT.Expect. Line_Matcher : constant Pattern_Matcher := Compile ("^.*?\n", Single_Line); -- Pattern for GNAT.Expect for the invocation of a non GNU compiler with -M Name_Ide : Name_Id; Name_Compiler_Command : Name_Id; -- Names of package IDE and its attribute Compiler_Command. -- Set up by Initialize. Unique_Compile : Boolean := False; -- True when switch -u is used on the command line type Source_Index_Rec is record Project : Project_Id; Id : Other_Source_Id; Found : Boolean := False; end record; -- Used as Source_Indexes component to check if archive needs to be rebuilt type Source_Index_Array is array (Positive range <>) of Source_Index_Rec; type Source_Indexes_Ref is access Source_Index_Array; procedure Free is new Ada.Unchecked_Deallocation (Source_Index_Array, Source_Indexes_Ref); Initial_Source_Index_Count : constant Positive := 20; Source_Indexes : Source_Indexes_Ref := new Source_Index_Array (1 .. Initial_Source_Index_Count); -- A list of the Other_Source_Ids of a project file, with an indication -- that they have been found in the archive dependency file. Last_Source : Natural := 0; -- The index of the last valid component of Source_Indexes Compiler_Names : array (First_Language_Indexes) of String_Access; -- The names of the compilers to be used. Set up by Get_Compiler. -- Used to display the commands spawned. Gnatmake_String : constant String_Access := new String'("gnatmake"); GCC_String : constant String_Access := new String'("gcc"); G_Plus_Plus_String : constant String_Access := new String'("g++"); Default_Compiler_Names : constant array (First_Language_Indexes range Ada_Language_Index .. C_Plus_Plus_Language_Index) of String_Access := (Ada_Language_Index => Gnatmake_String, C_Language_Index => GCC_String, C_Plus_Plus_Language_Index => G_Plus_Plus_String); Compiler_Paths : array (First_Language_Indexes) of String_Access; -- The path names of the compiler to be used. Set up by Get_Compiler. -- Used to spawn compiling/linking processes. Compiler_Is_Gcc : array (First_Language_Indexes) of Boolean; -- An indication that a compiler is a GCC compiler, to be able to use -- specific GCC switches. Archive_Builder_Path : String_Access := null; -- The path name of the archive builder (ar). To be used when spawning -- ar commands. Archive_Indexer_Path : String_Access := null; -- The path name of the archive indexer (ranlib), if it exists Copyright_Output : Boolean := False; Usage_Output : Boolean := False; -- Flags to avoid multiple displays of Copyright notice and of Usage Output_File_Name : String_Access := null; -- The name given after a switch -o Output_File_Name_Expected : Boolean := False; -- True when last switch was -o Project_File_Name : String_Access := null; -- The name of the project file specified with switch -P Project_File_Name_Expected : Boolean := False; -- True when last switch was -P Naming_String : aliased String := "naming"; Builder_String : aliased String := "builder"; Compiler_String : aliased String := "compiler"; Binder_String : aliased String := "binder"; Linker_String : aliased String := "linker"; -- Name of packages to be checked when parsing/processing project files List_Of_Packages : aliased String_List := (Naming_String 'Access, Builder_String 'Access, Compiler_String 'Access, Binder_String 'Access, Linker_String 'Access); Packages_To_Check : constant String_List_Access := List_Of_Packages'Access; -- List of the packages to be checked when parsing/processing project files Project_Tree : constant Project_Tree_Ref := new Project_Tree_Data; Main_Project : Project_Id; -- The project id of the main project type Processor is (None, Linker, Compiler); Current_Processor : Processor := None; -- This variable changes when switches -*args are used Current_Language : Language_Index := Ada_Language_Index; -- The compiler language to consider when Processor is Compiler package Comp_Opts is new GNAT.Dynamic_Tables (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100); Options : array (First_Language_Indexes) of Comp_Opts.Instance; -- Tables to store compiling options for the different compilers package Linker_Options is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Makegpr.Linker_Options"); -- Table to store the linking options package Library_Opts is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Makegpr.Library_Opts"); -- Table to store the linking options package Ada_Mains is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Makegpr.Ada_Mains"); -- Table to store the Ada mains, either specified on the command line -- or found in attribute Main of the main project file. package Other_Mains is new Table.Table (Table_Component_Type => Other_Source, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Makegpr.Other_Mains"); -- Table to store the mains of languages other than Ada, either specified -- on the command line or found in attribute Main of the main project file. package Sources_Compiled is new GNAT.HTable.Simple_HTable (Header_Num => Header_Num, Element => Boolean, No_Element => False, Key => Name_Id, Hash => Hash, Equal => "="); package X_Switches is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 2, Table_Increment => 100, Table_Name => "Makegpr.X_Switches"); -- Table to store the -X switches to be passed to gnatmake Initial_Argument_Count : constant Positive := 20; type Boolean_Array is array (Positive range <>) of Boolean; type Booleans is access Boolean_Array; procedure Free is new Ada.Unchecked_Deallocation (Boolean_Array, Booleans); Arguments : Argument_List_Access := new Argument_List (1 .. Initial_Argument_Count); -- Used to store lists of arguments to be used when spawning a process Arguments_Displayed : Booleans := new Boolean_Array (1 .. Initial_Argument_Count); -- For each argument in Arguments, indicate if the argument should be -- displayed when procedure Display_Command is called. Last_Argument : Natural := 0; -- Index of the last valid argument in Arguments package Cache_Args is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 200, Table_Increment => 50, Table_Name => "Makegpr.Cache_Args"); -- A table to cache arguments, to avoid multiple allocation of the same -- strings. It is not possible to use a hash table, because String is -- an unconstrained type. -- Various switches used when spawning processes: Dash_B_String : aliased String := "-B"; Dash_B : constant String_Access := Dash_B_String'Access; Dash_c_String : aliased String := "-c"; Dash_c : constant String_Access := Dash_c_String'Access; Dash_cargs_String : aliased String := "-cargs"; Dash_cargs : constant String_Access := Dash_cargs_String'Access; Dash_d_String : aliased String := "-d"; Dash_d : constant String_Access := Dash_d_String'Access; Dash_f_String : aliased String := "-f"; Dash_f : constant String_Access := Dash_f_String'Access; Dash_k_String : aliased String := "-k"; Dash_k : constant String_Access := Dash_k_String'Access; Dash_largs_String : aliased String := "-largs"; Dash_largs : constant String_Access := Dash_largs_String'Access; Dash_M_String : aliased String := "-M"; Dash_M : constant String_Access := Dash_M_String'Access; Dash_margs_String : aliased String := "-margs"; Dash_margs : constant String_Access := Dash_margs_String'Access; Dash_o_String : aliased String := "-o"; Dash_o : constant String_Access := Dash_o_String'Access; Dash_P_String : aliased String := "-P"; Dash_P : constant String_Access := Dash_P_String'Access; Dash_q_String : aliased String := "-q"; Dash_q : constant String_Access := Dash_q_String'Access; Dash_u_String : aliased String := "-u"; Dash_u : constant String_Access := Dash_u_String'Access; Dash_v_String : aliased String := "-v"; Dash_v : constant String_Access := Dash_v_String'Access; Dash_vP1_String : aliased String := "-vP1"; Dash_vP1 : constant String_Access := Dash_vP1_String'Access; Dash_vP2_String : aliased String := "-vP2"; Dash_vP2 : constant String_Access := Dash_vP2_String'Access; Dash_x_String : aliased String := "-x"; Dash_x : constant String_Access := Dash_x_String'Access; r_String : aliased String := "r"; r : constant String_Access := r_String'Access; CPATH : constant String := "CPATH"; -- The environment variable to set when compiler is a GCC compiler -- to indicate the include directory path. Current_Include_Paths : array (First_Language_Indexes) of String_Access; -- A cache for the paths of included directories, to avoid setting -- env var CPATH unnecessarily. C_Plus_Plus_Is_Used : Boolean := False; -- True when there are sources in C++ Link_Options_Switches : Argument_List_Access := null; -- The link options coming from the attributes Linker'Linker_Options in -- project files imported, directly or indirectly, by the main project. Total_Number_Of_Errors : Natural := 0; -- Used when Keep_Going is True (switch -k) to keep the total number -- of compilation/linking errors, to report at the end of execution. Need_To_Rebuild_Global_Archive : Boolean := False; Error_Header : constant String := "*** ERROR: "; -- The beginning of error message, when Keep_Going is True Need_To_Relink : Boolean := False; -- True when an executable of a language other than Ada need to be linked Global_Archive_Exists : Boolean := False; -- True if there is a non empty global archive, to prevent creation -- of such archives. Path_Option : String_Access; -- The path option switch, when supported package Lib_Path is new Table.Table (Table_Component_Type => Character, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 200, Table_Increment => 50, Table_Name => "Makegpr.Lib_Path"); -- A table to compute the path to put in the path option switch, when it -- is supported. procedure Add_Archives (For_Gnatmake : Boolean); -- Add to Arguments the list of archives for linking an executable procedure Add_Argument (Arg : String_Access; Display : Boolean); procedure Add_Argument (Arg : String; Display : Boolean); -- Add an argument to Arguments. Reallocate if necessary procedure Add_Arguments (Args : Argument_List; Display : Boolean); -- Add a list of arguments to Arguments. Reallocate if necessary procedure Add_Option (Arg : String); -- Add a switch for the Ada, C or C++ compiler, or for the linker. -- The table where this option is stored depends on the values of -- Current_Processor and Current_Language. procedure Add_Search_Directories (Data : Project_Data; Language : First_Language_Indexes); -- Either add to the Arguments the necessary -I switches needed to -- compile, or, when compiler is gcc/g++, set up the C*INCLUDE_PATH -- environment variable, if necessary. procedure Add_Source_Id (Project : Project_Id; Id : Other_Source_Id); -- Add a source id to Source_Indexes, with Found set to False procedure Add_Switches (Data : Project_Data; Proc : Processor; Language : Language_Index; File_Name : Name_Id); -- Add to Arguments the switches, if any, for a source (attribute Switches) -- or language (attribute Default_Switches), coming from package Compiler -- or Linker (depending on Proc) of a specified project file. procedure Build_Global_Archive; -- Build the archive for the main project procedure Build_Library (Project : Project_Id; Unconditionally : Boolean); -- Build the library for a library project. If Unconditionally is -- False, first check if the library is up to date, and build it only -- if it is not. procedure Check (Option : String); -- Check that a switch coming from a project file is not the concatenation -- of several valid switch, for example "-g -v". If it is, issue a warning. procedure Check_Archive_Builder; -- Check if the archive builder (ar) is there procedure Check_Compilation_Needed (Source : Other_Source; Need_To_Compile : out Boolean); -- Check if a source of a language other than Ada needs to be compiled or -- recompiled. procedure Check_For_C_Plus_Plus; -- Check if C++ is used in at least one project procedure Compile (Source_Id : Other_Source_Id; Data : Project_Data; Local_Errors : in out Boolean); -- Compile one non-Ada source procedure Compile_Individual_Sources; -- Compile the sources specified on the command line, when in -- Unique_Compile mode. procedure Compile_Link_With_Gnatmake (Mains_Specified : Boolean); -- Compile/Link with gnatmake when there are Ada sources in the main -- project. Arguments may already contain options to be used by -- gnatmake. Used for both Ada mains and mains of other languages. -- When Compile_Only is True, do not use the linking options procedure Compile_Sources; -- Compile the sources of languages other than Ada, if necessary procedure Copyright; -- Output the Copyright notice procedure Create_Archive_Dependency_File (Name : String; First_Source : Other_Source_Id); -- Create the archive dependency file for a library project procedure Create_Global_Archive_Dependency_File (Name : String); -- Create the archive depenency file for the main project procedure Display_Command (Name : String; Path : String_Access; CPATH : String_Access := null); -- Display the command for a spawned process, if in Verbose_Mode or -- not in Quiet_Output. procedure Get_Compiler (For_Language : First_Language_Indexes); -- Find the compiler name and path name for a specified programming -- language, if not already done. Results are in the corresponding -- elements of arrays Compiler_Names and Compiler_Paths. Name of compiler -- is found in package IDE of the main project, or defaulted. -- Fail if compiler cannot be found on the path. For the Ada language, -- gnatmake, rather than the Ada compiler is returned. procedure Get_Imported_Directories (Project : Project_Id; Data : in out Project_Data); -- Find the necessary switches -I to be used when compiling sources -- of languages other than Ada, in a specified project file. Cache the -- result in component Imported_Directories_Switches of the project data. -- For gcc/g++ compilers, get the value of the C*_INCLUDE_PATH, instead. procedure Initialize; -- Do the necessary package initialization and process the command line -- arguments. function Is_Included_In_Global_Archive (Object_Name : Name_Id; Project : Project_Id) return Boolean; -- Return True if the object Object_Name is not overridden by a source -- in a project extending project Project. procedure Link_Executables; -- Link executables procedure Report_Error (S1 : String; S2 : String := ""; S3 : String := ""); -- Report an error. If Keep_Going is False, just call Osint.Fail. -- If Keep_Going is True, display the error and increase the total number -- of errors. procedure Report_Total_Errors (Kind : String); -- If Total_Number_Of_Errors is not zero, report it, and fail procedure Scan_Arg (Arg : String); -- Process one command line argument function Strip_CR_LF (Text : String) return String; -- Remove characters ASCII.CR and ASCII.LF from a String procedure Usage; -- Display the usage ------------------ -- Add_Archives -- ------------------ procedure Add_Archives (For_Gnatmake : Boolean) is Last_Arg : constant Natural := Last_Argument; -- The position of the last argument before adding the archives. -- Used to reverse the order of the arguments added when processing -- the archives. procedure Recursive_Add_Archives (Project : Project_Id); -- Recursive procedure to add the archive of a project file, if any, -- then call itself for the project imported. ---------------------------- -- Recursive_Add_Archives -- ---------------------------- procedure Recursive_Add_Archives (Project : Project_Id) is Data : Project_Data; Imported : Project_List; Prj : Project_Id; procedure Add_Archive_Path; -- For a library project or the main project, add the archive -- path to the arguments. ---------------------- -- Add_Archive_Path -- ---------------------- procedure Add_Archive_Path is Increment : Positive; Prev_Last : Positive; begin if Data.Library then -- If it is a library project file, nothing to do if -- gnatmake will be invoked, because gnatmake will take -- care of it, even if the library is not an Ada library. if not For_Gnatmake then if Data.Library_Kind = Static then Add_Argument (Get_Name_String (Data.Library_Dir) & Directory_Separator & "lib" & Get_Name_String (Data.Library_Name) & '.' & Archive_Ext, Verbose_Mode); else -- As we first insert in the reverse order, -- -L<dir> is put after -l<lib> Add_Argument ("-l" & Get_Name_String (Data.Library_Name), Verbose_Mode); Get_Name_String (Data.Library_Dir); Add_Argument ("-L" & Name_Buffer (1 .. Name_Len), Verbose_Mode); -- If there is a run path option, prepend this -- directory to the library path. It is probable -- that the order of the directories in the path -- option is not important, but just in case -- put the directories in the same order as the -- libraries. if Path_Option /= null then -- If it is not the first directory, make room -- at the beginning of the table, including -- for a path separator. if Lib_Path.Last > 0 then Increment := Name_Len + 1; Prev_Last := Lib_Path.Last; Lib_Path.Set_Last (Prev_Last + Increment); for Index in reverse 1 .. Prev_Last loop Lib_Path.Table (Index + Increment) := Lib_Path.Table (Index); end loop; Lib_Path.Table (Increment) := Path_Separator; else -- If it is the first directory, just set -- Last to the length of the directory. Lib_Path.Set_Last (Name_Len); end if; -- Put the directory at the beginning of the -- table. for Index in 1 .. Name_Len loop Lib_Path.Table (Index) := Name_Buffer (Index); end loop; end if; end if; end if; -- For a non-library project, the only archive needed -- is the one for the main project, if there is one. elsif Project = Main_Project and then Global_Archive_Exists then Add_Argument (Get_Name_String (Data.Object_Directory) & Directory_Separator & "lib" & Get_Name_String (Data.Name) & '.' & Archive_Ext, Verbose_Mode); end if; end Add_Archive_Path; begin -- Nothing to do when there is no project specified if Project /= No_Project then Data := Project_Tree.Projects.Table (Project); -- Nothing to do if the project has already been processed if not Data.Seen then -- Mark the project as processed, to avoid processing it again Project_Tree.Projects.Table (Project).Seen := True; Recursive_Add_Archives (Data.Extends); Imported := Data.Imported_Projects; -- Call itself recursively for all imported projects while Imported /= Empty_Project_List loop Prj := Project_Tree.Project_Lists.Table (Imported).Project; if Prj /= No_Project then while Project_Tree.Projects.Table (Prj).Extended_By /= No_Project loop Prj := Project_Tree.Projects.Table (Prj).Extended_By; end loop; Recursive_Add_Archives (Prj); end if; Imported := Project_Tree.Project_Lists.Table (Imported).Next; end loop; -- If there is sources of language other than Ada in this -- project, add the path of the archive to Arguments. if Project = Main_Project or else Data.Other_Sources_Present then Add_Archive_Path; end if; end if; end if; end Recursive_Add_Archives; -- Start of processing for Add_Archives begin -- First, mark all projects as not processed for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Project_Tree.Projects.Table (Project).Seen := False; end loop; -- Take care of the run path option if Path_Option = null then Path_Option := MLib.Linker_Library_Path_Option; end if; Lib_Path.Set_Last (0); -- Add archives in the reverse order Recursive_Add_Archives (Main_Project); -- And reverse the order declare First : Positive := Last_Arg + 1; Last : Natural := Last_Argument; Temp : String_Access; begin while First < Last loop Temp := Arguments (First); Arguments (First) := Arguments (Last); Arguments (Last) := Temp; First := First + 1; Last := Last - 1; end loop; end; end Add_Archives; ------------------ -- Add_Argument -- ------------------ procedure Add_Argument (Arg : String_Access; Display : Boolean) is begin -- Nothing to do if no argument is specified or if argument is empty if Arg /= null or else Arg'Length = 0 then -- Reallocate arrays if necessary if Last_Argument = Arguments'Last then declare New_Arguments : constant Argument_List_Access := new Argument_List (1 .. Last_Argument + Initial_Argument_Count); New_Arguments_Displayed : constant Booleans := new Boolean_Array (1 .. Last_Argument + Initial_Argument_Count); begin New_Arguments (Arguments'Range) := Arguments.all; -- To avoid deallocating the strings, nullify all components -- of Arguments before calling Free. Arguments.all := (others => null); Free (Arguments); Arguments := New_Arguments; New_Arguments_Displayed (Arguments_Displayed'Range) := Arguments_Displayed.all; Free (Arguments_Displayed); Arguments_Displayed := New_Arguments_Displayed; end; end if; -- Add the argument and its display indication Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := Arg; Arguments_Displayed (Last_Argument) := Display; end if; end Add_Argument; procedure Add_Argument (Arg : String; Display : Boolean) is Argument : String_Access := null; begin -- Nothing to do if argument is empty if Arg'Length > 0 then -- Check if the argument is already in the Cache_Args table. -- If it is already there, reuse the allocated value. for Index in 1 .. Cache_Args.Last loop if Cache_Args.Table (Index).all = Arg then Argument := Cache_Args.Table (Index); exit; end if; end loop; -- If the argument is not in the cache, create a new entry in the -- cache. if Argument = null then Argument := new String'(Arg); Cache_Args.Increment_Last; Cache_Args.Table (Cache_Args.Last) := Argument; end if; -- And add the argument Add_Argument (Argument, Display); end if; end Add_Argument; ------------------- -- Add_Arguments -- ------------------- procedure Add_Arguments (Args : Argument_List; Display : Boolean) is begin -- Reallocate the arrays, if necessary if Last_Argument + Args'Length > Arguments'Last then declare New_Arguments : constant Argument_List_Access := new Argument_List (1 .. Last_Argument + Args'Length + Initial_Argument_Count); New_Arguments_Displayed : constant Booleans := new Boolean_Array (1 .. Last_Argument + Args'Length + Initial_Argument_Count); begin New_Arguments (1 .. Last_Argument) := Arguments (1 .. Last_Argument); -- To avoid deallocating the strings, nullify all components -- of Arguments before calling Free. Arguments.all := (others => null); Free (Arguments); Arguments := New_Arguments; New_Arguments_Displayed (1 .. Last_Argument) := Arguments_Displayed (1 .. Last_Argument); Free (Arguments_Displayed); Arguments_Displayed := New_Arguments_Displayed; end; end if; -- Add the new arguments and the display indications Arguments (Last_Argument + 1 .. Last_Argument + Args'Length) := Args; Arguments_Displayed (Last_Argument + 1 .. Last_Argument + Args'Length) := (others => Display); Last_Argument := Last_Argument + Args'Length; end Add_Arguments; ---------------- -- Add_Option -- ---------------- procedure Add_Option (Arg : String) is Option : constant String_Access := new String'(Arg); begin case Current_Processor is when None => null; when Linker => -- Add option to the linker table Linker_Options.Increment_Last; Linker_Options.Table (Linker_Options.Last) := Option; when Compiler => -- Add option to the compiler option table, depending on the -- value of Current_Language. Comp_Opts.Increment_Last (Options (Current_Language)); Options (Current_Language).Table (Comp_Opts.Last (Options (Current_Language))) := Option; end case; end Add_Option; ------------------- -- Add_Source_Id -- ------------------- procedure Add_Source_Id (Project : Project_Id; Id : Other_Source_Id) is begin -- Reallocate the array, if necessary if Last_Source = Source_Indexes'Last then declare New_Indexes : constant Source_Indexes_Ref := new Source_Index_Array (1 .. Source_Indexes'Last + Initial_Source_Index_Count); begin New_Indexes (Source_Indexes'Range) := Source_Indexes.all; Free (Source_Indexes); Source_Indexes := New_Indexes; end; end if; Last_Source := Last_Source + 1; Source_Indexes (Last_Source) := (Project, Id, False); end Add_Source_Id; ---------------------------- -- Add_Search_Directories -- ---------------------------- procedure Add_Search_Directories (Data : Project_Data; Language : First_Language_Indexes) is begin -- If a GNU compiler is used, set the CPATH environment variable, -- if it does not already has the correct value. if Compiler_Is_Gcc (Language) then if Current_Include_Paths (Language) /= Data.Include_Path then Current_Include_Paths (Language) := Data.Include_Path; Setenv (CPATH, Data.Include_Path.all); end if; else Add_Arguments (Data.Imported_Directories_Switches.all, Verbose_Mode); end if; end Add_Search_Directories; ------------------ -- Add_Switches -- ------------------ procedure Add_Switches (Data : Project_Data; Proc : Processor; Language : Language_Index; File_Name : Name_Id) is Switches : Variable_Value; -- The switches, if any, for the file/language Pkg : Package_Id; -- The id of the package where to look for the switches Defaults : Array_Element_Id; -- The Default_Switches associative array Switches_Array : Array_Element_Id; -- The Switches associative array Element_Id : String_List_Id; Element : String_Element; begin -- First, choose the proper package case Proc is when None => raise Program_Error; when Linker => Pkg := Value_Of (Name_Linker, Data.Decl.Packages, Project_Tree); when Compiler => Pkg := Value_Of (Name_Compiler, Data.Decl.Packages, Project_Tree); end case; if Pkg /= No_Package then -- Get the Switches ("file name"), if they exist Switches_Array := Prj.Util.Value_Of (Name => Name_Switches, In_Arrays => Project_Tree.Packages.Table (Pkg).Decl.Arrays, In_Tree => Project_Tree); Switches := Prj.Util.Value_Of (Index => File_Name, Src_Index => 0, In_Array => Switches_Array, In_Tree => Project_Tree); -- Otherwise, get the Default_Switches ("language"), if they exist if Switches = Nil_Variable_Value then Defaults := Prj.Util.Value_Of (Name => Name_Default_Switches, In_Arrays => Project_Tree.Packages.Table (Pkg).Decl.Arrays, In_Tree => Project_Tree); Switches := Prj.Util.Value_Of (Index => Language_Names.Table (Language), Src_Index => 0, In_Array => Defaults, In_Tree => Project_Tree); end if; -- If there are switches, add them to Arguments if Switches /= Nil_Variable_Value then Element_Id := Switches.Values; while Element_Id /= Nil_String loop Element := Project_Tree.String_Elements.Table (Element_Id); if Element.Value /= No_Name then Get_Name_String (Element.Value); if not Quiet_Output then -- When not in quiet output (no -q), check that the -- switch is not the concatenation of several valid -- switches, such as "-g -v". If it is, issue a warning. Check (Option => Name_Buffer (1 .. Name_Len)); end if; Add_Argument (Name_Buffer (1 .. Name_Len), True); end if; Element_Id := Element.Next; end loop; end if; end if; end Add_Switches; -------------------------- -- Build_Global_Archive -- -------------------------- procedure Build_Global_Archive is Data : Project_Data := Project_Tree.Projects.Table (Main_Project); Source_Id : Other_Source_Id; S_Id : Other_Source_Id; Source : Other_Source; Success : Boolean; Archive_Name : constant String := "lib" & Get_Name_String (Data.Name) & '.' & Archive_Ext; -- The name of the archive file for this project Archive_Dep_Name : constant String := "lib" & Get_Name_String (Data.Name) & ".deps"; -- The name of the archive dependency file for this project Need_To_Rebuild : Boolean := Need_To_Rebuild_Global_Archive; -- When True, archive will be rebuilt File : Prj.Util.Text_File; Object_Path : Name_Id; Time_Stamp : Time_Stamp_Type; Saved_Last_Argument : Natural; First_Object : Natural; Discard : Boolean; begin Check_Archive_Builder; Change_Dir (Get_Name_String (Data.Object_Directory)); if not Need_To_Rebuild then if Verbose_Mode then Write_Str (" Checking "); Write_Line (Archive_Name); end if; -- If the archive does not exist, of course it needs to be built if not Is_Regular_File (Archive_Name) then Need_To_Rebuild := True; if Verbose_Mode then Write_Line (" -> archive does not exist"); end if; -- Archive does exist else -- Check the archive dependency file Open (File, Archive_Dep_Name); -- If the archive dependency file does not exist, we need to -- to rebuild the archive and to create its dependency file. if not Is_Valid (File) then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Str (Archive_Dep_Name); Write_Line (" does not exist"); end if; else -- Put all sources of language other than Ada in -- Source_Indexes. declare Local_Data : Project_Data; begin Last_Source := 0; for Proj in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Local_Data := Project_Tree.Projects.Table (Proj); if not Local_Data.Library then Source_Id := Local_Data.First_Other_Source; while Source_Id /= No_Other_Source loop Add_Source_Id (Proj, Source_Id); Source_Id := Project_Tree.Other_Sources.Table (Source_Id).Next; end loop; end if; end loop; end; -- Read the dependency file, line by line while not End_Of_File (File) loop Get_Line (File, Name_Buffer, Name_Len); -- First line is the path of the object file Object_Path := Name_Find; Source_Id := No_Other_Source; -- Check if this object file is for a source of this project for S in 1 .. Last_Source loop S_Id := Source_Indexes (S).Id; Source := Project_Tree.Other_Sources.Table (S_Id); if (not Source_Indexes (S).Found) and then Source.Object_Path = Object_Path then -- We have found the object file: get the source -- data, and mark it as found. Source_Id := S_Id; Source_Indexes (S).Found := True; exit; end if; end loop; -- If it is not for a source of this project, then the -- archive needs to be rebuilt. if Source_Id = No_Other_Source then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> "); Write_Str (Get_Name_String (Object_Path)); Write_Line (" is not an object of any project"); end if; exit; end if; -- The second line is the time stamp of the object file. -- If there is no next line, then the dependency file is -- truncated, and the archive need to be rebuilt. if End_Of_File (File) then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Line (" is truncated"); end if; exit; end if; Get_Line (File, Name_Buffer, Name_Len); -- If the line has the wrong number of characters, then -- the dependency file is incorrectly formatted, and the -- archive needs to be rebuilt. if Name_Len /= Time_Stamp_Length then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Line (" is incorrectly formatted (time stamp)"); end if; exit; end if; Time_Stamp := Time_Stamp_Type (Name_Buffer (1 .. Name_Len)); -- If the time stamp in the dependency file is different -- from the time stamp of the object file, then the archive -- needs to be rebuilt. if Time_Stamp /= Source.Object_TS then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> time stamp of "); Write_Str (Get_Name_String (Object_Path)); Write_Str (" is incorrect in the archive"); Write_Line (" dependency file"); end if; exit; end if; end loop; Close (File); end if; end if; end if; if not Need_To_Rebuild then if Verbose_Mode then Write_Line (" -> up to date"); end if; -- No need to create a global archive, if there is no object -- file to put into. Global_Archive_Exists := Last_Source /= 0; -- Archive needs to be rebuilt else -- If archive already exists, first delete it -- Comment needed on why we discard result??? if Is_Regular_File (Archive_Name) then Delete_File (Archive_Name, Discard); end if; Last_Argument := 0; -- Start with the options found in MLib.Tgt (usually just "rc") Add_Arguments (Archive_Builder_Options.all, True); -- Followed by the archive name Add_Argument (Archive_Name, True); First_Object := Last_Argument; -- Followed by all the object files of the non library projects for Proj in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Data := Project_Tree.Projects.Table (Proj); if not Data.Library then Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); -- Only include object file name that have not been -- overriden in extending projects. if Is_Included_In_Global_Archive (Source.Object_Name, Proj) then Add_Argument (Get_Name_String (Source.Object_Path), Verbose_Mode); end if; Source_Id := Source.Next; end loop; end if; end loop; -- No need to create a global archive, if there is no object -- file to put into. Global_Archive_Exists := Last_Argument > First_Object; if Global_Archive_Exists then -- If the archive is built, then linking will need to occur -- unconditionally. Need_To_Relink := True; -- Spawn the archive builder (ar) Saved_Last_Argument := Last_Argument; Last_Argument := First_Object + Max_In_Archives; loop if Last_Argument > Saved_Last_Argument then Last_Argument := Saved_Last_Argument; end if; Display_Command (Archive_Builder, Archive_Builder_Path); Spawn (Archive_Builder_Path.all, Arguments (1 .. Last_Argument), Success); exit when not Success; exit when Last_Argument = Saved_Last_Argument; Arguments (1) := r; Arguments (3 .. Saved_Last_Argument - Last_Argument + 2) := Arguments (Last_Argument + 1 .. Saved_Last_Argument); Saved_Last_Argument := Saved_Last_Argument - Last_Argument + 2; end loop; -- If the archive was built, run the archive indexer (ranlib) -- if there is one. if Success then -- If the archive was built, run the archive indexer (ranlib), -- if there is one. if Archive_Indexer_Path /= null then Last_Argument := 0; Add_Argument (Archive_Name, True); Display_Command (Archive_Indexer, Archive_Indexer_Path); Spawn (Archive_Indexer_Path.all, Arguments (1 .. 1), Success); if not Success then -- Running ranlib failed, delete the dependency file, -- if it exists. if Is_Regular_File (Archive_Dep_Name) then Delete_File (Archive_Dep_Name, Success); end if; -- And report the error Report_Error ("running" & Archive_Indexer & " for project """, Get_Name_String (Data.Name), """ failed"); return; end if; end if; -- The archive was correctly built, create its dependency file Create_Global_Archive_Dependency_File (Archive_Dep_Name); -- Building the archive failed, delete dependency file if one -- exists. else if Is_Regular_File (Archive_Dep_Name) then Delete_File (Archive_Dep_Name, Success); end if; -- And report the error Report_Error ("building archive for project """, Get_Name_String (Data.Name), """ failed"); end if; end if; end if; end Build_Global_Archive; ------------------- -- Build_Library -- ------------------- procedure Build_Library (Project : Project_Id; Unconditionally : Boolean) is Data : constant Project_Data := Project_Tree.Projects.Table (Project); Source_Id : Other_Source_Id; Source : Other_Source; Archive_Name : constant String := "lib" & Get_Name_String (Data.Name) & '.' & Archive_Ext; -- The name of the archive file for this project Archive_Dep_Name : constant String := "lib" & Get_Name_String (Data.Name) & ".deps"; -- The name of the archive dependency file for this project Need_To_Rebuild : Boolean := Unconditionally; -- When True, archive will be rebuilt File : Prj.Util.Text_File; Object_Name : Name_Id; Time_Stamp : Time_Stamp_Type; Driver_Name : Name_Id := No_Name; Lib_Opts : Argument_List_Access := No_Argument'Access; begin Check_Archive_Builder; -- If Unconditionally is False, check if the archive need to be built if not Need_To_Rebuild then if Verbose_Mode then Write_Str (" Checking "); Write_Line (Archive_Name); end if; -- If the archive does not exist, of course it needs to be built if not Is_Regular_File (Archive_Name) then Need_To_Rebuild := True; if Verbose_Mode then Write_Line (" -> archive does not exist"); end if; -- Archive does exist else -- Check the archive dependency file Open (File, Archive_Dep_Name); -- If the archive dependency file does not exist, we need to -- to rebuild the archive and to create its dependency file. if not Is_Valid (File) then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Str (Archive_Dep_Name); Write_Line (" does not exist"); end if; else -- Put all sources of language other than Ada in Source_Indexes Last_Source := 0; Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Add_Source_Id (Project, Source_Id); Source_Id := Project_Tree.Other_Sources.Table (Source_Id).Next; end loop; -- Read the dependency file, line by line while not End_Of_File (File) loop Get_Line (File, Name_Buffer, Name_Len); -- First line is the name of an object file Object_Name := Name_Find; Source_Id := No_Other_Source; -- Check if this object file is for a source of this project for S in 1 .. Last_Source loop if (not Source_Indexes (S).Found) and then Project_Tree.Other_Sources.Table (Source_Indexes (S).Id).Object_Name = Object_Name then -- We have found the object file: get the source -- data, and mark it as found. Source_Id := Source_Indexes (S).Id; Source := Project_Tree.Other_Sources.Table (Source_Id); Source_Indexes (S).Found := True; exit; end if; end loop; -- If it is not for a source of this project, then the -- archive needs to be rebuilt. if Source_Id = No_Other_Source then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> "); Write_Str (Get_Name_String (Object_Name)); Write_Line (" is not an object of the project"); end if; exit; end if; -- The second line is the time stamp of the object file. -- If there is no next line, then the dependency file is -- truncated, and the archive need to be rebuilt. if End_Of_File (File) then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Line (" is truncated"); end if; exit; end if; Get_Line (File, Name_Buffer, Name_Len); -- If the line has the wrong number of character, then -- the dependency file is incorrectly formatted, and the -- archive needs to be rebuilt. if Name_Len /= Time_Stamp_Length then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Line (" is incorrectly formatted (time stamp)"); end if; exit; end if; Time_Stamp := Time_Stamp_Type (Name_Buffer (1 .. Name_Len)); -- If the time stamp in the dependency file is different -- from the time stamp of the object file, then the archive -- needs to be rebuilt. if Time_Stamp /= Source.Object_TS then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> time stamp of "); Write_Str (Get_Name_String (Object_Name)); Write_Str (" is incorrect in the archive"); Write_Line (" dependency file"); end if; exit; end if; end loop; Close (File); if not Need_To_Rebuild then -- Now, check if all object files of the project have been -- accounted for. If any of them is not in the dependency -- file, the archive needs to be rebuilt. for Index in 1 .. Last_Source loop if not Source_Indexes (Index).Found then Need_To_Rebuild := True; if Verbose_Mode then Source_Id := Source_Indexes (Index).Id; Source := Project_Tree.Other_Sources.Table (Source_Id); Write_Str (" -> "); Write_Str (Get_Name_String (Source.Object_Name)); Write_Str (" is not in the archive "); Write_Line ("dependency file"); end if; exit; end if; end loop; end if; if (not Need_To_Rebuild) and Verbose_Mode then Write_Line (" -> up to date"); end if; end if; end if; end if; -- Build the library if necessary if Need_To_Rebuild then -- If a library is built, then linking will need to occur -- unconditionally. Need_To_Relink := True; Last_Argument := 0; -- If there are sources in Ada, then gnatmake will build the -- library, so nothing to do. if not Data.Languages (Ada_Language_Index) then -- Get all the object files of the project Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); Add_Argument (Get_Name_String (Source.Object_Name), Verbose_Mode); Source_Id := Source.Next; end loop; -- If it is a library, it need to be built it the same way -- Ada libraries are built. if Data.Library_Kind = Static then MLib.Build_Library (Ofiles => Arguments (1 .. Last_Argument), Afiles => No_Argument, Output_File => Get_Name_String (Data.Library_Name), Output_Dir => Get_Name_String (Data.Library_Dir)); else -- Link with g++ if C++ is one of the languages, otherwise -- building the library may fail with unresolved symbols. if C_Plus_Plus_Is_Used then if Compiler_Names (C_Plus_Plus_Language_Index) = null then Get_Compiler (C_Plus_Plus_Language_Index); end if; if Compiler_Is_Gcc (C_Plus_Plus_Language_Index) then Name_Len := 0; Add_Str_To_Name_Buffer (Compiler_Names (C_Plus_Plus_Language_Index).all); Driver_Name := Name_Find; end if; end if; -- If Library_Options is specified, add these options declare Library_Options : constant Variable_Value := Value_Of (Name_Library_Options, Data.Decl.Attributes, Project_Tree); begin if not Library_Options.Default then declare Current : String_List_Id := Library_Options.Values; Element : String_Element; begin while Current /= Nil_String loop Element := Project_Tree.String_Elements. Table (Current); Get_Name_String (Element.Value); if Name_Len /= 0 then Library_Opts.Increment_Last; Library_Opts.Table (Library_Opts.Last) := new String'(Name_Buffer (1 .. Name_Len)); end if; Current := Element.Next; end loop; end; end if; Lib_Opts := new Argument_List'(Argument_List (Library_Opts.Table (1 .. Library_Opts.Last))); end; MLib.Tgt.Build_Dynamic_Library (Ofiles => Arguments (1 .. Last_Argument), Foreign => Arguments (1 .. Last_Argument), Afiles => No_Argument, Options => No_Argument, Options_2 => Lib_Opts.all, Interfaces => No_Argument, Lib_Filename => Get_Name_String (Data.Library_Name), Lib_Dir => Get_Name_String (Data.Library_Dir), Symbol_Data => No_Symbols, Driver_Name => Driver_Name, Lib_Version => "", Auto_Init => False); end if; end if; -- Create fake empty archive, so we can check its time stamp later declare Archive : Ada.Text_IO.File_Type; begin Create (Archive, Out_File, Archive_Name); Close (Archive); end; Create_Archive_Dependency_File (Archive_Dep_Name, Data.First_Other_Source); end if; end Build_Library; ----------- -- Check -- ----------- procedure Check (Option : String) is First : Positive := Option'First; Last : Natural; begin for Index in Option'First + 1 .. Option'Last - 1 loop if Option (Index) = ' ' and then Option (Index + 1) = '-' then Write_Str ("warning: switch """); Write_Str (Option); Write_Str (""" is suspicious; consider using "); Last := First; while Last <= Option'Last loop if Option (Last) = ' ' then if First /= Option'First then Write_Str (", "); end if; Write_Char ('"'); Write_Str (Option (First .. Last - 1)); Write_Char ('"'); while Last <= Option'Last and then Option (Last) = ' ' loop Last := Last + 1; end loop; First := Last; else if Last = Option'Last then if First /= Option'First then Write_Str (", "); end if; Write_Char ('"'); Write_Str (Option (First .. Last)); Write_Char ('"'); end if; Last := Last + 1; end if; end loop; Write_Line (" instead"); exit; end if; end loop; end Check; --------------------------- -- Check_Archive_Builder -- --------------------------- procedure Check_Archive_Builder is begin -- First, make sure that the archive builder (ar) is on the path if Archive_Builder_Path = null then Archive_Builder_Path := Locate_Exec_On_Path (Archive_Builder); if Archive_Builder_Path = null then Osint.Fail ("unable to locate archive builder """, Archive_Builder, """"); end if; -- If there is an archive indexer (ranlib), try to locate it on the -- path. Don't fail if it is not found. if Archive_Indexer /= "" then Archive_Indexer_Path := Locate_Exec_On_Path (Archive_Indexer); end if; end if; end Check_Archive_Builder; ------------------------------ -- Check_Compilation_Needed -- ------------------------------ procedure Check_Compilation_Needed (Source : Other_Source; Need_To_Compile : out Boolean) is Source_Name : constant String := Get_Name_String (Source.File_Name); Source_Path : constant String := Get_Name_String (Source.Path_Name); Object_Name : constant String := Get_Name_String (Source.Object_Name); Dep_Name : constant String := Get_Name_String (Source.Dep_Name); Source_In_Dependencies : Boolean := False; -- Set True if source was found in dependency file of its object file Dep_File : Prj.Util.Text_File; Start : Natural; Finish : Natural; begin -- Assume the worst, so that statement "return;" may be used if there -- is any problem. Need_To_Compile := True; if Verbose_Mode then Write_Str (" Checking "); Write_Str (Source_Name); Write_Line (" ... "); end if; -- If object file does not exist, of course source need to be compiled if Source.Object_TS = Empty_Time_Stamp then if Verbose_Mode then Write_Str (" -> object file "); Write_Str (Object_Name); Write_Line (" does not exist"); end if; return; end if; -- If the object file has been created before the last modification -- of the source, the source need to be recompiled. if Source.Object_TS < Source.Source_TS then if Verbose_Mode then Write_Str (" -> object file "); Write_Str (Object_Name); Write_Line (" has time stamp earlier than source"); end if; return; end if; -- If there is no dependency file, then the source needs to be -- recompiled and the dependency file need to be created. if Source.Dep_TS = Empty_Time_Stamp then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" does not exist"); end if; return; end if; -- The source needs to be recompiled if the source has been modified -- after the dependency file has been created. if Source.Dep_TS < Source.Source_TS then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" has time stamp earlier than source"); end if; return; end if; -- Look for all dependencies Open (Dep_File, Dep_Name); -- If dependency file cannot be open, we need to recompile the source if not Is_Valid (Dep_File) then if Verbose_Mode then Write_Str (" -> could not open dependency file "); Write_Line (Dep_Name); end if; return; end if; declare End_Of_File_Reached : Boolean := False; begin loop if End_Of_File (Dep_File) then End_Of_File_Reached := True; exit; end if; Get_Line (Dep_File, Name_Buffer, Name_Len); exit when Name_Len > 0 and then Name_Buffer (1) /= '#'; end loop; -- If dependency file contains only empty lines or comments, then -- dependencies are unknown, and the source needs to be recompiled. if End_Of_File_Reached then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" is empty"); end if; Close (Dep_File); return; end if; end; Start := 1; Finish := Index (Name_Buffer (1 .. Name_Len), ": "); -- First line must start with name of object file, followed by colon if Finish = 0 or else Name_Buffer (1 .. Finish - 1) /= Object_Name then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" has wrong format"); end if; Close (Dep_File); return; else Start := Finish + 2; -- Process each line Line_Loop : loop declare Line : constant String := Name_Buffer (1 .. Name_Len); Last : constant Natural := Name_Len; begin Name_Loop : loop -- Find the beginning of the next source path name while Start < Last and then Line (Start) = ' ' loop Start := Start + 1; end loop; -- Go to next line when there is a continuation character \ -- at the end of the line. exit Name_Loop when Start = Last and then Line (Start) = '\'; -- We should not be at the end of the line, without -- a continuation character \. if Start = Last then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" has wrong format"); end if; Close (Dep_File); return; end if; -- Look for the end of the source path name Finish := Start; while Finish < Last and then Line (Finish + 1) /= ' ' loop Finish := Finish + 1; end loop; -- Check this source declare Src_Name : constant String := Normalize_Pathname (Name => Line (Start .. Finish), Case_Sensitive => False); Src_TS : Time_Stamp_Type; begin -- If it is original source, set Source_In_Dependencies if Src_Name = Source_Path then Source_In_Dependencies := True; end if; Name_Len := 0; Add_Str_To_Name_Buffer (Src_Name); Src_TS := File_Stamp (Name_Find); -- If the source does not exist, we need to recompile if Src_TS = Empty_Time_Stamp then if Verbose_Mode then Write_Str (" -> source "); Write_Str (Src_Name); Write_Line (" does not exist"); end if; Close (Dep_File); return; -- If the source has been modified after the object file, -- we need to recompile. elsif Src_TS > Source.Object_TS then if Verbose_Mode then Write_Str (" -> source "); Write_Str (Src_Name); Write_Line (" has time stamp later than object file"); end if; Close (Dep_File); return; end if; end; -- If the source path name ends the line, we are done exit Line_Loop when Finish = Last; -- Go get the next source on the line Start := Finish + 1; end loop Name_Loop; end; -- If we are here, we had a continuation character \ at the end -- of the line, so we continue with the next line. Get_Line (Dep_File, Name_Buffer, Name_Len); Start := 1; end loop Line_Loop; end if; Close (Dep_File); -- If the original sources were not in the dependency file, then we -- need to recompile. It may mean that we are using a different source -- (different variant) for this object file. if not Source_In_Dependencies then if Verbose_Mode then Write_Str (" -> source "); Write_Str (Source_Path); Write_Line (" is not in the dependencies"); end if; return; end if; -- If we are here, then everything is OK, and we don't need -- to recompile. if Verbose_Mode then Write_Line (" -> up to date"); end if; Need_To_Compile := False; end Check_Compilation_Needed; --------------------------- -- Check_For_C_Plus_Plus -- --------------------------- procedure Check_For_C_Plus_Plus is begin C_Plus_Plus_Is_Used := False; for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop if Project_Tree.Projects.Table (Project).Languages (C_Plus_Plus_Language_Index) then C_Plus_Plus_Is_Used := True; exit; end if; end loop; end Check_For_C_Plus_Plus; ------------- -- Compile -- ------------- procedure Compile (Source_Id : Other_Source_Id; Data : Project_Data; Local_Errors : in out Boolean) is Source : Other_Source := Project_Tree.Other_Sources.Table (Source_Id); Success : Boolean; CPATH : String_Access := null; begin -- If the compiler is not known yet, get its path name if Compiler_Names (Source.Language) = null then Get_Compiler (Source.Language); end if; -- For non GCC compilers, get the dependency file, first calling the -- compiler with the switch -M. if not Compiler_Is_Gcc (Source.Language) then Last_Argument := 0; -- Add the source name, preceded by -M Add_Argument (Dash_M, True); Add_Argument (Get_Name_String (Source.Path_Name), True); -- Add the compiling switches for this source found in -- package Compiler of the project file, if they exist. Add_Switches (Data, Compiler, Source.Language, Source.File_Name); -- Add the compiling switches for the language specified -- on the command line, if any. for J in 1 .. Comp_Opts.Last (Options (Source.Language)) loop Add_Argument (Options (Source.Language).Table (J), True); end loop; -- Finally, add imported directory switches for this project file Add_Search_Directories (Data, Source.Language); -- And invoke the compiler using GNAT.Expect Display_Command (Compiler_Names (Source.Language).all, Compiler_Paths (Source.Language)); begin Non_Blocking_Spawn (FD, Compiler_Paths (Source.Language).all, Arguments (1 .. Last_Argument), Buffer_Size => 0, Err_To_Out => True); declare Dep_File : Ada.Text_IO.File_Type; Result : Expect_Match; Status : Integer; begin -- Create the dependency file Create (Dep_File, Out_File, Get_Name_String (Source.Dep_Name)); loop Expect (FD, Result, Line_Matcher); exit when Result = Expect_Timeout; declare S : constant String := Strip_CR_LF (Expect_Out (FD)); begin -- Each line of the output is put in the dependency -- file, including errors. If there are errors, the -- syntax of the dependency file will be incorrect and -- recompilation will occur automatically the next time -- the dependencies are checked. Put_Line (Dep_File, S); end; end loop; -- If we are here, it means we had a timeout, so the -- dependency file may be incomplete. It is safer to -- delete it, otherwise the dependencies may be wrong. Close (FD, Status); Close (Dep_File); Delete_File (Get_Name_String (Source.Dep_Name), Success); exception when Process_Died => -- This is the normal outcome. Just close the file Close (FD, Status); Close (Dep_File); when others => -- Something wrong happened. It is safer to delete the -- dependency file, otherwise the dependencies may be wrong. Close (FD, Status); if Is_Open (Dep_File) then Close (Dep_File); end if; Delete_File (Get_Name_String (Source.Dep_Name), Success); end; exception -- If we cannot spawn the compiler, then the dependencies are -- not updated. It is safer then to delete the dependency file, -- otherwise the dependencies may be wrong. when Invalid_Process => Delete_File (Get_Name_String (Source.Dep_Name), Success); end; end if; Last_Argument := 0; -- For GCC compilers, make sure the language is always specified to -- to the GCC driver, in case the extension is not recognized by the -- GCC driver as a source of the language. if Compiler_Is_Gcc (Source.Language) then Add_Argument (Dash_x, Verbose_Mode); Add_Argument (Get_Name_String (Language_Names.Table (Source.Language)), Verbose_Mode); end if; Add_Argument (Dash_c, True); -- Add the compiling switches for this source found in -- package Compiler of the project file, if they exist. Add_Switches (Data, Compiler, Source.Language, Source.File_Name); -- Specify the source to be compiled Add_Argument (Get_Name_String (Source.Path_Name), True); -- If non static library project, compile with the PIC option if there -- is one (when there is no PIC option, function MLib.Tgt.PIC_Option -- returns an empty string, and Add_Argument with an empty string has -- no effect). if Data.Library and then Data.Library_Kind /= Static then Add_Argument (PIC_Option, True); end if; -- Indicate the name of the object Add_Argument (Dash_o, True); Add_Argument (Get_Name_String (Source.Object_Name), True); -- When compiler is GCC, use the magic switch that creates -- the dependency file in the correct format. if Compiler_Is_Gcc (Source.Language) then Add_Argument ("-Wp,-MD," & Get_Name_String (Source.Dep_Name), Verbose_Mode); end if; -- Add the compiling switches for the language specified -- on the command line, if any. for J in 1 .. Comp_Opts.Last (Options (Source.Language)) loop Add_Argument (Options (Source.Language).Table (J), True); end loop; -- Finally, add the imported directory switches for this -- project file (or, for gcc compilers, set up the CPATH env var -- if needed). Add_Search_Directories (Data, Source.Language); -- Set CPATH, if compiler is GCC if Compiler_Is_Gcc (Source.Language) then CPATH := Current_Include_Paths (Source.Language); end if; -- And invoke the compiler Display_Command (Name => Compiler_Names (Source.Language).all, Path => Compiler_Paths (Source.Language), CPATH => CPATH); Spawn (Compiler_Paths (Source.Language).all, Arguments (1 .. Last_Argument), Success); -- Case of successful compilation if Success then -- Update the time stamp of the object file Source.Object_TS := File_Stamp (Source.Object_Name); -- Do some sanity checks if Source.Object_TS = Empty_Time_Stamp then Local_Errors := True; Report_Error ("object file ", Get_Name_String (Source.Object_Name), " has not been created"); elsif Source.Object_TS < Source.Source_TS then Local_Errors := True; Report_Error ("object file ", Get_Name_String (Source.Object_Name), " has not been modified"); else -- Everything looks fine, update the Other_Sources table Project_Tree.Other_Sources.Table (Source_Id) := Source; end if; -- Compilation failed else Local_Errors := True; Report_Error ("compilation of ", Get_Name_String (Source.Path_Name), " failed"); end if; end Compile; -------------------------------- -- Compile_Individual_Sources -- -------------------------------- procedure Compile_Individual_Sources is Data : Project_Data := Project_Tree.Projects.Table (Main_Project); Source_Id : Other_Source_Id; Source : Other_Source; Source_Name : Name_Id; Project_Name : String := Get_Name_String (Data.Name); Dummy : Boolean := False; Ada_Is_A_Language : constant Boolean := Data.Languages (Ada_Language_Index); begin Ada_Mains.Init; To_Mixed (Project_Name); Compile_Only := True; Get_Imported_Directories (Main_Project, Data); Project_Tree.Projects.Table (Main_Project) := Data; -- Compilation will occur in the object directory Change_Dir (Get_Name_String (Data.Object_Directory)); if not Data.Other_Sources_Present then if Ada_Is_A_Language then Mains.Reset; loop declare Main : constant String := Mains.Next_Main; begin exit when Main'Length = 0; Ada_Mains.Increment_Last; Ada_Mains.Table (Ada_Mains.Last) := new String'(Main); end; end loop; else Osint.Fail ("project ", Project_Name, " contains no source"); end if; else Mains.Reset; loop declare Main : constant String := Mains.Next_Main; begin Name_Len := Main'Length; exit when Name_Len = 0; Name_Buffer (1 .. Name_Len) := Main; Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Source_Name := Name_Find; if not Sources_Compiled.Get (Source_Name) then Sources_Compiled.Set (Source_Name, True); Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); exit when Source.File_Name = Source_Name; Source_Id := Source.Next; end loop; if Source_Id = No_Other_Source then if Ada_Is_A_Language then Ada_Mains.Increment_Last; Ada_Mains.Table (Ada_Mains.Last) := new String'(Main); else Report_Error (Main, " is not a valid source of project ", Project_Name); end if; else Compile (Source_Id, Data, Dummy); end if; end if; end; end loop; end if; if Ada_Mains.Last > 0 then -- Invoke gnatmake for all Ada sources Last_Argument := 0; Add_Argument (Dash_u, True); for Index in 1 .. Ada_Mains.Last loop Add_Argument (Ada_Mains.Table (Index), True); end loop; Compile_Link_With_Gnatmake (Mains_Specified => False); end if; end Compile_Individual_Sources; -------------------------------- -- Compile_Link_With_Gnatmake -- -------------------------------- procedure Compile_Link_With_Gnatmake (Mains_Specified : Boolean) is Data : constant Project_Data := Project_Tree.Projects.Table (Main_Project); Success : Boolean; begin -- Array Arguments may already contain some arguments, so we don't -- set Last_Argument to 0. -- Get the gnatmake to invoke Get_Compiler (Ada_Language_Index); -- Specify the project file Add_Argument (Dash_P, True); Add_Argument (Get_Name_String (Data.Path_Name), True); -- Add the -X switches, if any for Index in 1 .. X_Switches.Last loop Add_Argument (X_Switches.Table (Index), True); end loop; -- If Mains_Specified is True, find the mains in package Mains if Mains_Specified then Mains.Reset; loop declare Main : constant String := Mains.Next_Main; begin exit when Main'Length = 0; Add_Argument (Main, True); end; end loop; end if; -- Specify output file name, if any was specified on the command line if Output_File_Name /= null then Add_Argument (Dash_o, True); Add_Argument (Output_File_Name, True); end if; -- Transmit some switches to gnatmake -- -c if Compile_Only then Add_Argument (Dash_c, True); end if; -- -d if Display_Compilation_Progress then Add_Argument (Dash_d, True); end if; -- -k if Keep_Going then Add_Argument (Dash_k, True); end if; -- -f if Force_Compilations then Add_Argument (Dash_f, True); end if; -- -v if Verbose_Mode then Add_Argument (Dash_v, True); end if; -- -q if Quiet_Output then Add_Argument (Dash_q, True); end if; -- -vP1 and -vP2 case Current_Verbosity is when Default => null; when Medium => Add_Argument (Dash_vP1, True); when High => Add_Argument (Dash_vP2, True); end case; -- If there are compiling options for Ada, transmit them to gnatmake if Comp_Opts.Last (Options (Ada_Language_Index)) /= 0 then Add_Argument (Dash_cargs, True); for Arg in 1 .. Comp_Opts.Last (Options (Ada_Language_Index)) loop Add_Argument (Options (Ada_Language_Index).Table (Arg), True); end loop; end if; if not Compile_Only then -- Linking options if Linker_Options.Last /= 0 then Add_Argument (Dash_largs, True); else Add_Argument (Dash_largs, Verbose_Mode); end if; -- Add the archives Add_Archives (For_Gnatmake => True); -- If there are linking options from the command line, -- transmit them to gnatmake. for Arg in 1 .. Linker_Options.Last loop Add_Argument (Linker_Options.Table (Arg), True); end loop; end if; -- And invoke gnatmake Display_Command (Compiler_Names (Ada_Language_Index).all, Compiler_Paths (Ada_Language_Index)); Spawn (Compiler_Paths (Ada_Language_Index).all, Arguments (1 .. Last_Argument), Success); -- Report an error if call to gnatmake failed if not Success then Report_Error ("invocation of ", Compiler_Names (Ada_Language_Index).all, " failed"); end if; end Compile_Link_With_Gnatmake; --------------------- -- Compile_Sources -- --------------------- procedure Compile_Sources is Data : Project_Data; Source_Id : Other_Source_Id; Source : Other_Source; Local_Errors : Boolean := False; -- Set to True when there is a compilation error. Used only when -- Keep_Going is True, to inhibit the building of the archive. Need_To_Compile : Boolean; -- Set to True when a source needs to be compiled/recompiled Need_To_Rebuild_Archive : Boolean := Force_Compilations; -- True when the archive needs to be built/rebuilt unconditionally Total_Number_Of_Sources : Int := 0; Current_Source_Number : Int := 0; begin -- First, get the number of sources for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Data := Project_Tree.Projects.Table (Project); if (not Data.Virtual) and then Data.Other_Sources_Present then Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); Total_Number_Of_Sources := Total_Number_Of_Sources + 1; Source_Id := Source.Next; end loop; end if; end loop; -- Loop through project files for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Local_Errors := False; Data := Project_Tree.Projects.Table (Project); -- Nothing to do when no sources of language other than Ada if (not Data.Virtual) and then Data.Other_Sources_Present then -- If the imported directory switches are unknown, compute them if not Data.Include_Data_Set then Get_Imported_Directories (Project, Data); Data.Include_Data_Set := True; Project_Tree.Projects.Table (Project) := Data; end if; Need_To_Rebuild_Archive := Force_Compilations; -- Compilation will occur in the object directory Change_Dir (Get_Name_String (Data.Object_Directory)); Source_Id := Data.First_Other_Source; -- Process each source one by one while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); Current_Source_Number := Current_Source_Number + 1; Need_To_Compile := Force_Compilations; -- Check if compilation is needed if not Need_To_Compile then Check_Compilation_Needed (Source, Need_To_Compile); end if; -- Proceed, if compilation is needed if Need_To_Compile then -- If a source is compiled/recompiled, of course the -- archive will need to be built/rebuilt. Need_To_Rebuild_Archive := True; Compile (Source_Id, Data, Local_Errors); end if; if Display_Compilation_Progress then Write_Str ("completed "); Write_Int (Current_Source_Number); Write_Str (" out of "); Write_Int (Total_Number_Of_Sources); Write_Str (" ("); Write_Int ((Current_Source_Number * 100) / Total_Number_Of_Sources); Write_Str ("%)..."); Write_Eol; end if; -- Next source, if any Source_Id := Source.Next; end loop; if Need_To_Rebuild_Archive and then (not Data.Library) then Need_To_Rebuild_Global_Archive := True; end if; -- If there was no compilation error and -c was not used, -- build / rebuild the archive if necessary. if not Local_Errors and then Data.Library and then not Data.Languages (Ada_Language_Index) and then not Compile_Only then Build_Library (Project, Need_To_Rebuild_Archive); end if; end if; end loop; end Compile_Sources; --------------- -- Copyright -- --------------- procedure Copyright is begin -- Only output the Copyright notice once if not Copyright_Output then Copyright_Output := True; Write_Eol; Write_Str ("GPRMAKE "); Write_Str (Gnatvsn.Gnat_Version_String); Write_Str (" Copyright 2004 Free Software Foundation, Inc."); Write_Eol; end if; end Copyright; ------------------------------------ -- Create_Archive_Dependency_File -- ------------------------------------ procedure Create_Archive_Dependency_File (Name : String; First_Source : Other_Source_Id) is Source_Id : Other_Source_Id := First_Source; Source : Other_Source; Dep_File : Ada.Text_IO.File_Type; begin -- Create the file in Append mode, to avoid automatic insertion of -- an end of line if file is empty. Create (Dep_File, Append_File, Name); while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); Put_Line (Dep_File, Get_Name_String (Source.Object_Name)); Put_Line (Dep_File, String (Source.Object_TS)); Source_Id := Source.Next; end loop; Close (Dep_File); exception when others => if Is_Open (Dep_File) then Close (Dep_File); end if; end Create_Archive_Dependency_File; ------------------------------------------- -- Create_Global_Archive_Dependency_File -- ------------------------------------------- procedure Create_Global_Archive_Dependency_File (Name : String) is Source_Id : Other_Source_Id; Source : Other_Source; Dep_File : Ada.Text_IO.File_Type; begin -- Create the file in Append mode, to avoid automatic insertion of -- an end of line if file is empty. Create (Dep_File, Append_File, Name); -- Get all the object files of non-Ada sources in non-library projects for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop if not Project_Tree.Projects.Table (Project).Library then Source_Id := Project_Tree.Projects.Table (Project).First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); -- Put only those object files that are in the global archive if Is_Included_In_Global_Archive (Source.Object_Name, Project) then Put_Line (Dep_File, Get_Name_String (Source.Object_Path)); Put_Line (Dep_File, String (Source.Object_TS)); end if; Source_Id := Source.Next; end loop; end if; end loop; Close (Dep_File); exception when others => if Is_Open (Dep_File) then Close (Dep_File); end if; end Create_Global_Archive_Dependency_File; --------------------- -- Display_Command -- --------------------- procedure Display_Command (Name : String; Path : String_Access; CPATH : String_Access := null) is begin -- Only display the command in Verbose Mode (-v) or when -- not in Quiet Output (no -q). if Verbose_Mode or (not Quiet_Output) then -- In Verbose Mode output the full path of the spawned process if Verbose_Mode then if CPATH /= null then Write_Str ("CPATH = "); Write_Line (CPATH.all); end if; Write_Str (Path.all); else Write_Str (Name); end if; -- Display only the arguments for which the display flag is set -- (in Verbose Mode, the display flag is set for all arguments) for Arg in 1 .. Last_Argument loop if Arguments_Displayed (Arg) then Write_Char (' '); Write_Str (Arguments (Arg).all); end if; end loop; Write_Eol; end if; end Display_Command; ------------------ -- Get_Compiler -- ------------------ procedure Get_Compiler (For_Language : First_Language_Indexes) is Data : constant Project_Data := Project_Tree.Projects.Table (Main_Project); Ide : constant Package_Id := Value_Of (Name_Ide, In_Packages => Data.Decl.Packages, In_Tree => Project_Tree); -- The id of the package IDE in the project file Compiler : constant Variable_Value := Value_Of (Name => Language_Names.Table (For_Language), Index => 0, Attribute_Or_Array_Name => Name_Compiler_Command, In_Package => Ide, In_Tree => Project_Tree); -- The value of Compiler_Command ("language") in package IDE, if defined begin -- No need to do it again if the compiler is known for this language if Compiler_Names (For_Language) = null then -- If compiler command is not defined for this language in package -- IDE, use the default compiler for this language. if Compiler = Nil_Variable_Value then if For_Language in Default_Compiler_Names'Range then Compiler_Names (For_Language) := Default_Compiler_Names (For_Language); else Osint.Fail ("unknow compiler name for language """, Get_Name_String (Language_Names.Table (For_Language)), """"); end if; else Compiler_Names (For_Language) := new String'(Get_Name_String (Compiler.Value)); end if; -- Check we have a GCC compiler (name ends with "gcc" or "g++") declare Comp_Name : constant String := Compiler_Names (For_Language).all; Last3 : String (1 .. 3); begin if Comp_Name'Length >= 3 then Last3 := Comp_Name (Comp_Name'Last - 2 .. Comp_Name'Last); Compiler_Is_Gcc (For_Language) := (Last3 = "gcc") or (Last3 = "g++"); else Compiler_Is_Gcc (For_Language) := False; end if; end; -- Locate the compiler on the path Compiler_Paths (For_Language) := Locate_Exec_On_Path (Compiler_Names (For_Language).all); -- Fail if compiler cannot be found if Compiler_Paths (For_Language) = null then if For_Language = Ada_Language_Index then Osint.Fail ("unable to locate """, Compiler_Names (For_Language).all, """"); else Osint.Fail ("unable to locate " & Get_Name_String (Language_Names.Table (For_Language)), " compiler """, Compiler_Names (For_Language).all & '"'); end if; end if; end if; end Get_Compiler; ------------------------------ -- Get_Imported_Directories -- ------------------------------ procedure Get_Imported_Directories (Project : Project_Id; Data : in out Project_Data) is Imported_Projects : Project_List := Data.Imported_Projects; Path_Length : Natural := 0; Position : Natural := 0; procedure Add (Source_Dirs : String_List_Id); -- Add a list of source directories procedure Recursive_Get_Dirs (Prj : Project_Id); -- Recursive procedure to get the source directories of this project -- file and of the project files it imports, in the correct order. --------- -- Add -- --------- procedure Add (Source_Dirs : String_List_Id) is Element_Id : String_List_Id := Source_Dirs; Element : String_Element; Add_Arg : Boolean := True; begin -- Add each source directory path name, preceded by "-I" to Arguments while Element_Id /= Nil_String loop Element := Project_Tree.String_Elements.Table (Element_Id); if Element.Value /= No_Name then Get_Name_String (Element.Value); if Name_Len > 0 then -- Remove a trailing directory separator: this may cause -- problems on Windows. if Name_Len > 1 and then Name_Buffer (Name_Len) = Directory_Separator then Name_Len := Name_Len - 1; end if; declare Arg : constant String := "-I" & Name_Buffer (1 .. Name_Len); begin -- Check if directory is already in the list. -- If it is, no need to put it again. for Index in 1 .. Last_Argument loop if Arguments (Index).all = Arg then Add_Arg := False; exit; end if; end loop; if Add_Arg then if Path_Length /= 0 then Path_Length := Path_Length + 1; end if; Path_Length := Path_Length + Name_Len; Add_Argument (Arg, True); end if; end; end if; end if; Element_Id := Element.Next; end loop; end Add; ------------------------ -- Recursive_Get_Dirs -- ------------------------ procedure Recursive_Get_Dirs (Prj : Project_Id) is Data : Project_Data; Imported : Project_List; begin -- Nothing to do if project is undefined if Prj /= No_Project then Data := Project_Tree.Projects.Table (Prj); -- Nothing to do if project has already been processed if not Data.Seen then -- Mark the project as processed, to avoid multiple processing -- of the same project. Project_Tree.Projects.Table (Prj).Seen := True; -- Add the source directories of this project if not Data.Virtual then Add (Data.Source_Dirs); end if; Recursive_Get_Dirs (Data.Extends); Imported := Data.Imported_Projects; -- Call itself for all imported projects, if any while Imported /= Empty_Project_List loop Recursive_Get_Dirs (Project_Tree.Project_Lists.Table (Imported).Project); Imported := Project_Tree.Project_Lists.Table (Imported).Next; end loop; end if; end if; end Recursive_Get_Dirs; -- Start of processing for Get_Imported_Directories begin -- First, mark all project as not processed for J in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Project_Tree.Projects.Table (J).Seen := False; end loop; -- Empty Arguments Last_Argument := 0; -- Process this project individually, project data are already known Project_Tree.Projects.Table (Project).Seen := True; Add (Data.Source_Dirs); Recursive_Get_Dirs (Data.Extends); while Imported_Projects /= Empty_Project_List loop Recursive_Get_Dirs (Project_Tree.Project_Lists.Table (Imported_Projects).Project); Imported_Projects := Project_Tree.Project_Lists.Table (Imported_Projects).Next; end loop; Data.Imported_Directories_Switches := new Argument_List'(Arguments (1 .. Last_Argument)); -- Create the Include_Path, from the Arguments Data.Include_Path := new String (1 .. Path_Length); Data.Include_Path (1 .. Arguments (1)'Length - 2) := Arguments (1)(Arguments (1)'First + 2 .. Arguments (1)'Last); Position := Arguments (1)'Length - 2; for Arg in 2 .. Last_Argument loop Position := Position + 1; Data.Include_Path (Position) := Path_Separator; Data.Include_Path (Position + 1 .. Position + Arguments (Arg)'Length - 2) := Arguments (Arg)(Arguments (Arg)'First + 2 .. Arguments (Arg)'Last); Position := Position + Arguments (Arg)'Length - 2; end loop; Last_Argument := 0; end Get_Imported_Directories; ------------- -- Gprmake -- ------------- procedure Gprmake is begin Makegpr.Initialize; if Verbose_Mode then Write_Eol; Write_Str ("Parsing Project File """); Write_Str (Project_File_Name.all); Write_Str ("""."); Write_Eol; end if; -- Parse and process project files for other languages (not for Ada) Prj.Pars.Parse (Project => Main_Project, In_Tree => Project_Tree, Project_File_Name => Project_File_Name.all, Packages_To_Check => Packages_To_Check); -- Fail if parsing/processing was unsuccessful if Main_Project = No_Project then Osint.Fail ("""", Project_File_Name.all, """ processing failed"); end if; if Verbose_Mode then Write_Eol; Write_Str ("Parsing of Project File """); Write_Str (Project_File_Name.all); Write_Str (""" is finished."); Write_Eol; end if; -- If -f was specified, we will certainly need to link (except when -- -u or -c were specified, of course). Need_To_Relink := Force_Compilations; if Unique_Compile then if Mains.Number_Of_Mains = 0 then Osint.Fail ("No source specified to compile in 'unique compile' mode"); else Compile_Individual_Sources; Report_Total_Errors ("compilation"); end if; else declare Data : constant Prj.Project_Data := Project_Tree.Projects.Table (Main_Project); begin if Data.Library and then Mains.Number_Of_Mains /= 0 then Osint.Fail ("Cannot specify mains on the command line " & "for a Library Project"); end if; -- First check for C++, to link libraries with g++, -- rather than gcc. Check_For_C_Plus_Plus; -- Compile sources and build archives for library project, -- if necessary. Compile_Sources; -- When Keep_Going is True, if we had some errors, fail now, -- reporting the number of compilation errors. -- Do not attempt to link. Report_Total_Errors ("compilation"); -- If -c was not specified, link the executables, -- if there are any. if not Compile_Only and then not Data.Library and then Data.Object_Directory /= No_Name then Build_Global_Archive; Link_Executables; end if; -- When Keep_Going is True, if we had some errors, fail, reporting -- the number of linking errors. Report_Total_Errors ("linking"); end; end if; end Gprmake; ---------------- -- Initialize -- ---------------- procedure Initialize is begin -- Do some necessary package initializations Csets.Initialize; Namet.Initialize; Snames.Initialize; Prj.Initialize (Project_Tree); Mains.Delete; -- Set Name_Ide and Name_Compiler_Command Name_Len := 0; Add_Str_To_Name_Buffer ("ide"); Name_Ide := Name_Find; Name_Len := 0; Add_Str_To_Name_Buffer ("compiler_command"); Name_Compiler_Command := Name_Find; -- Make sure the -X switch table is empty X_Switches.Set_Last (0); -- Get the command line arguments Scan_Args : for Next_Arg in 1 .. Argument_Count loop Scan_Arg (Argument (Next_Arg)); end loop Scan_Args; -- Fail if command line ended with "-P" if Project_File_Name_Expected then Osint.Fail ("project file name missing after -P"); -- Or if it ended with "-o" elsif Output_File_Name_Expected then Osint.Fail ("output file name missing after -o"); end if; -- If no project file was specified, display the usage and fail if Project_File_Name = null then Usage; Exit_Program (E_Success); end if; -- To be able of finding libgnat.a in MLib.Tgt, we need to have the -- default search dirs established in Osint. Osint.Add_Default_Search_Dirs; end Initialize; ----------------------------------- -- Is_Included_In_Global_Archive -- ----------------------------------- function Is_Included_In_Global_Archive (Object_Name : Name_Id; Project : Project_Id) return Boolean is Data : Project_Data := Project_Tree.Projects.Table (Project); Source : Other_Source_Id; begin while Data.Extended_By /= No_Project loop Data := Project_Tree.Projects.Table (Data.Extended_By); Source := Data.First_Other_Source; while Source /= No_Other_Source loop if Project_Tree.Other_Sources.Table (Source).Object_Name = Object_Name then return False; else Source := Project_Tree.Other_Sources.Table (Source).Next; end if; end loop; end loop; return True; end Is_Included_In_Global_Archive; ---------------------- -- Link_Executables -- ---------------------- procedure Link_Executables is Data : constant Project_Data := Project_Tree.Projects.Table (Main_Project); Mains_Specified : constant Boolean := Mains.Number_Of_Mains /= 0; -- True if main sources were specified on the command line Object_Dir : constant String := Get_Name_String (Data.Object_Directory); -- Path of the object directory of the main project Source_Id : Other_Source_Id; Source : Other_Source; Success : Boolean; Linker_Name : String_Access; Linker_Path : String_Access; -- The linker name and path, when linking is not done by gnatlink Link_Done : Boolean := False; -- Set to True when the linker is invoked directly (not through -- gnatmake) to be able to report if mains were up to date at the end -- of execution. procedure Add_C_Plus_Plus_Link_For_Gnatmake; -- Add the --LINK= switch for gnatlink, depending on the C++ compiler procedure Check_Time_Stamps (Exec_Time_Stamp : Time_Stamp_Type); -- Check if there is an archive that is more recent than the executable -- to decide if we need to relink. procedure Choose_C_Plus_Plus_Link_Process; -- If the C++ compiler is not g++, create the correct script to link procedure Link_Foreign (Main : String; Main_Id : Name_Id; Source : Other_Source); -- Link a non-Ada main, when there is no Ada code --------------------------------------- -- Add_C_Plus_Plus_Link_For_Gnatmake -- --------------------------------------- procedure Add_C_Plus_Plus_Link_For_Gnatmake is begin Add_Argument ("--LINK=" & Compiler_Names (C_Plus_Plus_Language_Index).all, Verbose_Mode); end Add_C_Plus_Plus_Link_For_Gnatmake; ----------------------- -- Check_Time_Stamps -- ----------------------- procedure Check_Time_Stamps (Exec_Time_Stamp : Time_Stamp_Type) is Prj_Data : Project_Data; begin for Prj in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Prj_Data := Project_Tree.Projects.Table (Prj); -- There is an archive only in project -- files with sources other than Ada -- sources. if Data.Other_Sources_Present then declare Archive_Path : constant String := Get_Name_String (Prj_Data.Object_Directory) & Directory_Separator & "lib" & Get_Name_String (Prj_Data.Name) & '.' & Archive_Ext; Archive_TS : Time_Stamp_Type; begin Name_Len := 0; Add_Str_To_Name_Buffer (Archive_Path); Archive_TS := File_Stamp (Name_Find); -- If the archive is later than the -- executable, we need to relink. if Archive_TS /= Empty_Time_Stamp and then Exec_Time_Stamp < Archive_TS then Need_To_Relink := True; if Verbose_Mode then Write_Str (" -> "); Write_Str (Archive_Path); Write_Str (" has time stamp "); Write_Str ("later than "); Write_Line ("executable"); end if; exit; end if; end; end if; end loop; end Check_Time_Stamps; ------------------------------------- -- Choose_C_Plus_Plus_Link_Process -- ------------------------------------- procedure Choose_C_Plus_Plus_Link_Process is begin if Compiler_Names (C_Plus_Plus_Language_Index) = null then Get_Compiler (C_Plus_Plus_Language_Index); end if; end Choose_C_Plus_Plus_Link_Process; ------------------ -- Link_Foreign -- ------------------ procedure Link_Foreign (Main : String; Main_Id : Name_Id; Source : Other_Source) is Executable_Name : constant String := Get_Name_String (Executable_Of (Project => Main_Project, In_Tree => Project_Tree, Main => Main_Id, Index => 0, Ada_Main => False)); -- File name of the executable Executable_Path : constant String := Get_Name_String (Data.Exec_Directory) & Directory_Separator & Executable_Name; -- Path name of the executable Exec_Time_Stamp : Time_Stamp_Type; begin -- Now, check if the executable is up to date. It is considered -- up to date if its time stamp is not earlier that the time stamp -- of any archive. Only do that if we don't know if we need to link. if not Need_To_Relink then -- Get the time stamp of the executable Name_Len := 0; Add_Str_To_Name_Buffer (Executable_Path); Exec_Time_Stamp := File_Stamp (Name_Find); if Verbose_Mode then Write_Str (" Checking executable "); Write_Line (Executable_Name); end if; -- If executable does not exist, we need to link if Exec_Time_Stamp = Empty_Time_Stamp then Need_To_Relink := True; if Verbose_Mode then Write_Line (" -> not found"); end if; -- Otherwise, get the time stamps of each archive. If one of -- them is found later than the executable, we need to relink. else Check_Time_Stamps (Exec_Time_Stamp); end if; -- If Need_To_Relink is False, we are done if Verbose_Mode and (not Need_To_Relink) then Write_Line (" -> up to date"); end if; end if; -- Prepare to link if Need_To_Relink then Link_Done := True; Last_Argument := 0; -- Specify the executable path name Add_Argument (Dash_o, True); Add_Argument (Get_Name_String (Data.Exec_Directory) & Directory_Separator & Get_Name_String (Executable_Of (Project => Main_Project, In_Tree => Project_Tree, Main => Main_Id, Index => 0, Ada_Main => False)), True); -- Specify the object file of the main source Add_Argument (Object_Dir & Directory_Separator & Get_Name_String (Source.Object_Name), True); -- Add all the archives, in a correct order Add_Archives (For_Gnatmake => False); -- Add the switches specified in package Linker of -- the main project. Add_Switches (Data => Data, Proc => Linker, Language => Source.Language, File_Name => Main_Id); -- Add the switches specified in attribute -- Linker_Options of packages Linker. if Link_Options_Switches = null then Link_Options_Switches := new Argument_List' (Linker_Options_Switches (Main_Project, Project_Tree)); end if; Add_Arguments (Link_Options_Switches.all, True); -- Add the linking options specified on the -- command line. for Arg in 1 .. Linker_Options.Last loop Add_Argument (Linker_Options.Table (Arg), True); end loop; -- If there are shared libraries and the run path -- option is supported, add the run path switch. if Lib_Path.Last > 0 then Add_Argument (Path_Option.all & String (Lib_Path.Table (1 .. Lib_Path.Last)), Verbose_Mode); end if; -- And invoke the linker Display_Command (Linker_Name.all, Linker_Path); Spawn (Linker_Path.all, Arguments (1 .. Last_Argument), Success); if not Success then Report_Error ("could not link ", Main); end if; end if; end Link_Foreign; -- Start of processing of Link_Executables begin -- If no mains specified, get mains from attribute Main, if it exists if not Mains_Specified then declare Element_Id : String_List_Id := Data.Mains; Element : String_Element; begin while Element_Id /= Nil_String loop Element := Project_Tree.String_Elements.Table (Element_Id); if Element.Value /= No_Name then Mains.Add_Main (Get_Name_String (Element.Value)); end if; Element_Id := Element.Next; end loop; end; end if; if Mains.Number_Of_Mains = 0 then -- If the attribute Main is an empty list or not specified, -- there is nothing to do. if Verbose_Mode then Write_Line ("No main to link"); end if; return; end if; -- Check if -o was used for several mains if Output_File_Name /= null and then Mains.Number_Of_Mains > 1 then Osint.Fail ("cannot specify an executable name for several mains"); end if; -- Check how we are going to do the link if not Data.Other_Sources_Present then -- Only Ada sources in the main project, and even maybe not if not Data.Languages (Ada_Language_Index) then -- Fail if the main project has no source of any language Osint.Fail ("project """, Get_Name_String (Data.Name), """ has no sources, so no main can be linked"); else -- Only Ada sources in the main project, call gnatmake directly Last_Argument := 0; -- Choose correct linker if there is C++ code in other projects if C_Plus_Plus_Is_Used then Choose_C_Plus_Plus_Link_Process; Add_Argument (Dash_largs, Verbose_Mode); Add_C_Plus_Plus_Link_For_Gnatmake; Add_Argument (Dash_margs, Verbose_Mode); end if; Compile_Link_With_Gnatmake (Mains_Specified); end if; else -- There are other language sources. First check if there are also -- sources in Ada. if Data.Languages (Ada_Language_Index) then -- There is a mix of Ada and other language sources in the main -- project. Any main that is not a source of the other languages -- will be deemed to be an Ada main. -- Find the mains of the other languages and the Ada mains Mains.Reset; Ada_Mains.Set_Last (0); Other_Mains.Set_Last (0); -- For each main loop declare Main : constant String := Mains.Next_Main; Main_Id : Name_Id; begin exit when Main'Length = 0; -- Get the main file name Name_Len := 0; Add_Str_To_Name_Buffer (Main); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Main_Id := Name_Find; Source_Id := Data.First_Other_Source; -- Check if it is a source of a language other than Ada while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); exit when Source.File_Name = Main_Id; Source_Id := Source.Next; end loop; -- If it is not, put it in the list of Ada mains if Source_Id = No_Other_Source then Ada_Mains.Increment_Last; Ada_Mains.Table (Ada_Mains.Last) := new String'(Main); -- Otherwise, put it in the list of other mains else Other_Mains.Increment_Last; Other_Mains.Table (Other_Mains.Last) := Source; end if; end; end loop; -- If C++ is one of the other language, create the shell script -- to do the link. if C_Plus_Plus_Is_Used then Choose_C_Plus_Plus_Link_Process; end if; -- Call gnatmake with the necessary switches for each non-Ada -- main, if there are some. for Main in 1 .. Other_Mains.Last loop declare Source : constant Other_Source := Other_Mains.Table (Main); begin Last_Argument := 0; -- Add -o if -o was specified if Output_File_Name = null then Add_Argument (Dash_o, True); Add_Argument (Get_Name_String (Executable_Of (Project => Main_Project, In_Tree => Project_Tree, Main => Other_Mains.Table (Main).File_Name, Index => 0, Ada_Main => False)), True); end if; -- Call gnatmake with the -B switch Add_Argument (Dash_B, True); -- Add to the linking options the object file of the source Add_Argument (Dash_largs, Verbose_Mode); Add_Argument (Get_Name_String (Source.Object_Name), Verbose_Mode); -- If C++ is one of the language, add the --LINK switch -- to the linking switches. if C_Plus_Plus_Is_Used then Add_C_Plus_Plus_Link_For_Gnatmake; end if; -- Add -margs so that the following switches are for -- gnatmake Add_Argument (Dash_margs, Verbose_Mode); -- And link with gnatmake Compile_Link_With_Gnatmake (Mains_Specified => False); end; end loop; -- If there are also Ada mains, call gnatmake for all these mains if Ada_Mains.Last /= 0 then Last_Argument := 0; -- Put all the Ada mains as the first arguments for Main in 1 .. Ada_Mains.Last loop Add_Argument (Ada_Mains.Table (Main).all, True); end loop; -- If C++ is one of the languages, add the --LINK switch to -- the linking switches. if Data.Languages (C_Plus_Plus_Language_Index) then Add_Argument (Dash_largs, Verbose_Mode); Add_C_Plus_Plus_Link_For_Gnatmake; Add_Argument (Dash_margs, Verbose_Mode); end if; -- And link with gnatmake Compile_Link_With_Gnatmake (Mains_Specified => False); end if; else -- No Ada source in main project -- First, get the linker to invoke if Data.Languages (C_Plus_Plus_Language_Index) then Get_Compiler (C_Plus_Plus_Language_Index); Linker_Name := Compiler_Names (C_Plus_Plus_Language_Index); Linker_Path := Compiler_Paths (C_Plus_Plus_Language_Index); else Get_Compiler (C_Language_Index); Linker_Name := Compiler_Names (C_Language_Index); Linker_Path := Compiler_Paths (C_Language_Index); end if; Link_Done := False; Mains.Reset; -- Get each main, check if it is a source of the main project, -- and if it is, invoke the linker. loop declare Main : constant String := Mains.Next_Main; Main_Id : Name_Id; begin exit when Main'Length = 0; -- Get the file name of the main Name_Len := 0; Add_Str_To_Name_Buffer (Main); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Main_Id := Name_Find; Source_Id := Data.First_Other_Source; -- Check if it is a source of the main project file while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); exit when Source.File_Name = Main_Id; Source_Id := Source.Next; end loop; -- Report an error if it is not if Source_Id = No_Other_Source then Report_Error (Main, "is not a source of project ", Get_Name_String (Data.Name)); else Link_Foreign (Main, Main_Id, Source); end if; end; end loop; -- If no linking was done, report it, except in Quiet Output if (Verbose_Mode or (not Quiet_Output)) and (not Link_Done) then Osint.Write_Program_Name; if Mains.Number_Of_Mains = 1 then -- If there is only one executable, report its name too Write_Str (": """); Mains.Reset; declare Main : constant String := Mains.Next_Main; Main_Id : Name_Id; begin Name_Len := 0; Add_Str_To_Name_Buffer (Main); Main_Id := Name_Find; Write_Str (Get_Name_String (Executable_Of (Project => Main_Project, In_Tree => Project_Tree, Main => Main_Id, Index => 0, Ada_Main => False))); Write_Line (""" up to date"); end; else Write_Line (": all executables up to date"); end if; end if; end if; end if; end Link_Executables; ------------------ -- Report_Error -- ------------------ procedure Report_Error (S1 : String; S2 : String := ""; S3 : String := "") is begin -- If Keep_Going is True, output error message preceded by error header if Keep_Going then Total_Number_Of_Errors := Total_Number_Of_Errors + 1; Write_Str (Error_Header); Write_Str (S1); Write_Str (S2); Write_Str (S3); Write_Eol; -- Otherwise just fail else Osint.Fail (S1, S2, S3); end if; end Report_Error; ------------------------- -- Report_Total_Errors -- ------------------------- procedure Report_Total_Errors (Kind : String) is begin if Total_Number_Of_Errors /= 0 then if Total_Number_Of_Errors = 1 then Osint.Fail ("One ", Kind, " error"); else Osint.Fail ("Total of" & Total_Number_Of_Errors'Img, ' ' & Kind & " errors"); end if; end if; end Report_Total_Errors; -------------- -- Scan_Arg -- -------------- procedure Scan_Arg (Arg : String) is begin pragma Assert (Arg'First = 1); if Arg'Length = 0 then return; end if; -- If preceding switch was -P, a project file name need to be -- specified, not a switch. if Project_File_Name_Expected then if Arg (1) = '-' then Osint.Fail ("project file name missing after -P"); else Project_File_Name_Expected := False; Project_File_Name := new String'(Arg); end if; -- If preceding switch was -o, an executable name need to be -- specified, not a switch. elsif Output_File_Name_Expected then if Arg (1) = '-' then Osint.Fail ("output file name missing after -o"); else Output_File_Name_Expected := False; Output_File_Name := new String'(Arg); end if; -- Set the processor/language for the following switches -- -cargs: Ada compiler arguments elsif Arg = "-cargs" then Current_Language := Ada_Language_Index; Current_Processor := Compiler; elsif Arg'Length > 7 and then Arg (1 .. 7) = "-cargs:" then Name_Len := 0; Add_Str_To_Name_Buffer (Arg (8 .. Arg'Last)); To_Lower (Name_Buffer (1 .. Name_Len)); declare Lang : constant Name_Id := Name_Find; begin Current_Language := Language_Indexes.Get (Lang); if Current_Language = No_Language_Index then Add_Language_Name (Lang); Current_Language := Last_Language_Index; end if; Current_Processor := Compiler; end; elsif Arg = "-largs" then Current_Processor := Linker; -- -gargs: gprmake elsif Arg = "-gargs" then Current_Processor := None; -- A special test is needed for the -o switch within a -largs since -- that is another way to specify the name of the final executable. elsif Current_Processor = Linker and then Arg = "-o" then Osint.Fail ("switch -o not allowed within a -largs. Use -o directly."); -- If current processor is not gprmake directly, store the option in -- the appropriate table. elsif Current_Processor /= None then Add_Option (Arg); -- Switches start with '-' elsif Arg (1) = '-' then if Arg = "-c" then Compile_Only := True; -- Make sure that when a main is specified and switch -c is used, -- only the main(s) is/are compiled. if Mains.Number_Of_Mains > 0 then Unique_Compile := True; end if; elsif Arg = "-d" then Display_Compilation_Progress := True; elsif Arg = "-f" then Force_Compilations := True; elsif Arg = "-h" then Usage; elsif Arg = "-k" then Keep_Going := True; elsif Arg = "-o" then if Output_File_Name /= null then Osint.Fail ("cannot specify several -o switches"); else Output_File_Name_Expected := True; end if; elsif Arg'Length >= 2 and then Arg (2) = 'P' then if Project_File_Name /= null then Osint.Fail ("cannot have several project files specified"); elsif Arg'Length = 2 then Project_File_Name_Expected := True; else Project_File_Name := new String'(Arg (3 .. Arg'Last)); end if; elsif Arg = "-q" then Quiet_Output := True; elsif Arg = "-u" then Unique_Compile := True; Compile_Only := True; elsif Arg = "-v" then Verbose_Mode := True; Copyright; elsif Arg'Length = 4 and then Arg (1 .. 3) = "-vP" and then Arg (4) in '0' .. '2' then case Arg (4) is when '0' => Current_Verbosity := Prj.Default; when '1' => Current_Verbosity := Prj.Medium; when '2' => Current_Verbosity := Prj.High; when others => null; end case; elsif Arg'Length >= 3 and then Arg (2) = 'X' and then Is_External_Assignment (Arg) then -- Is_External_Assignment has side effects when it returns True -- Record the -X switch, so that they can be passed to gnatmake, -- if gnatmake is called. X_Switches.Increment_Last; X_Switches.Table (X_Switches.Last) := new String'(Arg); else Osint.Fail ("illegal option """, Arg, """"); end if; else -- Not a switch: must be a main Mains.Add_Main (Arg); -- Make sure that when a main is specified and switch -c is used, -- only the main(s) is/are compiled. if Compile_Only then Unique_Compile := True; end if; end if; end Scan_Arg; ----------------- -- Strip_CR_LF -- ----------------- function Strip_CR_LF (Text : String) return String is To : String (1 .. Text'Length); Index_To : Natural := 0; begin for Index in Text'Range loop if (Text (Index) /= ASCII.CR) and then (Text (Index) /= ASCII.LF) then Index_To := Index_To + 1; To (Index_To) := Text (Index); end if; end loop; return To (1 .. Index_To); end Strip_CR_LF; ----------- -- Usage -- ----------- procedure Usage is begin if not Usage_Output then Usage_Output := True; Copyright; Write_Str ("Usage: "); Osint.Write_Program_Name; Write_Str (" -P<project file> [opts] [name] {"); for Lang in First_Language_Indexes loop Write_Str ("[-cargs:lang opts] "); end loop; Write_Str ("[-largs opts] [-gargs opts]}"); Write_Eol; Write_Eol; Write_Str (" name is zero or more file names"); Write_Eol; Write_Eol; -- GPRMAKE switches Write_Str ("gprmake switches:"); Write_Eol; -- Line for -c Write_Str (" -c Compile only"); Write_Eol; -- Line for -f Write_Str (" -f Force recompilations"); Write_Eol; -- Line for -k Write_Str (" -k Keep going after compilation errors"); Write_Eol; -- Line for -o Write_Str (" -o name Choose an alternate executable name"); Write_Eol; -- Line for -P Write_Str (" -Pproj Use GNAT Project File proj"); Write_Eol; -- Line for -q Write_Str (" -q Be quiet/terse"); Write_Eol; -- Line for -u Write_Str (" -u Unique compilation. Only compile the given files"); Write_Eol; -- Line for -v Write_Str (" -v Verbose output"); Write_Eol; -- Line for -vPx Write_Str (" -vPx Specify verbosity when parsing Project Files"); Write_Eol; -- Line for -X Write_Str (" -Xnm=val Specify an external reference for " & "Project Files"); Write_Eol; Write_Eol; -- Line for -cargs Write_Line (" -cargs opts opts are passed to the Ada compiler"); -- Line for -cargs:lang Write_Line (" -cargs:<lang> opts"); Write_Line (" opts are passed to the compiler " & "for language < lang > "); -- Line for -largs Write_Str (" -largs opts opts are passed to the linker"); Write_Eol; -- Line for -gargs Write_Str (" -gargs opts opts directly interpreted by gprmake"); Write_Eol; Write_Eol; end if; end Usage; begin Makeutl.Do_Fail := Report_Error'Access; end Makegpr;
22180
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- <NAME> -- -- -- -- B o d y -- -- -- -- Copyright (C) 2004-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Command_Line; use Ada.Command_Line; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Text_IO; use Ada.Text_IO; with Ada.Unchecked_Deallocation; with Csets; with Gnatvsn; with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Dynamic_Tables; with GNAT.Expect; use GNAT.Expect; with GNAT.HTable; with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.Regpat; use GNAT.Regpat; with Makeutl; use Makeutl; with MLib.Tgt; use MLib.Tgt; with Namet; use Namet; with Output; use Output; with Opt; use Opt; with Osint; use Osint; with Prj; use Prj; with Prj.Pars; with Prj.Util; use Prj.Util; with Snames; use Snames; with System; with System.Case_Util; use System.Case_Util; with Table; with Types; use Types; package body Makegpr is Max_In_Archives : constant := 50; -- The maximum number of arguments for a single invocation of the -- Archive Indexer (ar). No_Argument : aliased Argument_List := (1 .. 0 => null); -- Null argument list representing case of no arguments FD : Process_Descriptor; -- The process descriptor used when invoking a non GNU compiler with -M -- and getting the output with GNAT.Expect. Line_Matcher : constant Pattern_Matcher := Compile ("^.*?\n", Single_Line); -- Pattern for GNAT.Expect for the invocation of a non GNU compiler with -M Name_Ide : Name_Id; Name_Compiler_Command : Name_Id; -- Names of package IDE and its attribute Compiler_Command. -- Set up by Initialize. Unique_Compile : Boolean := False; -- True when switch -u is used on the command line type Source_Index_Rec is record Project : Project_Id; Id : Other_Source_Id; Found : Boolean := False; end record; -- Used as Source_Indexes component to check if archive needs to be rebuilt type Source_Index_Array is array (Positive range <>) of Source_Index_Rec; type Source_Indexes_Ref is access Source_Index_Array; procedure Free is new Ada.Unchecked_Deallocation (Source_Index_Array, Source_Indexes_Ref); Initial_Source_Index_Count : constant Positive := 20; Source_Indexes : Source_Indexes_Ref := new Source_Index_Array (1 .. Initial_Source_Index_Count); -- A list of the Other_Source_Ids of a project file, with an indication -- that they have been found in the archive dependency file. Last_Source : Natural := 0; -- The index of the last valid component of Source_Indexes Compiler_Names : array (First_Language_Indexes) of String_Access; -- The names of the compilers to be used. Set up by Get_Compiler. -- Used to display the commands spawned. Gnatmake_String : constant String_Access := new String'("gnatmake"); GCC_String : constant String_Access := new String'("gcc"); G_Plus_Plus_String : constant String_Access := new String'("g++"); Default_Compiler_Names : constant array (First_Language_Indexes range Ada_Language_Index .. C_Plus_Plus_Language_Index) of String_Access := (Ada_Language_Index => Gnatmake_String, C_Language_Index => GCC_String, C_Plus_Plus_Language_Index => G_Plus_Plus_String); Compiler_Paths : array (First_Language_Indexes) of String_Access; -- The path names of the compiler to be used. Set up by Get_Compiler. -- Used to spawn compiling/linking processes. Compiler_Is_Gcc : array (First_Language_Indexes) of Boolean; -- An indication that a compiler is a GCC compiler, to be able to use -- specific GCC switches. Archive_Builder_Path : String_Access := null; -- The path name of the archive builder (ar). To be used when spawning -- ar commands. Archive_Indexer_Path : String_Access := null; -- The path name of the archive indexer (ranlib), if it exists Copyright_Output : Boolean := False; Usage_Output : Boolean := False; -- Flags to avoid multiple displays of Copyright notice and of Usage Output_File_Name : String_Access := null; -- The name given after a switch -o Output_File_Name_Expected : Boolean := False; -- True when last switch was -o Project_File_Name : String_Access := null; -- The name of the project file specified with switch -P Project_File_Name_Expected : Boolean := False; -- True when last switch was -P Naming_String : aliased String := "naming"; Builder_String : aliased String := "builder"; Compiler_String : aliased String := "compiler"; Binder_String : aliased String := "binder"; Linker_String : aliased String := "linker"; -- Name of packages to be checked when parsing/processing project files List_Of_Packages : aliased String_List := (Naming_String 'Access, Builder_String 'Access, Compiler_String 'Access, Binder_String 'Access, Linker_String 'Access); Packages_To_Check : constant String_List_Access := List_Of_Packages'Access; -- List of the packages to be checked when parsing/processing project files Project_Tree : constant Project_Tree_Ref := new Project_Tree_Data; Main_Project : Project_Id; -- The project id of the main project type Processor is (None, Linker, Compiler); Current_Processor : Processor := None; -- This variable changes when switches -*args are used Current_Language : Language_Index := Ada_Language_Index; -- The compiler language to consider when Processor is Compiler package Comp_Opts is new GNAT.Dynamic_Tables (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100); Options : array (First_Language_Indexes) of Comp_Opts.Instance; -- Tables to store compiling options for the different compilers package Linker_Options is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Makegpr.Linker_Options"); -- Table to store the linking options package Library_Opts is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Makegpr.Library_Opts"); -- Table to store the linking options package Ada_Mains is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Makegpr.Ada_Mains"); -- Table to store the Ada mains, either specified on the command line -- or found in attribute Main of the main project file. package Other_Mains is new Table.Table (Table_Component_Type => Other_Source, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Makegpr.Other_Mains"); -- Table to store the mains of languages other than Ada, either specified -- on the command line or found in attribute Main of the main project file. package Sources_Compiled is new GNAT.HTable.Simple_HTable (Header_Num => Header_Num, Element => Boolean, No_Element => False, Key => <NAME>, Hash => Hash, Equal => "="); package X_Switches is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 2, Table_Increment => 100, Table_Name => "Makegpr.X_Switches"); -- Table to store the -X switches to be passed to gnatmake Initial_Argument_Count : constant Positive := 20; type Boolean_Array is array (Positive range <>) of Boolean; type Booleans is access Boolean_Array; procedure Free is new Ada.Unchecked_Deallocation (Boolean_Array, Booleans); Arguments : Argument_List_Access := new Argument_List (1 .. Initial_Argument_Count); -- Used to store lists of arguments to be used when spawning a process Arguments_Displayed : Booleans := new Boolean_Array (1 .. Initial_Argument_Count); -- For each argument in Arguments, indicate if the argument should be -- displayed when procedure Display_Command is called. Last_Argument : Natural := 0; -- Index of the last valid argument in Arguments package Cache_Args is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 200, Table_Increment => 50, Table_Name => "Makegpr.Cache_Args"); -- A table to cache arguments, to avoid multiple allocation of the same -- strings. It is not possible to use a hash table, because String is -- an unconstrained type. -- Various switches used when spawning processes: Dash_B_String : aliased String := "-B"; Dash_B : constant String_Access := Dash_B_String'Access; Dash_c_String : aliased String := "-c"; Dash_c : constant String_Access := Dash_c_String'Access; Dash_cargs_String : aliased String := "-cargs"; Dash_cargs : constant String_Access := Dash_cargs_String'Access; Dash_d_String : aliased String := "-d"; Dash_d : constant String_Access := Dash_d_String'Access; Dash_f_String : aliased String := "-f"; Dash_f : constant String_Access := Dash_f_String'Access; Dash_k_String : aliased String := "-k"; Dash_k : constant String_Access := Dash_k_String'Access; Dash_largs_String : aliased String := "-largs"; Dash_largs : constant String_Access := Dash_largs_String'Access; Dash_M_String : aliased String := "-M"; Dash_M : constant String_Access := Dash_M_String'Access; Dash_margs_String : aliased String := "-margs"; Dash_margs : constant String_Access := Dash_margs_String'Access; Dash_o_String : aliased String := "-o"; Dash_o : constant String_Access := Dash_o_String'Access; Dash_P_String : aliased String := "-P"; Dash_P : constant String_Access := Dash_P_String'Access; Dash_q_String : aliased String := "-q"; Dash_q : constant String_Access := Dash_q_String'Access; Dash_u_String : aliased String := "-u"; Dash_u : constant String_Access := Dash_u_String'Access; Dash_v_String : aliased String := "-v"; Dash_v : constant String_Access := Dash_v_String'Access; Dash_vP1_String : aliased String := "-vP1"; Dash_vP1 : constant String_Access := Dash_vP1_String'Access; Dash_vP2_String : aliased String := "-vP2"; Dash_vP2 : constant String_Access := Dash_vP2_String'Access; Dash_x_String : aliased String := "-x"; Dash_x : constant String_Access := Dash_x_String'Access; r_String : aliased String := "r"; r : constant String_Access := r_String'Access; CPATH : constant String := "CPATH"; -- The environment variable to set when compiler is a GCC compiler -- to indicate the include directory path. Current_Include_Paths : array (First_Language_Indexes) of String_Access; -- A cache for the paths of included directories, to avoid setting -- env var CPATH unnecessarily. C_Plus_Plus_Is_Used : Boolean := False; -- True when there are sources in C++ Link_Options_Switches : Argument_List_Access := null; -- The link options coming from the attributes Linker'Linker_Options in -- project files imported, directly or indirectly, by the main project. Total_Number_Of_Errors : Natural := 0; -- Used when Keep_Going is True (switch -k) to keep the total number -- of compilation/linking errors, to report at the end of execution. Need_To_Rebuild_Global_Archive : Boolean := False; Error_Header : constant String := "*** ERROR: "; -- The beginning of error message, when Keep_Going is True Need_To_Relink : Boolean := False; -- True when an executable of a language other than Ada need to be linked Global_Archive_Exists : Boolean := False; -- True if there is a non empty global archive, to prevent creation -- of such archives. Path_Option : String_Access; -- The path option switch, when supported package Lib_Path is new Table.Table (Table_Component_Type => Character, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 200, Table_Increment => 50, Table_Name => "Makegpr.Lib_Path"); -- A table to compute the path to put in the path option switch, when it -- is supported. procedure Add_Archives (For_Gnatmake : Boolean); -- Add to Arguments the list of archives for linking an executable procedure Add_Argument (Arg : String_Access; Display : Boolean); procedure Add_Argument (Arg : String; Display : Boolean); -- Add an argument to Arguments. Reallocate if necessary procedure Add_Arguments (Args : Argument_List; Display : Boolean); -- Add a list of arguments to Arguments. Reallocate if necessary procedure Add_Option (Arg : String); -- Add a switch for the Ada, C or C++ compiler, or for the linker. -- The table where this option is stored depends on the values of -- Current_Processor and Current_Language. procedure Add_Search_Directories (Data : Project_Data; Language : First_Language_Indexes); -- Either add to the Arguments the necessary -I switches needed to -- compile, or, when compiler is gcc/g++, set up the C*INCLUDE_PATH -- environment variable, if necessary. procedure Add_Source_Id (Project : Project_Id; Id : Other_Source_Id); -- Add a source id to Source_Indexes, with Found set to False procedure Add_Switches (Data : Project_Data; Proc : Processor; Language : Language_Index; File_Name : Name_Id); -- Add to Arguments the switches, if any, for a source (attribute Switches) -- or language (attribute Default_Switches), coming from package Compiler -- or Linker (depending on Proc) of a specified project file. procedure Build_Global_Archive; -- Build the archive for the main project procedure Build_Library (Project : Project_Id; Unconditionally : Boolean); -- Build the library for a library project. If Unconditionally is -- False, first check if the library is up to date, and build it only -- if it is not. procedure Check (Option : String); -- Check that a switch coming from a project file is not the concatenation -- of several valid switch, for example "-g -v". If it is, issue a warning. procedure Check_Archive_Builder; -- Check if the archive builder (ar) is there procedure Check_Compilation_Needed (Source : Other_Source; Need_To_Compile : out Boolean); -- Check if a source of a language other than Ada needs to be compiled or -- recompiled. procedure Check_For_C_Plus_Plus; -- Check if C++ is used in at least one project procedure Compile (Source_Id : Other_Source_Id; Data : Project_Data; Local_Errors : in out Boolean); -- Compile one non-Ada source procedure Compile_Individual_Sources; -- Compile the sources specified on the command line, when in -- Unique_Compile mode. procedure Compile_Link_With_Gnatmake (Mains_Specified : Boolean); -- Compile/Link with gnatmake when there are Ada sources in the main -- project. Arguments may already contain options to be used by -- gnatmake. Used for both Ada mains and mains of other languages. -- When Compile_Only is True, do not use the linking options procedure Compile_Sources; -- Compile the sources of languages other than Ada, if necessary procedure Copyright; -- Output the Copyright notice procedure Create_Archive_Dependency_File (Name : String; First_Source : Other_Source_Id); -- Create the archive dependency file for a library project procedure Create_Global_Archive_Dependency_File (Name : String); -- Create the archive depenency file for the main project procedure Display_Command (Name : String; Path : String_Access; CPATH : String_Access := null); -- Display the command for a spawned process, if in Verbose_Mode or -- not in Quiet_Output. procedure Get_Compiler (For_Language : First_Language_Indexes); -- Find the compiler name and path name for a specified programming -- language, if not already done. Results are in the corresponding -- elements of arrays Compiler_Names and Compiler_Paths. Name of compiler -- is found in package IDE of the main project, or defaulted. -- Fail if compiler cannot be found on the path. For the Ada language, -- gnatmake, rather than the Ada compiler is returned. procedure Get_Imported_Directories (Project : Project_Id; Data : in out Project_Data); -- Find the necessary switches -I to be used when compiling sources -- of languages other than Ada, in a specified project file. Cache the -- result in component Imported_Directories_Switches of the project data. -- For gcc/g++ compilers, get the value of the C*_INCLUDE_PATH, instead. procedure Initialize; -- Do the necessary package initialization and process the command line -- arguments. function Is_Included_In_Global_Archive (Object_Name : Name_Id; Project : Project_Id) return Boolean; -- Return True if the object Object_Name is not overridden by a source -- in a project extending project Project. procedure Link_Executables; -- Link executables procedure Report_Error (S1 : String; S2 : String := ""; S3 : String := ""); -- Report an error. If Keep_Going is False, just call Osint.Fail. -- If Keep_Going is True, display the error and increase the total number -- of errors. procedure Report_Total_Errors (Kind : String); -- If Total_Number_Of_Errors is not zero, report it, and fail procedure Scan_Arg (Arg : String); -- Process one command line argument function Strip_CR_LF (Text : String) return String; -- Remove characters ASCII.CR and ASCII.LF from a String procedure Usage; -- Display the usage ------------------ -- Add_Archives -- ------------------ procedure Add_Archives (For_Gnatmake : Boolean) is Last_Arg : constant Natural := Last_Argument; -- The position of the last argument before adding the archives. -- Used to reverse the order of the arguments added when processing -- the archives. procedure Recursive_Add_Archives (Project : Project_Id); -- Recursive procedure to add the archive of a project file, if any, -- then call itself for the project imported. ---------------------------- -- Recursive_Add_Archives -- ---------------------------- procedure Recursive_Add_Archives (Project : Project_Id) is Data : Project_Data; Imported : Project_List; Prj : Project_Id; procedure Add_Archive_Path; -- For a library project or the main project, add the archive -- path to the arguments. ---------------------- -- Add_Archive_Path -- ---------------------- procedure Add_Archive_Path is Increment : Positive; Prev_Last : Positive; begin if Data.Library then -- If it is a library project file, nothing to do if -- gnatmake will be invoked, because gnatmake will take -- care of it, even if the library is not an Ada library. if not For_Gnatmake then if Data.Library_Kind = Static then Add_Argument (Get_Name_String (Data.Library_Dir) & Directory_Separator & "lib" & Get_Name_String (Data.Library_Name) & '.' & Archive_Ext, Verbose_Mode); else -- As we first insert in the reverse order, -- -L<dir> is put after -l<lib> Add_Argument ("-l" & Get_Name_String (Data.Library_Name), Verbose_Mode); Get_Name_String (Data.Library_Dir); Add_Argument ("-L" & Name_Buffer (1 .. Name_Len), Verbose_Mode); -- If there is a run path option, prepend this -- directory to the library path. It is probable -- that the order of the directories in the path -- option is not important, but just in case -- put the directories in the same order as the -- libraries. if Path_Option /= null then -- If it is not the first directory, make room -- at the beginning of the table, including -- for a path separator. if Lib_Path.Last > 0 then Increment := Name_Len + 1; Prev_Last := Lib_Path.Last; Lib_Path.Set_Last (Prev_Last + Increment); for Index in reverse 1 .. Prev_Last loop Lib_Path.Table (Index + Increment) := Lib_Path.Table (Index); end loop; Lib_Path.Table (Increment) := Path_Separator; else -- If it is the first directory, just set -- Last to the length of the directory. Lib_Path.Set_Last (Name_Len); end if; -- Put the directory at the beginning of the -- table. for Index in 1 .. Name_Len loop Lib_Path.Table (Index) := Name_Buffer (Index); end loop; end if; end if; end if; -- For a non-library project, the only archive needed -- is the one for the main project, if there is one. elsif Project = Main_Project and then Global_Archive_Exists then Add_Argument (Get_Name_String (Data.Object_Directory) & Directory_Separator & "lib" & Get_Name_String (Data.Name) & '.' & Archive_Ext, Verbose_Mode); end if; end Add_Archive_Path; begin -- Nothing to do when there is no project specified if Project /= No_Project then Data := Project_Tree.Projects.Table (Project); -- Nothing to do if the project has already been processed if not Data.Seen then -- Mark the project as processed, to avoid processing it again Project_Tree.Projects.Table (Project).Seen := True; Recursive_Add_Archives (Data.Extends); Imported := Data.Imported_Projects; -- Call itself recursively for all imported projects while Imported /= Empty_Project_List loop Prj := Project_Tree.Project_Lists.Table (Imported).Project; if Prj /= No_Project then while Project_Tree.Projects.Table (Prj).Extended_By /= No_Project loop Prj := Project_Tree.Projects.Table (Prj).Extended_By; end loop; Recursive_Add_Archives (Prj); end if; Imported := Project_Tree.Project_Lists.Table (Imported).Next; end loop; -- If there is sources of language other than Ada in this -- project, add the path of the archive to Arguments. if Project = Main_Project or else Data.Other_Sources_Present then Add_Archive_Path; end if; end if; end if; end Recursive_Add_Archives; -- Start of processing for Add_Archives begin -- First, mark all projects as not processed for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Project_Tree.Projects.Table (Project).Seen := False; end loop; -- Take care of the run path option if Path_Option = null then Path_Option := MLib.Linker_Library_Path_Option; end if; Lib_Path.Set_Last (0); -- Add archives in the reverse order Recursive_Add_Archives (Main_Project); -- And reverse the order declare First : Positive := Last_Arg + 1; Last : Natural := Last_Argument; Temp : String_Access; begin while First < Last loop Temp := Arguments (First); Arguments (First) := Arguments (Last); Arguments (Last) := Temp; First := First + 1; Last := Last - 1; end loop; end; end Add_Archives; ------------------ -- Add_Argument -- ------------------ procedure Add_Argument (Arg : String_Access; Display : Boolean) is begin -- Nothing to do if no argument is specified or if argument is empty if Arg /= null or else Arg'Length = 0 then -- Reallocate arrays if necessary if Last_Argument = Arguments'Last then declare New_Arguments : constant Argument_List_Access := new Argument_List (1 .. Last_Argument + Initial_Argument_Count); New_Arguments_Displayed : constant Booleans := new Boolean_Array (1 .. Last_Argument + Initial_Argument_Count); begin New_Arguments (Arguments'Range) := Arguments.all; -- To avoid deallocating the strings, nullify all components -- of Arguments before calling Free. Arguments.all := (others => null); Free (Arguments); Arguments := New_Arguments; New_Arguments_Displayed (Arguments_Displayed'Range) := Arguments_Displayed.all; Free (Arguments_Displayed); Arguments_Displayed := New_Arguments_Displayed; end; end if; -- Add the argument and its display indication Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := Arg; Arguments_Displayed (Last_Argument) := Display; end if; end Add_Argument; procedure Add_Argument (Arg : String; Display : Boolean) is Argument : String_Access := null; begin -- Nothing to do if argument is empty if Arg'Length > 0 then -- Check if the argument is already in the Cache_Args table. -- If it is already there, reuse the allocated value. for Index in 1 .. Cache_Args.Last loop if Cache_Args.Table (Index).all = Arg then Argument := Cache_Args.Table (Index); exit; end if; end loop; -- If the argument is not in the cache, create a new entry in the -- cache. if Argument = null then Argument := new String'(Arg); Cache_Args.Increment_Last; Cache_Args.Table (Cache_Args.Last) := Argument; end if; -- And add the argument Add_Argument (Argument, Display); end if; end Add_Argument; ------------------- -- Add_Arguments -- ------------------- procedure Add_Arguments (Args : Argument_List; Display : Boolean) is begin -- Reallocate the arrays, if necessary if Last_Argument + Args'Length > Arguments'Last then declare New_Arguments : constant Argument_List_Access := new Argument_List (1 .. Last_Argument + Args'Length + Initial_Argument_Count); New_Arguments_Displayed : constant Booleans := new Boolean_Array (1 .. Last_Argument + Args'Length + Initial_Argument_Count); begin New_Arguments (1 .. Last_Argument) := Arguments (1 .. Last_Argument); -- To avoid deallocating the strings, nullify all components -- of Arguments before calling Free. Arguments.all := (others => null); Free (Arguments); Arguments := New_Arguments; New_Arguments_Displayed (1 .. Last_Argument) := Arguments_Displayed (1 .. Last_Argument); Free (Arguments_Displayed); Arguments_Displayed := New_Arguments_Displayed; end; end if; -- Add the new arguments and the display indications Arguments (Last_Argument + 1 .. Last_Argument + Args'Length) := Args; Arguments_Displayed (Last_Argument + 1 .. Last_Argument + Args'Length) := (others => Display); Last_Argument := Last_Argument + Args'Length; end Add_Arguments; ---------------- -- Add_Option -- ---------------- procedure Add_Option (Arg : String) is Option : constant String_Access := new String'(Arg); begin case Current_Processor is when None => null; when Linker => -- Add option to the linker table Linker_Options.Increment_Last; Linker_Options.Table (Linker_Options.Last) := Option; when Compiler => -- Add option to the compiler option table, depending on the -- value of Current_Language. Comp_Opts.Increment_Last (Options (Current_Language)); Options (Current_Language).Table (Comp_Opts.Last (Options (Current_Language))) := Option; end case; end Add_Option; ------------------- -- Add_Source_Id -- ------------------- procedure Add_Source_Id (Project : Project_Id; Id : Other_Source_Id) is begin -- Reallocate the array, if necessary if Last_Source = Source_Indexes'Last then declare New_Indexes : constant Source_Indexes_Ref := new Source_Index_Array (1 .. Source_Indexes'Last + Initial_Source_Index_Count); begin New_Indexes (Source_Indexes'Range) := Source_Indexes.all; Free (Source_Indexes); Source_Indexes := New_Indexes; end; end if; Last_Source := Last_Source + 1; Source_Indexes (Last_Source) := (Project, Id, False); end Add_Source_Id; ---------------------------- -- Add_Search_Directories -- ---------------------------- procedure Add_Search_Directories (Data : Project_Data; Language : First_Language_Indexes) is begin -- If a GNU compiler is used, set the CPATH environment variable, -- if it does not already has the correct value. if Compiler_Is_Gcc (Language) then if Current_Include_Paths (Language) /= Data.Include_Path then Current_Include_Paths (Language) := Data.Include_Path; Setenv (CPATH, Data.Include_Path.all); end if; else Add_Arguments (Data.Imported_Directories_Switches.all, Verbose_Mode); end if; end Add_Search_Directories; ------------------ -- Add_Switches -- ------------------ procedure Add_Switches (Data : Project_Data; Proc : Processor; Language : Language_Index; File_Name : Name_Id) is Switches : Variable_Value; -- The switches, if any, for the file/language Pkg : Package_Id; -- The id of the package where to look for the switches Defaults : Array_Element_Id; -- The Default_Switches associative array Switches_Array : Array_Element_Id; -- The Switches associative array Element_Id : String_List_Id; Element : String_Element; begin -- First, choose the proper package case Proc is when None => raise Program_Error; when Linker => Pkg := Value_Of (Name_Linker, Data.Decl.Packages, Project_Tree); when Compiler => Pkg := Value_Of (Name_Compiler, Data.Decl.Packages, Project_Tree); end case; if Pkg /= No_Package then -- Get the Switches ("file name"), if they exist Switches_Array := Prj.Util.Value_Of (Name => Name_Switches, In_Arrays => Project_Tree.Packages.Table (Pkg).Decl.Arrays, In_Tree => Project_Tree); Switches := Prj.Util.Value_Of (Index => File_Name, Src_Index => 0, In_Array => Switches_Array, In_Tree => Project_Tree); -- Otherwise, get the Default_Switches ("language"), if they exist if Switches = Nil_Variable_Value then Defaults := Prj.Util.Value_Of (Name => Name_Default_Switches, In_Arrays => Project_Tree.Packages.Table (Pkg).Decl.Arrays, In_Tree => Project_Tree); Switches := Prj.Util.Value_Of (Index => Language_Names.Table (Language), Src_Index => 0, In_Array => Defaults, In_Tree => Project_Tree); end if; -- If there are switches, add them to Arguments if Switches /= Nil_Variable_Value then Element_Id := Switches.Values; while Element_Id /= Nil_String loop Element := Project_Tree.String_Elements.Table (Element_Id); if Element.Value /= No_Name then Get_Name_String (Element.Value); if not Quiet_Output then -- When not in quiet output (no -q), check that the -- switch is not the concatenation of several valid -- switches, such as "-g -v". If it is, issue a warning. Check (Option => Name_Buffer (1 .. Name_Len)); end if; Add_Argument (Name_Buffer (1 .. Name_Len), True); end if; Element_Id := Element.Next; end loop; end if; end if; end Add_Switches; -------------------------- -- Build_Global_Archive -- -------------------------- procedure Build_Global_Archive is Data : Project_Data := Project_Tree.Projects.Table (Main_Project); Source_Id : Other_Source_Id; S_Id : Other_Source_Id; Source : Other_Source; Success : Boolean; Archive_Name : constant String := "lib" & Get_Name_String (Data.Name) & '.' & Archive_Ext; -- The name of the archive file for this project Archive_Dep_Name : constant String := "lib" & Get_Name_String (Data.Name) & ".deps"; -- The name of the archive dependency file for this project Need_To_Rebuild : Boolean := Need_To_Rebuild_Global_Archive; -- When True, archive will be rebuilt File : Prj.Util.Text_File; Object_Path : Name_Id; Time_Stamp : Time_Stamp_Type; Saved_Last_Argument : Natural; First_Object : Natural; Discard : Boolean; begin Check_Archive_Builder; Change_Dir (Get_Name_String (Data.Object_Directory)); if not Need_To_Rebuild then if Verbose_Mode then Write_Str (" Checking "); Write_Line (Archive_Name); end if; -- If the archive does not exist, of course it needs to be built if not Is_Regular_File (Archive_Name) then Need_To_Rebuild := True; if Verbose_Mode then Write_Line (" -> archive does not exist"); end if; -- Archive does exist else -- Check the archive dependency file Open (File, Archive_Dep_Name); -- If the archive dependency file does not exist, we need to -- to rebuild the archive and to create its dependency file. if not Is_Valid (File) then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Str (Archive_Dep_Name); Write_Line (" does not exist"); end if; else -- Put all sources of language other than Ada in -- Source_Indexes. declare Local_Data : Project_Data; begin Last_Source := 0; for Proj in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Local_Data := Project_Tree.Projects.Table (Proj); if not Local_Data.Library then Source_Id := Local_Data.First_Other_Source; while Source_Id /= No_Other_Source loop Add_Source_Id (Proj, Source_Id); Source_Id := Project_Tree.Other_Sources.Table (Source_Id).Next; end loop; end if; end loop; end; -- Read the dependency file, line by line while not End_Of_File (File) loop Get_Line (File, Name_Buffer, Name_Len); -- First line is the path of the object file Object_Path := Name_Find; Source_Id := No_Other_Source; -- Check if this object file is for a source of this project for S in 1 .. Last_Source loop S_Id := Source_Indexes (S).Id; Source := Project_Tree.Other_Sources.Table (S_Id); if (not Source_Indexes (S).Found) and then Source.Object_Path = Object_Path then -- We have found the object file: get the source -- data, and mark it as found. Source_Id := S_Id; Source_Indexes (S).Found := True; exit; end if; end loop; -- If it is not for a source of this project, then the -- archive needs to be rebuilt. if Source_Id = No_Other_Source then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> "); Write_Str (Get_Name_String (Object_Path)); Write_Line (" is not an object of any project"); end if; exit; end if; -- The second line is the time stamp of the object file. -- If there is no next line, then the dependency file is -- truncated, and the archive need to be rebuilt. if End_Of_File (File) then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Line (" is truncated"); end if; exit; end if; Get_Line (File, Name_Buffer, Name_Len); -- If the line has the wrong number of characters, then -- the dependency file is incorrectly formatted, and the -- archive needs to be rebuilt. if Name_Len /= Time_Stamp_Length then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Line (" is incorrectly formatted (time stamp)"); end if; exit; end if; Time_Stamp := Time_Stamp_Type (Name_Buffer (1 .. Name_Len)); -- If the time stamp in the dependency file is different -- from the time stamp of the object file, then the archive -- needs to be rebuilt. if Time_Stamp /= Source.Object_TS then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> time stamp of "); Write_Str (Get_Name_String (Object_Path)); Write_Str (" is incorrect in the archive"); Write_Line (" dependency file"); end if; exit; end if; end loop; Close (File); end if; end if; end if; if not Need_To_Rebuild then if Verbose_Mode then Write_Line (" -> up to date"); end if; -- No need to create a global archive, if there is no object -- file to put into. Global_Archive_Exists := Last_Source /= 0; -- Archive needs to be rebuilt else -- If archive already exists, first delete it -- Comment needed on why we discard result??? if Is_Regular_File (Archive_Name) then Delete_File (Archive_Name, Discard); end if; Last_Argument := 0; -- Start with the options found in MLib.Tgt (usually just "rc") Add_Arguments (Archive_Builder_Options.all, True); -- Followed by the archive name Add_Argument (Archive_Name, True); First_Object := Last_Argument; -- Followed by all the object files of the non library projects for Proj in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Data := Project_Tree.Projects.Table (Proj); if not Data.Library then Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); -- Only include object file name that have not been -- overriden in extending projects. if Is_Included_In_Global_Archive (Source.Object_Name, Proj) then Add_Argument (Get_Name_String (Source.Object_Path), Verbose_Mode); end if; Source_Id := Source.Next; end loop; end if; end loop; -- No need to create a global archive, if there is no object -- file to put into. Global_Archive_Exists := Last_Argument > First_Object; if Global_Archive_Exists then -- If the archive is built, then linking will need to occur -- unconditionally. Need_To_Relink := True; -- Spawn the archive builder (ar) Saved_Last_Argument := Last_Argument; Last_Argument := First_Object + Max_In_Archives; loop if Last_Argument > Saved_Last_Argument then Last_Argument := Saved_Last_Argument; end if; Display_Command (Archive_Builder, Archive_Builder_Path); Spawn (Archive_Builder_Path.all, Arguments (1 .. Last_Argument), Success); exit when not Success; exit when Last_Argument = Saved_Last_Argument; Arguments (1) := r; Arguments (3 .. Saved_Last_Argument - Last_Argument + 2) := Arguments (Last_Argument + 1 .. Saved_Last_Argument); Saved_Last_Argument := Saved_Last_Argument - Last_Argument + 2; end loop; -- If the archive was built, run the archive indexer (ranlib) -- if there is one. if Success then -- If the archive was built, run the archive indexer (ranlib), -- if there is one. if Archive_Indexer_Path /= null then Last_Argument := 0; Add_Argument (Archive_Name, True); Display_Command (Archive_Indexer, Archive_Indexer_Path); Spawn (Archive_Indexer_Path.all, Arguments (1 .. 1), Success); if not Success then -- Running ranlib failed, delete the dependency file, -- if it exists. if Is_Regular_File (Archive_Dep_Name) then Delete_File (Archive_Dep_Name, Success); end if; -- And report the error Report_Error ("running" & Archive_Indexer & " for project """, Get_Name_String (Data.Name), """ failed"); return; end if; end if; -- The archive was correctly built, create its dependency file Create_Global_Archive_Dependency_File (Archive_Dep_Name); -- Building the archive failed, delete dependency file if one -- exists. else if Is_Regular_File (Archive_Dep_Name) then Delete_File (Archive_Dep_Name, Success); end if; -- And report the error Report_Error ("building archive for project """, Get_Name_String (Data.Name), """ failed"); end if; end if; end if; end Build_Global_Archive; ------------------- -- Build_Library -- ------------------- procedure Build_Library (Project : Project_Id; Unconditionally : Boolean) is Data : constant Project_Data := Project_Tree.Projects.Table (Project); Source_Id : Other_Source_Id; Source : Other_Source; Archive_Name : constant String := "lib" & Get_Name_String (Data.Name) & '.' & Archive_Ext; -- The name of the archive file for this project Archive_Dep_Name : constant String := "lib" & Get_Name_String (Data.Name) & ".deps"; -- The name of the archive dependency file for this project Need_To_Rebuild : Boolean := Unconditionally; -- When True, archive will be rebuilt File : Prj.Util.Text_File; Object_Name : Name_Id; Time_Stamp : Time_Stamp_Type; Driver_Name : Name_Id := No_Name; Lib_Opts : Argument_List_Access := No_Argument'Access; begin Check_Archive_Builder; -- If Unconditionally is False, check if the archive need to be built if not Need_To_Rebuild then if Verbose_Mode then Write_Str (" Checking "); Write_Line (Archive_Name); end if; -- If the archive does not exist, of course it needs to be built if not Is_Regular_File (Archive_Name) then Need_To_Rebuild := True; if Verbose_Mode then Write_Line (" -> archive does not exist"); end if; -- Archive does exist else -- Check the archive dependency file Open (File, Archive_Dep_Name); -- If the archive dependency file does not exist, we need to -- to rebuild the archive and to create its dependency file. if not Is_Valid (File) then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Str (Archive_Dep_Name); Write_Line (" does not exist"); end if; else -- Put all sources of language other than Ada in Source_Indexes Last_Source := 0; Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Add_Source_Id (Project, Source_Id); Source_Id := Project_Tree.Other_Sources.Table (Source_Id).Next; end loop; -- Read the dependency file, line by line while not End_Of_File (File) loop Get_Line (File, Name_Buffer, Name_Len); -- First line is the name of an object file Object_Name := Name_Find; Source_Id := No_Other_Source; -- Check if this object file is for a source of this project for S in 1 .. Last_Source loop if (not Source_Indexes (S).Found) and then Project_Tree.Other_Sources.Table (Source_Indexes (S).Id).Object_Name = Object_Name then -- We have found the object file: get the source -- data, and mark it as found. Source_Id := Source_Indexes (S).Id; Source := Project_Tree.Other_Sources.Table (Source_Id); Source_Indexes (S).Found := True; exit; end if; end loop; -- If it is not for a source of this project, then the -- archive needs to be rebuilt. if Source_Id = No_Other_Source then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> "); Write_Str (Get_Name_String (Object_Name)); Write_Line (" is not an object of the project"); end if; exit; end if; -- The second line is the time stamp of the object file. -- If there is no next line, then the dependency file is -- truncated, and the archive need to be rebuilt. if End_Of_File (File) then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Line (" is truncated"); end if; exit; end if; Get_Line (File, Name_Buffer, Name_Len); -- If the line has the wrong number of character, then -- the dependency file is incorrectly formatted, and the -- archive needs to be rebuilt. if Name_Len /= Time_Stamp_Length then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Line (" is incorrectly formatted (time stamp)"); end if; exit; end if; Time_Stamp := Time_Stamp_Type (Name_Buffer (1 .. Name_Len)); -- If the time stamp in the dependency file is different -- from the time stamp of the object file, then the archive -- needs to be rebuilt. if Time_Stamp /= Source.Object_TS then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> time stamp of "); Write_Str (Get_Name_String (Object_Name)); Write_Str (" is incorrect in the archive"); Write_Line (" dependency file"); end if; exit; end if; end loop; Close (File); if not Need_To_Rebuild then -- Now, check if all object files of the project have been -- accounted for. If any of them is not in the dependency -- file, the archive needs to be rebuilt. for Index in 1 .. Last_Source loop if not Source_Indexes (Index).Found then Need_To_Rebuild := True; if Verbose_Mode then Source_Id := Source_Indexes (Index).Id; Source := Project_Tree.Other_Sources.Table (Source_Id); Write_Str (" -> "); Write_Str (Get_Name_String (Source.Object_Name)); Write_Str (" is not in the archive "); Write_Line ("dependency file"); end if; exit; end if; end loop; end if; if (not Need_To_Rebuild) and Verbose_Mode then Write_Line (" -> up to date"); end if; end if; end if; end if; -- Build the library if necessary if Need_To_Rebuild then -- If a library is built, then linking will need to occur -- unconditionally. Need_To_Relink := True; Last_Argument := 0; -- If there are sources in Ada, then gnatmake will build the -- library, so nothing to do. if not Data.Languages (Ada_Language_Index) then -- Get all the object files of the project Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); Add_Argument (Get_Name_String (Source.Object_Name), Verbose_Mode); Source_Id := Source.Next; end loop; -- If it is a library, it need to be built it the same way -- Ada libraries are built. if Data.Library_Kind = Static then MLib.Build_Library (Ofiles => Arguments (1 .. Last_Argument), Afiles => No_Argument, Output_File => Get_Name_String (Data.Library_Name), Output_Dir => Get_Name_String (Data.Library_Dir)); else -- Link with g++ if C++ is one of the languages, otherwise -- building the library may fail with unresolved symbols. if C_Plus_Plus_Is_Used then if Compiler_Names (C_Plus_Plus_Language_Index) = null then Get_Compiler (C_Plus_Plus_Language_Index); end if; if Compiler_Is_Gcc (C_Plus_Plus_Language_Index) then Name_Len := 0; Add_Str_To_Name_Buffer (Compiler_Names (C_Plus_Plus_Language_Index).all); Driver_Name := Name_Find; end if; end if; -- If Library_Options is specified, add these options declare Library_Options : constant Variable_Value := Value_Of (Name_Library_Options, Data.Decl.Attributes, Project_Tree); begin if not Library_Options.Default then declare Current : String_List_Id := Library_Options.Values; Element : String_Element; begin while Current /= Nil_String loop Element := Project_Tree.String_Elements. Table (Current); Get_Name_String (Element.Value); if Name_Len /= 0 then Library_Opts.Increment_Last; Library_Opts.Table (Library_Opts.Last) := new String'(Name_Buffer (1 .. Name_Len)); end if; Current := Element.Next; end loop; end; end if; Lib_Opts := new Argument_List'(Argument_List (Library_Opts.Table (1 .. Library_Opts.Last))); end; MLib.Tgt.Build_Dynamic_Library (Ofiles => Arguments (1 .. Last_Argument), Foreign => Arguments (1 .. Last_Argument), Afiles => No_Argument, Options => No_Argument, Options_2 => Lib_Opts.all, Interfaces => No_Argument, Lib_Filename => Get_Name_String (Data.Library_Name), Lib_Dir => Get_Name_String (Data.Library_Dir), Symbol_Data => No_Symbols, Driver_Name => Driver_Name, Lib_Version => "", Auto_Init => False); end if; end if; -- Create fake empty archive, so we can check its time stamp later declare Archive : Ada.Text_IO.File_Type; begin Create (Archive, Out_File, Archive_Name); Close (Archive); end; Create_Archive_Dependency_File (Archive_Dep_Name, Data.First_Other_Source); end if; end Build_Library; ----------- -- Check -- ----------- procedure Check (Option : String) is First : Positive := Option'First; Last : Natural; begin for Index in Option'First + 1 .. Option'Last - 1 loop if Option (Index) = ' ' and then Option (Index + 1) = '-' then Write_Str ("warning: switch """); Write_Str (Option); Write_Str (""" is suspicious; consider using "); Last := First; while Last <= Option'Last loop if Option (Last) = ' ' then if First /= Option'First then Write_Str (", "); end if; Write_Char ('"'); Write_Str (Option (First .. Last - 1)); Write_Char ('"'); while Last <= Option'Last and then Option (Last) = ' ' loop Last := Last + 1; end loop; First := Last; else if Last = Option'Last then if First /= Option'First then Write_Str (", "); end if; Write_Char ('"'); Write_Str (Option (First .. Last)); Write_Char ('"'); end if; Last := Last + 1; end if; end loop; Write_Line (" instead"); exit; end if; end loop; end Check; --------------------------- -- Check_Archive_Builder -- --------------------------- procedure Check_Archive_Builder is begin -- First, make sure that the archive builder (ar) is on the path if Archive_Builder_Path = null then Archive_Builder_Path := Locate_Exec_On_Path (Archive_Builder); if Archive_Builder_Path = null then Osint.Fail ("unable to locate archive builder """, Archive_Builder, """"); end if; -- If there is an archive indexer (ranlib), try to locate it on the -- path. Don't fail if it is not found. if Archive_Indexer /= "" then Archive_Indexer_Path := Locate_Exec_On_Path (Archive_Indexer); end if; end if; end Check_Archive_Builder; ------------------------------ -- Check_Compilation_Needed -- ------------------------------ procedure Check_Compilation_Needed (Source : Other_Source; Need_To_Compile : out Boolean) is Source_Name : constant String := Get_Name_String (Source.File_Name); Source_Path : constant String := Get_Name_String (Source.Path_Name); Object_Name : constant String := Get_Name_String (Source.Object_Name); Dep_Name : constant String := Get_Name_String (Source.Dep_Name); Source_In_Dependencies : Boolean := False; -- Set True if source was found in dependency file of its object file Dep_File : Prj.Util.Text_File; Start : Natural; Finish : Natural; begin -- Assume the worst, so that statement "return;" may be used if there -- is any problem. Need_To_Compile := True; if Verbose_Mode then Write_Str (" Checking "); Write_Str (Source_Name); Write_Line (" ... "); end if; -- If object file does not exist, of course source need to be compiled if Source.Object_TS = Empty_Time_Stamp then if Verbose_Mode then Write_Str (" -> object file "); Write_Str (Object_Name); Write_Line (" does not exist"); end if; return; end if; -- If the object file has been created before the last modification -- of the source, the source need to be recompiled. if Source.Object_TS < Source.Source_TS then if Verbose_Mode then Write_Str (" -> object file "); Write_Str (Object_Name); Write_Line (" has time stamp earlier than source"); end if; return; end if; -- If there is no dependency file, then the source needs to be -- recompiled and the dependency file need to be created. if Source.Dep_TS = Empty_Time_Stamp then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" does not exist"); end if; return; end if; -- The source needs to be recompiled if the source has been modified -- after the dependency file has been created. if Source.Dep_TS < Source.Source_TS then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" has time stamp earlier than source"); end if; return; end if; -- Look for all dependencies Open (Dep_File, Dep_Name); -- If dependency file cannot be open, we need to recompile the source if not Is_Valid (Dep_File) then if Verbose_Mode then Write_Str (" -> could not open dependency file "); Write_Line (Dep_Name); end if; return; end if; declare End_Of_File_Reached : Boolean := False; begin loop if End_Of_File (Dep_File) then End_Of_File_Reached := True; exit; end if; Get_Line (Dep_File, Name_Buffer, Name_Len); exit when Name_Len > 0 and then Name_Buffer (1) /= '#'; end loop; -- If dependency file contains only empty lines or comments, then -- dependencies are unknown, and the source needs to be recompiled. if End_Of_File_Reached then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" is empty"); end if; Close (Dep_File); return; end if; end; Start := 1; Finish := Index (Name_Buffer (1 .. Name_Len), ": "); -- First line must start with name of object file, followed by colon if Finish = 0 or else Name_Buffer (1 .. Finish - 1) /= Object_Name then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" has wrong format"); end if; Close (Dep_File); return; else Start := Finish + 2; -- Process each line Line_Loop : loop declare Line : constant String := Name_Buffer (1 .. Name_Len); Last : constant Natural := Name_Len; begin Name_Loop : loop -- Find the beginning of the next source path name while Start < Last and then Line (Start) = ' ' loop Start := Start + 1; end loop; -- Go to next line when there is a continuation character \ -- at the end of the line. exit Name_Loop when Start = Last and then Line (Start) = '\'; -- We should not be at the end of the line, without -- a continuation character \. if Start = Last then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" has wrong format"); end if; Close (Dep_File); return; end if; -- Look for the end of the source path name Finish := Start; while Finish < Last and then Line (Finish + 1) /= ' ' loop Finish := Finish + 1; end loop; -- Check this source declare Src_Name : constant String := Normalize_Pathname (Name => Line (Start .. Finish), Case_Sensitive => False); Src_TS : Time_Stamp_Type; begin -- If it is original source, set Source_In_Dependencies if Src_Name = Source_Path then Source_In_Dependencies := True; end if; Name_Len := 0; Add_Str_To_Name_Buffer (Src_Name); Src_TS := File_Stamp (Name_Find); -- If the source does not exist, we need to recompile if Src_TS = Empty_Time_Stamp then if Verbose_Mode then Write_Str (" -> source "); Write_Str (Src_Name); Write_Line (" does not exist"); end if; Close (Dep_File); return; -- If the source has been modified after the object file, -- we need to recompile. elsif Src_TS > Source.Object_TS then if Verbose_Mode then Write_Str (" -> source "); Write_Str (Src_Name); Write_Line (" has time stamp later than object file"); end if; Close (Dep_File); return; end if; end; -- If the source path name ends the line, we are done exit Line_Loop when Finish = Last; -- Go get the next source on the line Start := Finish + 1; end loop Name_Loop; end; -- If we are here, we had a continuation character \ at the end -- of the line, so we continue with the next line. Get_Line (Dep_File, Name_Buffer, Name_Len); Start := 1; end loop Line_Loop; end if; Close (Dep_File); -- If the original sources were not in the dependency file, then we -- need to recompile. It may mean that we are using a different source -- (different variant) for this object file. if not Source_In_Dependencies then if Verbose_Mode then Write_Str (" -> source "); Write_Str (Source_Path); Write_Line (" is not in the dependencies"); end if; return; end if; -- If we are here, then everything is OK, and we don't need -- to recompile. if Verbose_Mode then Write_Line (" -> up to date"); end if; Need_To_Compile := False; end Check_Compilation_Needed; --------------------------- -- Check_For_C_Plus_Plus -- --------------------------- procedure Check_For_C_Plus_Plus is begin C_Plus_Plus_Is_Used := False; for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop if Project_Tree.Projects.Table (Project).Languages (C_Plus_Plus_Language_Index) then C_Plus_Plus_Is_Used := True; exit; end if; end loop; end Check_For_C_Plus_Plus; ------------- -- Compile -- ------------- procedure Compile (Source_Id : Other_Source_Id; Data : Project_Data; Local_Errors : in out Boolean) is Source : Other_Source := Project_Tree.Other_Sources.Table (Source_Id); Success : Boolean; CPATH : String_Access := null; begin -- If the compiler is not known yet, get its path name if Compiler_Names (Source.Language) = null then Get_Compiler (Source.Language); end if; -- For non GCC compilers, get the dependency file, first calling the -- compiler with the switch -M. if not Compiler_Is_Gcc (Source.Language) then Last_Argument := 0; -- Add the source name, preceded by -M Add_Argument (Dash_M, True); Add_Argument (Get_Name_String (Source.Path_Name), True); -- Add the compiling switches for this source found in -- package Compiler of the project file, if they exist. Add_Switches (Data, Compiler, Source.Language, Source.File_Name); -- Add the compiling switches for the language specified -- on the command line, if any. for J in 1 .. Comp_Opts.Last (Options (Source.Language)) loop Add_Argument (Options (Source.Language).Table (J), True); end loop; -- Finally, add imported directory switches for this project file Add_Search_Directories (Data, Source.Language); -- And invoke the compiler using GNAT.Expect Display_Command (Compiler_Names (Source.Language).all, Compiler_Paths (Source.Language)); begin Non_Blocking_Spawn (FD, Compiler_Paths (Source.Language).all, Arguments (1 .. Last_Argument), Buffer_Size => 0, Err_To_Out => True); declare Dep_File : Ada.Text_IO.File_Type; Result : Expect_Match; Status : Integer; begin -- Create the dependency file Create (Dep_File, Out_File, Get_Name_String (Source.Dep_Name)); loop Expect (FD, Result, Line_Matcher); exit when Result = Expect_Timeout; declare S : constant String := Strip_CR_LF (Expect_Out (FD)); begin -- Each line of the output is put in the dependency -- file, including errors. If there are errors, the -- syntax of the dependency file will be incorrect and -- recompilation will occur automatically the next time -- the dependencies are checked. Put_Line (Dep_File, S); end; end loop; -- If we are here, it means we had a timeout, so the -- dependency file may be incomplete. It is safer to -- delete it, otherwise the dependencies may be wrong. Close (FD, Status); Close (Dep_File); Delete_File (Get_Name_String (Source.Dep_Name), Success); exception when Process_Died => -- This is the normal outcome. Just close the file Close (FD, Status); Close (Dep_File); when others => -- Something wrong happened. It is safer to delete the -- dependency file, otherwise the dependencies may be wrong. Close (FD, Status); if Is_Open (Dep_File) then Close (Dep_File); end if; Delete_File (Get_Name_String (Source.Dep_Name), Success); end; exception -- If we cannot spawn the compiler, then the dependencies are -- not updated. It is safer then to delete the dependency file, -- otherwise the dependencies may be wrong. when Invalid_Process => Delete_File (Get_Name_String (Source.Dep_Name), Success); end; end if; Last_Argument := 0; -- For GCC compilers, make sure the language is always specified to -- to the GCC driver, in case the extension is not recognized by the -- GCC driver as a source of the language. if Compiler_Is_Gcc (Source.Language) then Add_Argument (Dash_x, Verbose_Mode); Add_Argument (Get_Name_String (Language_Names.Table (Source.Language)), Verbose_Mode); end if; Add_Argument (Dash_c, True); -- Add the compiling switches for this source found in -- package Compiler of the project file, if they exist. Add_Switches (Data, Compiler, Source.Language, Source.File_Name); -- Specify the source to be compiled Add_Argument (Get_Name_String (Source.Path_Name), True); -- If non static library project, compile with the PIC option if there -- is one (when there is no PIC option, function MLib.Tgt.PIC_Option -- returns an empty string, and Add_Argument with an empty string has -- no effect). if Data.Library and then Data.Library_Kind /= Static then Add_Argument (PIC_Option, True); end if; -- Indicate the name of the object Add_Argument (Dash_o, True); Add_Argument (Get_Name_String (Source.Object_Name), True); -- When compiler is GCC, use the magic switch that creates -- the dependency file in the correct format. if Compiler_Is_Gcc (Source.Language) then Add_Argument ("-Wp,-MD," & Get_Name_String (Source.Dep_Name), Verbose_Mode); end if; -- Add the compiling switches for the language specified -- on the command line, if any. for J in 1 .. Comp_Opts.Last (Options (Source.Language)) loop Add_Argument (Options (Source.Language).Table (J), True); end loop; -- Finally, add the imported directory switches for this -- project file (or, for gcc compilers, set up the CPATH env var -- if needed). Add_Search_Directories (Data, Source.Language); -- Set CPATH, if compiler is GCC if Compiler_Is_Gcc (Source.Language) then CPATH := Current_Include_Paths (Source.Language); end if; -- And invoke the compiler Display_Command (Name => Compiler_Names (Source.Language).all, Path => Compiler_Paths (Source.Language), CPATH => CPATH); Spawn (Compiler_Paths (Source.Language).all, Arguments (1 .. Last_Argument), Success); -- Case of successful compilation if Success then -- Update the time stamp of the object file Source.Object_TS := File_Stamp (Source.Object_Name); -- Do some sanity checks if Source.Object_TS = Empty_Time_Stamp then Local_Errors := True; Report_Error ("object file ", Get_Name_String (Source.Object_Name), " has not been created"); elsif Source.Object_TS < Source.Source_TS then Local_Errors := True; Report_Error ("object file ", Get_Name_String (Source.Object_Name), " has not been modified"); else -- Everything looks fine, update the Other_Sources table Project_Tree.Other_Sources.Table (Source_Id) := Source; end if; -- Compilation failed else Local_Errors := True; Report_Error ("compilation of ", Get_Name_String (Source.Path_Name), " failed"); end if; end Compile; -------------------------------- -- Compile_Individual_Sources -- -------------------------------- procedure Compile_Individual_Sources is Data : Project_Data := Project_Tree.Projects.Table (Main_Project); Source_Id : Other_Source_Id; Source : Other_Source; Source_Name : Name_Id; Project_Name : String := Get_Name_String (Data.Name); Dummy : Boolean := False; Ada_Is_A_Language : constant Boolean := Data.Languages (Ada_Language_Index); begin Ada_Mains.Init; To_Mixed (Project_Name); Compile_Only := True; Get_Imported_Directories (Main_Project, Data); Project_Tree.Projects.Table (Main_Project) := Data; -- Compilation will occur in the object directory Change_Dir (Get_Name_String (Data.Object_Directory)); if not Data.Other_Sources_Present then if Ada_Is_A_Language then Mains.Reset; loop declare Main : constant String := Mains.Next_Main; begin exit when Main'Length = 0; Ada_Mains.Increment_Last; Ada_Mains.Table (Ada_Mains.Last) := new String'(Main); end; end loop; else Osint.Fail ("project ", Project_Name, " contains no source"); end if; else Mains.Reset; loop declare Main : constant String := Mains.Next_Main; begin Name_Len := Main'Length; exit when Name_Len = 0; Name_Buffer (1 .. Name_Len) := Main; Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Source_Name := Name_Find; if not Sources_Compiled.Get (Source_Name) then Sources_Compiled.Set (Source_Name, True); Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); exit when Source.File_Name = Source_Name; Source_Id := Source.Next; end loop; if Source_Id = No_Other_Source then if Ada_Is_A_Language then Ada_Mains.Increment_Last; Ada_Mains.Table (Ada_Mains.Last) := new String'(Main); else Report_Error (Main, " is not a valid source of project ", Project_Name); end if; else Compile (Source_Id, Data, Dummy); end if; end if; end; end loop; end if; if Ada_Mains.Last > 0 then -- Invoke gnatmake for all Ada sources Last_Argument := 0; Add_Argument (Dash_u, True); for Index in 1 .. Ada_Mains.Last loop Add_Argument (Ada_Mains.Table (Index), True); end loop; Compile_Link_With_Gnatmake (Mains_Specified => False); end if; end Compile_Individual_Sources; -------------------------------- -- Compile_Link_With_Gnatmake -- -------------------------------- procedure Compile_Link_With_Gnatmake (Mains_Specified : Boolean) is Data : constant Project_Data := Project_Tree.Projects.Table (Main_Project); Success : Boolean; begin -- Array Arguments may already contain some arguments, so we don't -- set Last_Argument to 0. -- Get the gnatmake to invoke Get_Compiler (Ada_Language_Index); -- Specify the project file Add_Argument (Dash_P, True); Add_Argument (Get_Name_String (Data.Path_Name), True); -- Add the -X switches, if any for Index in 1 .. X_Switches.Last loop Add_Argument (X_Switches.Table (Index), True); end loop; -- If Mains_Specified is True, find the mains in package Mains if Mains_Specified then Mains.Reset; loop declare Main : constant String := Mains.Next_Main; begin exit when Main'Length = 0; Add_Argument (Main, True); end; end loop; end if; -- Specify output file name, if any was specified on the command line if Output_File_Name /= null then Add_Argument (Dash_o, True); Add_Argument (Output_File_Name, True); end if; -- Transmit some switches to gnatmake -- -c if Compile_Only then Add_Argument (Dash_c, True); end if; -- -d if Display_Compilation_Progress then Add_Argument (Dash_d, True); end if; -- -k if Keep_Going then Add_Argument (Dash_k, True); end if; -- -f if Force_Compilations then Add_Argument (Dash_f, True); end if; -- -v if Verbose_Mode then Add_Argument (Dash_v, True); end if; -- -q if Quiet_Output then Add_Argument (Dash_q, True); end if; -- -vP1 and -vP2 case Current_Verbosity is when Default => null; when Medium => Add_Argument (Dash_vP1, True); when High => Add_Argument (Dash_vP2, True); end case; -- If there are compiling options for Ada, transmit them to gnatmake if Comp_Opts.Last (Options (Ada_Language_Index)) /= 0 then Add_Argument (Dash_cargs, True); for Arg in 1 .. Comp_Opts.Last (Options (Ada_Language_Index)) loop Add_Argument (Options (Ada_Language_Index).Table (Arg), True); end loop; end if; if not Compile_Only then -- Linking options if Linker_Options.Last /= 0 then Add_Argument (Dash_largs, True); else Add_Argument (Dash_largs, Verbose_Mode); end if; -- Add the archives Add_Archives (For_Gnatmake => True); -- If there are linking options from the command line, -- transmit them to gnatmake. for Arg in 1 .. Linker_Options.Last loop Add_Argument (Linker_Options.Table (Arg), True); end loop; end if; -- And invoke gnatmake Display_Command (Compiler_Names (Ada_Language_Index).all, Compiler_Paths (Ada_Language_Index)); Spawn (Compiler_Paths (Ada_Language_Index).all, Arguments (1 .. Last_Argument), Success); -- Report an error if call to gnatmake failed if not Success then Report_Error ("invocation of ", Compiler_Names (Ada_Language_Index).all, " failed"); end if; end Compile_Link_With_Gnatmake; --------------------- -- Compile_Sources -- --------------------- procedure Compile_Sources is Data : Project_Data; Source_Id : Other_Source_Id; Source : Other_Source; Local_Errors : Boolean := False; -- Set to True when there is a compilation error. Used only when -- Keep_Going is True, to inhibit the building of the archive. Need_To_Compile : Boolean; -- Set to True when a source needs to be compiled/recompiled Need_To_Rebuild_Archive : Boolean := Force_Compilations; -- True when the archive needs to be built/rebuilt unconditionally Total_Number_Of_Sources : Int := 0; Current_Source_Number : Int := 0; begin -- First, get the number of sources for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Data := Project_Tree.Projects.Table (Project); if (not Data.Virtual) and then Data.Other_Sources_Present then Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); Total_Number_Of_Sources := Total_Number_Of_Sources + 1; Source_Id := Source.Next; end loop; end if; end loop; -- Loop through project files for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Local_Errors := False; Data := Project_Tree.Projects.Table (Project); -- Nothing to do when no sources of language other than Ada if (not Data.Virtual) and then Data.Other_Sources_Present then -- If the imported directory switches are unknown, compute them if not Data.Include_Data_Set then Get_Imported_Directories (Project, Data); Data.Include_Data_Set := True; Project_Tree.Projects.Table (Project) := Data; end if; Need_To_Rebuild_Archive := Force_Compilations; -- Compilation will occur in the object directory Change_Dir (Get_Name_String (Data.Object_Directory)); Source_Id := Data.First_Other_Source; -- Process each source one by one while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); Current_Source_Number := Current_Source_Number + 1; Need_To_Compile := Force_Compilations; -- Check if compilation is needed if not Need_To_Compile then Check_Compilation_Needed (Source, Need_To_Compile); end if; -- Proceed, if compilation is needed if Need_To_Compile then -- If a source is compiled/recompiled, of course the -- archive will need to be built/rebuilt. Need_To_Rebuild_Archive := True; Compile (Source_Id, Data, Local_Errors); end if; if Display_Compilation_Progress then Write_Str ("completed "); Write_Int (Current_Source_Number); Write_Str (" out of "); Write_Int (Total_Number_Of_Sources); Write_Str (" ("); Write_Int ((Current_Source_Number * 100) / Total_Number_Of_Sources); Write_Str ("%)..."); Write_Eol; end if; -- Next source, if any Source_Id := Source.Next; end loop; if Need_To_Rebuild_Archive and then (not Data.Library) then Need_To_Rebuild_Global_Archive := True; end if; -- If there was no compilation error and -c was not used, -- build / rebuild the archive if necessary. if not Local_Errors and then Data.Library and then not Data.Languages (Ada_Language_Index) and then not Compile_Only then Build_Library (Project, Need_To_Rebuild_Archive); end if; end if; end loop; end Compile_Sources; --------------- -- Copyright -- --------------- procedure Copyright is begin -- Only output the Copyright notice once if not Copyright_Output then Copyright_Output := True; Write_Eol; Write_Str ("GPRMAKE "); Write_Str (Gnatvsn.Gnat_Version_String); Write_Str (" Copyright 2004 Free Software Foundation, Inc."); Write_Eol; end if; end Copyright; ------------------------------------ -- Create_Archive_Dependency_File -- ------------------------------------ procedure Create_Archive_Dependency_File (Name : String; First_Source : Other_Source_Id) is Source_Id : Other_Source_Id := First_Source; Source : Other_Source; Dep_File : Ada.Text_IO.File_Type; begin -- Create the file in Append mode, to avoid automatic insertion of -- an end of line if file is empty. Create (Dep_File, Append_File, Name); while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); Put_Line (Dep_File, Get_Name_String (Source.Object_Name)); Put_Line (Dep_File, String (Source.Object_TS)); Source_Id := Source.Next; end loop; Close (Dep_File); exception when others => if Is_Open (Dep_File) then Close (Dep_File); end if; end Create_Archive_Dependency_File; ------------------------------------------- -- Create_Global_Archive_Dependency_File -- ------------------------------------------- procedure Create_Global_Archive_Dependency_File (Name : String) is Source_Id : Other_Source_Id; Source : Other_Source; Dep_File : Ada.Text_IO.File_Type; begin -- Create the file in Append mode, to avoid automatic insertion of -- an end of line if file is empty. Create (Dep_File, Append_File, Name); -- Get all the object files of non-Ada sources in non-library projects for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop if not Project_Tree.Projects.Table (Project).Library then Source_Id := Project_Tree.Projects.Table (Project).First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); -- Put only those object files that are in the global archive if Is_Included_In_Global_Archive (Source.Object_Name, Project) then Put_Line (Dep_File, Get_Name_String (Source.Object_Path)); Put_Line (Dep_File, String (Source.Object_TS)); end if; Source_Id := Source.Next; end loop; end if; end loop; Close (Dep_File); exception when others => if Is_Open (Dep_File) then Close (Dep_File); end if; end Create_Global_Archive_Dependency_File; --------------------- -- Display_Command -- --------------------- procedure Display_Command (Name : String; Path : String_Access; CPATH : String_Access := null) is begin -- Only display the command in Verbose Mode (-v) or when -- not in Quiet Output (no -q). if Verbose_Mode or (not Quiet_Output) then -- In Verbose Mode output the full path of the spawned process if Verbose_Mode then if CPATH /= null then Write_Str ("CPATH = "); Write_Line (CPATH.all); end if; Write_Str (Path.all); else Write_Str (Name); end if; -- Display only the arguments for which the display flag is set -- (in Verbose Mode, the display flag is set for all arguments) for Arg in 1 .. Last_Argument loop if Arguments_Displayed (Arg) then Write_Char (' '); Write_Str (Arguments (Arg).all); end if; end loop; Write_Eol; end if; end Display_Command; ------------------ -- Get_Compiler -- ------------------ procedure Get_Compiler (For_Language : First_Language_Indexes) is Data : constant Project_Data := Project_Tree.Projects.Table (Main_Project); Ide : constant Package_Id := Value_Of (Name_Ide, In_Packages => Data.Decl.Packages, In_Tree => Project_Tree); -- The id of the package IDE in the project file Compiler : constant Variable_Value := Value_Of (Name => Language_Names.Table (For_Language), Index => 0, Attribute_Or_Array_Name => Name_Compiler_Command, In_Package => Ide, In_Tree => Project_Tree); -- The value of Compiler_Command ("language") in package IDE, if defined begin -- No need to do it again if the compiler is known for this language if Compiler_Names (For_Language) = null then -- If compiler command is not defined for this language in package -- IDE, use the default compiler for this language. if Compiler = Nil_Variable_Value then if For_Language in Default_Compiler_Names'Range then Compiler_Names (For_Language) := Default_Compiler_Names (For_Language); else Osint.Fail ("unknow compiler name for language """, Get_Name_String (Language_Names.Table (For_Language)), """"); end if; else Compiler_Names (For_Language) := new String'(Get_Name_String (Compiler.Value)); end if; -- Check we have a GCC compiler (name ends with "gcc" or "g++") declare Comp_Name : constant String := Compiler_Names (For_Language).all; Last3 : String (1 .. 3); begin if Comp_Name'Length >= 3 then Last3 := Comp_Name (Comp_Name'Last - 2 .. Comp_Name'Last); Compiler_Is_Gcc (For_Language) := (Last3 = "gcc") or (Last3 = "g++"); else Compiler_Is_Gcc (For_Language) := False; end if; end; -- Locate the compiler on the path Compiler_Paths (For_Language) := Locate_Exec_On_Path (Compiler_Names (For_Language).all); -- Fail if compiler cannot be found if Compiler_Paths (For_Language) = null then if For_Language = Ada_Language_Index then Osint.Fail ("unable to locate """, Compiler_Names (For_Language).all, """"); else Osint.Fail ("unable to locate " & Get_Name_String (Language_Names.Table (For_Language)), " compiler """, Compiler_Names (For_Language).all & '"'); end if; end if; end if; end Get_Compiler; ------------------------------ -- Get_Imported_Directories -- ------------------------------ procedure Get_Imported_Directories (Project : Project_Id; Data : in out Project_Data) is Imported_Projects : Project_List := Data.Imported_Projects; Path_Length : Natural := 0; Position : Natural := 0; procedure Add (Source_Dirs : String_List_Id); -- Add a list of source directories procedure Recursive_Get_Dirs (Prj : Project_Id); -- Recursive procedure to get the source directories of this project -- file and of the project files it imports, in the correct order. --------- -- Add -- --------- procedure Add (Source_Dirs : String_List_Id) is Element_Id : String_List_Id := Source_Dirs; Element : String_Element; Add_Arg : Boolean := True; begin -- Add each source directory path name, preceded by "-I" to Arguments while Element_Id /= Nil_String loop Element := Project_Tree.String_Elements.Table (Element_Id); if Element.Value /= No_Name then Get_Name_String (Element.Value); if Name_Len > 0 then -- Remove a trailing directory separator: this may cause -- problems on Windows. if Name_Len > 1 and then Name_Buffer (Name_Len) = Directory_Separator then Name_Len := Name_Len - 1; end if; declare Arg : constant String := "-I" & Name_Buffer (1 .. Name_Len); begin -- Check if directory is already in the list. -- If it is, no need to put it again. for Index in 1 .. Last_Argument loop if Arguments (Index).all = Arg then Add_Arg := False; exit; end if; end loop; if Add_Arg then if Path_Length /= 0 then Path_Length := Path_Length + 1; end if; Path_Length := Path_Length + Name_Len; Add_Argument (Arg, True); end if; end; end if; end if; Element_Id := Element.Next; end loop; end Add; ------------------------ -- Recursive_Get_Dirs -- ------------------------ procedure Recursive_Get_Dirs (Prj : Project_Id) is Data : Project_Data; Imported : Project_List; begin -- Nothing to do if project is undefined if Prj /= No_Project then Data := Project_Tree.Projects.Table (Prj); -- Nothing to do if project has already been processed if not Data.Seen then -- Mark the project as processed, to avoid multiple processing -- of the same project. Project_Tree.Projects.Table (Prj).Seen := True; -- Add the source directories of this project if not Data.Virtual then Add (Data.Source_Dirs); end if; Recursive_Get_Dirs (Data.Extends); Imported := Data.Imported_Projects; -- Call itself for all imported projects, if any while Imported /= Empty_Project_List loop Recursive_Get_Dirs (Project_Tree.Project_Lists.Table (Imported).Project); Imported := Project_Tree.Project_Lists.Table (Imported).Next; end loop; end if; end if; end Recursive_Get_Dirs; -- Start of processing for Get_Imported_Directories begin -- First, mark all project as not processed for J in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Project_Tree.Projects.Table (J).Seen := False; end loop; -- Empty Arguments Last_Argument := 0; -- Process this project individually, project data are already known Project_Tree.Projects.Table (Project).Seen := True; Add (Data.Source_Dirs); Recursive_Get_Dirs (Data.Extends); while Imported_Projects /= Empty_Project_List loop Recursive_Get_Dirs (Project_Tree.Project_Lists.Table (Imported_Projects).Project); Imported_Projects := Project_Tree.Project_Lists.Table (Imported_Projects).Next; end loop; Data.Imported_Directories_Switches := new Argument_List'(Arguments (1 .. Last_Argument)); -- Create the Include_Path, from the Arguments Data.Include_Path := new String (1 .. Path_Length); Data.Include_Path (1 .. Arguments (1)'Length - 2) := Arguments (1)(Arguments (1)'First + 2 .. Arguments (1)'Last); Position := Arguments (1)'Length - 2; for Arg in 2 .. Last_Argument loop Position := Position + 1; Data.Include_Path (Position) := Path_Separator; Data.Include_Path (Position + 1 .. Position + Arguments (Arg)'Length - 2) := Arguments (Arg)(Arguments (Arg)'First + 2 .. Arguments (Arg)'Last); Position := Position + Arguments (Arg)'Length - 2; end loop; Last_Argument := 0; end Get_Imported_Directories; ------------- -- Gprmake -- ------------- procedure Gprmake is begin Makegpr.Initialize; if Verbose_Mode then Write_Eol; Write_Str ("Parsing Project File """); Write_Str (Project_File_Name.all); Write_Str ("""."); Write_Eol; end if; -- Parse and process project files for other languages (not for Ada) Prj.Pars.Parse (Project => Main_Project, In_Tree => Project_Tree, Project_File_Name => Project_File_Name.all, Packages_To_Check => Packages_To_Check); -- Fail if parsing/processing was unsuccessful if Main_Project = No_Project then Osint.Fail ("""", Project_File_Name.all, """ processing failed"); end if; if Verbose_Mode then Write_Eol; Write_Str ("Parsing of Project File """); Write_Str (Project_File_Name.all); Write_Str (""" is finished."); Write_Eol; end if; -- If -f was specified, we will certainly need to link (except when -- -u or -c were specified, of course). Need_To_Relink := Force_Compilations; if Unique_Compile then if Mains.Number_Of_Mains = 0 then Osint.Fail ("No source specified to compile in 'unique compile' mode"); else Compile_Individual_Sources; Report_Total_Errors ("compilation"); end if; else declare Data : constant Prj.Project_Data := Project_Tree.Projects.Table (Main_Project); begin if Data.Library and then Mains.Number_Of_Mains /= 0 then Osint.Fail ("Cannot specify mains on the command line " & "for a Library Project"); end if; -- First check for C++, to link libraries with g++, -- rather than gcc. Check_For_C_Plus_Plus; -- Compile sources and build archives for library project, -- if necessary. Compile_Sources; -- When Keep_Going is True, if we had some errors, fail now, -- reporting the number of compilation errors. -- Do not attempt to link. Report_Total_Errors ("compilation"); -- If -c was not specified, link the executables, -- if there are any. if not Compile_Only and then not Data.Library and then Data.Object_Directory /= No_Name then Build_Global_Archive; Link_Executables; end if; -- When Keep_Going is True, if we had some errors, fail, reporting -- the number of linking errors. Report_Total_Errors ("linking"); end; end if; end Gprmake; ---------------- -- Initialize -- ---------------- procedure Initialize is begin -- Do some necessary package initializations Csets.Initialize; Namet.Initialize; Snames.Initialize; Prj.Initialize (Project_Tree); Mains.Delete; -- Set Name_Ide and Name_Compiler_Command Name_Len := 0; Add_Str_To_Name_Buffer ("ide"); Name_Ide := Name_Find; Name_Len := 0; Add_Str_To_Name_Buffer ("compiler_command"); Name_Compiler_Command := Name_Find; -- Make sure the -X switch table is empty X_Switches.Set_Last (0); -- Get the command line arguments Scan_Args : for Next_Arg in 1 .. Argument_Count loop Scan_Arg (Argument (Next_Arg)); end loop Scan_Args; -- Fail if command line ended with "-P" if Project_File_Name_Expected then Osint.Fail ("project file name missing after -P"); -- Or if it ended with "-o" elsif Output_File_Name_Expected then Osint.Fail ("output file name missing after -o"); end if; -- If no project file was specified, display the usage and fail if Project_File_Name = null then Usage; Exit_Program (E_Success); end if; -- To be able of finding libgnat.a in MLib.Tgt, we need to have the -- default search dirs established in Osint. Osint.Add_Default_Search_Dirs; end Initialize; ----------------------------------- -- Is_Included_In_Global_Archive -- ----------------------------------- function Is_Included_In_Global_Archive (Object_Name : Name_Id; Project : Project_Id) return Boolean is Data : Project_Data := Project_Tree.Projects.Table (Project); Source : Other_Source_Id; begin while Data.Extended_By /= No_Project loop Data := Project_Tree.Projects.Table (Data.Extended_By); Source := Data.First_Other_Source; while Source /= No_Other_Source loop if Project_Tree.Other_Sources.Table (Source).Object_Name = Object_Name then return False; else Source := Project_Tree.Other_Sources.Table (Source).Next; end if; end loop; end loop; return True; end Is_Included_In_Global_Archive; ---------------------- -- Link_Executables -- ---------------------- procedure Link_Executables is Data : constant Project_Data := Project_Tree.Projects.Table (Main_Project); Mains_Specified : constant Boolean := Mains.Number_Of_Mains /= 0; -- True if main sources were specified on the command line Object_Dir : constant String := Get_Name_String (Data.Object_Directory); -- Path of the object directory of the main project Source_Id : Other_Source_Id; Source : Other_Source; Success : Boolean; Linker_Name : String_Access; Linker_Path : String_Access; -- The linker name and path, when linking is not done by gnatlink Link_Done : Boolean := False; -- Set to True when the linker is invoked directly (not through -- gnatmake) to be able to report if mains were up to date at the end -- of execution. procedure Add_C_Plus_Plus_Link_For_Gnatmake; -- Add the --LINK= switch for gnatlink, depending on the C++ compiler procedure Check_Time_Stamps (Exec_Time_Stamp : Time_Stamp_Type); -- Check if there is an archive that is more recent than the executable -- to decide if we need to relink. procedure Choose_C_Plus_Plus_Link_Process; -- If the C++ compiler is not g++, create the correct script to link procedure Link_Foreign (Main : String; Main_Id : Name_Id; Source : Other_Source); -- Link a non-Ada main, when there is no Ada code --------------------------------------- -- Add_C_Plus_Plus_Link_For_Gnatmake -- --------------------------------------- procedure Add_C_Plus_Plus_Link_For_Gnatmake is begin Add_Argument ("--LINK=" & Compiler_Names (C_Plus_Plus_Language_Index).all, Verbose_Mode); end Add_C_Plus_Plus_Link_For_Gnatmake; ----------------------- -- Check_Time_Stamps -- ----------------------- procedure Check_Time_Stamps (Exec_Time_Stamp : Time_Stamp_Type) is Prj_Data : Project_Data; begin for Prj in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Prj_Data := Project_Tree.Projects.Table (Prj); -- There is an archive only in project -- files with sources other than Ada -- sources. if Data.Other_Sources_Present then declare Archive_Path : constant String := Get_Name_String (Prj_Data.Object_Directory) & Directory_Separator & "lib" & Get_Name_String (Prj_Data.Name) & '.' & Archive_Ext; Archive_TS : Time_Stamp_Type; begin Name_Len := 0; Add_Str_To_Name_Buffer (Archive_Path); Archive_TS := File_Stamp (Name_Find); -- If the archive is later than the -- executable, we need to relink. if Archive_TS /= Empty_Time_Stamp and then Exec_Time_Stamp < Archive_TS then Need_To_Relink := True; if Verbose_Mode then Write_Str (" -> "); Write_Str (Archive_Path); Write_Str (" has time stamp "); Write_Str ("later than "); Write_Line ("executable"); end if; exit; end if; end; end if; end loop; end Check_Time_Stamps; ------------------------------------- -- Choose_C_Plus_Plus_Link_Process -- ------------------------------------- procedure Choose_C_Plus_Plus_Link_Process is begin if Compiler_Names (C_Plus_Plus_Language_Index) = null then Get_Compiler (C_Plus_Plus_Language_Index); end if; end Choose_C_Plus_Plus_Link_Process; ------------------ -- Link_Foreign -- ------------------ procedure Link_Foreign (Main : String; Main_Id : Name_Id; Source : Other_Source) is Executable_Name : constant String := Get_Name_String (Executable_Of (Project => Main_Project, In_Tree => Project_Tree, Main => Main_Id, Index => 0, Ada_Main => False)); -- File name of the executable Executable_Path : constant String := Get_Name_String (Data.Exec_Directory) & Directory_Separator & Executable_Name; -- Path name of the executable Exec_Time_Stamp : Time_Stamp_Type; begin -- Now, check if the executable is up to date. It is considered -- up to date if its time stamp is not earlier that the time stamp -- of any archive. Only do that if we don't know if we need to link. if not Need_To_Relink then -- Get the time stamp of the executable Name_Len := 0; Add_Str_To_Name_Buffer (Executable_Path); Exec_Time_Stamp := File_Stamp (Name_Find); if Verbose_Mode then Write_Str (" Checking executable "); Write_Line (Executable_Name); end if; -- If executable does not exist, we need to link if Exec_Time_Stamp = Empty_Time_Stamp then Need_To_Relink := True; if Verbose_Mode then Write_Line (" -> not found"); end if; -- Otherwise, get the time stamps of each archive. If one of -- them is found later than the executable, we need to relink. else Check_Time_Stamps (Exec_Time_Stamp); end if; -- If Need_To_Relink is False, we are done if Verbose_Mode and (not Need_To_Relink) then Write_Line (" -> up to date"); end if; end if; -- Prepare to link if Need_To_Relink then Link_Done := True; Last_Argument := 0; -- Specify the executable path name Add_Argument (Dash_o, True); Add_Argument (Get_Name_String (Data.Exec_Directory) & Directory_Separator & Get_Name_String (Executable_Of (Project => Main_Project, In_Tree => Project_Tree, Main => Main_Id, Index => 0, Ada_Main => False)), True); -- Specify the object file of the main source Add_Argument (Object_Dir & Directory_Separator & Get_Name_String (Source.Object_Name), True); -- Add all the archives, in a correct order Add_Archives (For_Gnatmake => False); -- Add the switches specified in package Linker of -- the main project. Add_Switches (Data => Data, Proc => Linker, Language => Source.Language, File_Name => Main_Id); -- Add the switches specified in attribute -- Linker_Options of packages Linker. if Link_Options_Switches = null then Link_Options_Switches := new Argument_List' (Linker_Options_Switches (Main_Project, Project_Tree)); end if; Add_Arguments (Link_Options_Switches.all, True); -- Add the linking options specified on the -- command line. for Arg in 1 .. Linker_Options.Last loop Add_Argument (Linker_Options.Table (Arg), True); end loop; -- If there are shared libraries and the run path -- option is supported, add the run path switch. if Lib_Path.Last > 0 then Add_Argument (Path_Option.all & String (Lib_Path.Table (1 .. Lib_Path.Last)), Verbose_Mode); end if; -- And invoke the linker Display_Command (Linker_Name.all, Linker_Path); Spawn (Linker_Path.all, Arguments (1 .. Last_Argument), Success); if not Success then Report_Error ("could not link ", Main); end if; end if; end Link_Foreign; -- Start of processing of Link_Executables begin -- If no mains specified, get mains from attribute Main, if it exists if not Mains_Specified then declare Element_Id : String_List_Id := Data.Mains; Element : String_Element; begin while Element_Id /= Nil_String loop Element := Project_Tree.String_Elements.Table (Element_Id); if Element.Value /= No_Name then Mains.Add_Main (Get_Name_String (Element.Value)); end if; Element_Id := Element.Next; end loop; end; end if; if Mains.Number_Of_Mains = 0 then -- If the attribute Main is an empty list or not specified, -- there is nothing to do. if Verbose_Mode then Write_Line ("No main to link"); end if; return; end if; -- Check if -o was used for several mains if Output_File_Name /= null and then Mains.Number_Of_Mains > 1 then Osint.Fail ("cannot specify an executable name for several mains"); end if; -- Check how we are going to do the link if not Data.Other_Sources_Present then -- Only Ada sources in the main project, and even maybe not if not Data.Languages (Ada_Language_Index) then -- Fail if the main project has no source of any language Osint.Fail ("project """, Get_Name_String (Data.Name), """ has no sources, so no main can be linked"); else -- Only Ada sources in the main project, call gnatmake directly Last_Argument := 0; -- Choose correct linker if there is C++ code in other projects if C_Plus_Plus_Is_Used then Choose_C_Plus_Plus_Link_Process; Add_Argument (Dash_largs, Verbose_Mode); Add_C_Plus_Plus_Link_For_Gnatmake; Add_Argument (Dash_margs, Verbose_Mode); end if; Compile_Link_With_Gnatmake (Mains_Specified); end if; else -- There are other language sources. First check if there are also -- sources in Ada. if Data.Languages (Ada_Language_Index) then -- There is a mix of Ada and other language sources in the main -- project. Any main that is not a source of the other languages -- will be deemed to be an Ada main. -- Find the mains of the other languages and the Ada mains Mains.Reset; Ada_Mains.Set_Last (0); Other_Mains.Set_Last (0); -- For each main loop declare Main : constant String := Mains.Next_Main; Main_Id : Name_Id; begin exit when Main'Length = 0; -- Get the main file name Name_Len := 0; Add_Str_To_Name_Buffer (Main); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Main_Id := Name_Find; Source_Id := Data.First_Other_Source; -- Check if it is a source of a language other than Ada while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); exit when Source.File_Name = Main_Id; Source_Id := Source.Next; end loop; -- If it is not, put it in the list of Ada mains if Source_Id = No_Other_Source then Ada_Mains.Increment_Last; Ada_Mains.Table (Ada_Mains.Last) := new String'(Main); -- Otherwise, put it in the list of other mains else Other_Mains.Increment_Last; Other_Mains.Table (Other_Mains.Last) := Source; end if; end; end loop; -- If C++ is one of the other language, create the shell script -- to do the link. if C_Plus_Plus_Is_Used then Choose_C_Plus_Plus_Link_Process; end if; -- Call gnatmake with the necessary switches for each non-Ada -- main, if there are some. for Main in 1 .. Other_Mains.Last loop declare Source : constant Other_Source := Other_Mains.Table (Main); begin Last_Argument := 0; -- Add -o if -o was specified if Output_File_Name = null then Add_Argument (Dash_o, True); Add_Argument (Get_Name_String (Executable_Of (Project => Main_Project, In_Tree => Project_Tree, Main => Other_Mains.Table (Main).File_Name, Index => 0, Ada_Main => False)), True); end if; -- Call gnatmake with the -B switch Add_Argument (Dash_B, True); -- Add to the linking options the object file of the source Add_Argument (Dash_largs, Verbose_Mode); Add_Argument (Get_Name_String (Source.Object_Name), Verbose_Mode); -- If C++ is one of the language, add the --LINK switch -- to the linking switches. if C_Plus_Plus_Is_Used then Add_C_Plus_Plus_Link_For_Gnatmake; end if; -- Add -margs so that the following switches are for -- gnatmake Add_Argument (Dash_margs, Verbose_Mode); -- And link with gnatmake Compile_Link_With_Gnatmake (Mains_Specified => False); end; end loop; -- If there are also Ada mains, call gnatmake for all these mains if Ada_Mains.Last /= 0 then Last_Argument := 0; -- Put all the Ada mains as the first arguments for Main in 1 .. Ada_Mains.Last loop Add_Argument (Ada_Mains.Table (Main).all, True); end loop; -- If C++ is one of the languages, add the --LINK switch to -- the linking switches. if Data.Languages (C_Plus_Plus_Language_Index) then Add_Argument (Dash_largs, Verbose_Mode); Add_C_Plus_Plus_Link_For_Gnatmake; Add_Argument (Dash_margs, Verbose_Mode); end if; -- And link with gnatmake Compile_Link_With_Gnatmake (Mains_Specified => False); end if; else -- No Ada source in main project -- First, get the linker to invoke if Data.Languages (C_Plus_Plus_Language_Index) then Get_Compiler (C_Plus_Plus_Language_Index); Linker_Name := Compiler_Names (C_Plus_Plus_Language_Index); Linker_Path := Compiler_Paths (C_Plus_Plus_Language_Index); else Get_Compiler (C_Language_Index); Linker_Name := Compiler_Names (C_Language_Index); Linker_Path := Compiler_Paths (C_Language_Index); end if; Link_Done := False; Mains.Reset; -- Get each main, check if it is a source of the main project, -- and if it is, invoke the linker. loop declare Main : constant String := Mains.Next_Main; Main_Id : Name_Id; begin exit when Main'Length = 0; -- Get the file name of the main Name_Len := 0; Add_Str_To_Name_Buffer (Main); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Main_Id := Name_Find; Source_Id := Data.First_Other_Source; -- Check if it is a source of the main project file while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); exit when Source.File_Name = Main_Id; Source_Id := Source.Next; end loop; -- Report an error if it is not if Source_Id = No_Other_Source then Report_Error (Main, "is not a source of project ", Get_Name_String (Data.Name)); else Link_Foreign (Main, Main_Id, Source); end if; end; end loop; -- If no linking was done, report it, except in Quiet Output if (Verbose_Mode or (not Quiet_Output)) and (not Link_Done) then Osint.Write_Program_Name; if Mains.Number_Of_Mains = 1 then -- If there is only one executable, report its name too Write_Str (": """); Mains.Reset; declare Main : constant String := Mains.Next_Main; Main_Id : Name_Id; begin Name_Len := 0; Add_Str_To_Name_Buffer (Main); Main_Id := Name_Find; Write_Str (Get_Name_String (Executable_Of (Project => Main_Project, In_Tree => Project_Tree, Main => Main_Id, Index => 0, Ada_Main => False))); Write_Line (""" up to date"); end; else Write_Line (": all executables up to date"); end if; end if; end if; end if; end Link_Executables; ------------------ -- Report_Error -- ------------------ procedure Report_Error (S1 : String; S2 : String := ""; S3 : String := "") is begin -- If Keep_Going is True, output error message preceded by error header if Keep_Going then Total_Number_Of_Errors := Total_Number_Of_Errors + 1; Write_Str (Error_Header); Write_Str (S1); Write_Str (S2); Write_Str (S3); Write_Eol; -- Otherwise just fail else Osint.Fail (S1, S2, S3); end if; end Report_Error; ------------------------- -- Report_Total_Errors -- ------------------------- procedure Report_Total_Errors (Kind : String) is begin if Total_Number_Of_Errors /= 0 then if Total_Number_Of_Errors = 1 then Osint.Fail ("One ", Kind, " error"); else Osint.Fail ("Total of" & Total_Number_Of_Errors'Img, ' ' & Kind & " errors"); end if; end if; end Report_Total_Errors; -------------- -- Scan_Arg -- -------------- procedure Scan_Arg (Arg : String) is begin pragma Assert (Arg'First = 1); if Arg'Length = 0 then return; end if; -- If preceding switch was -P, a project file name need to be -- specified, not a switch. if Project_File_Name_Expected then if Arg (1) = '-' then Osint.Fail ("project file name missing after -P"); else Project_File_Name_Expected := False; Project_File_Name := new String'(Arg); end if; -- If preceding switch was -o, an executable name need to be -- specified, not a switch. elsif Output_File_Name_Expected then if Arg (1) = '-' then Osint.Fail ("output file name missing after -o"); else Output_File_Name_Expected := False; Output_File_Name := new String'(Arg); end if; -- Set the processor/language for the following switches -- -cargs: Ada compiler arguments elsif Arg = "-cargs" then Current_Language := Ada_Language_Index; Current_Processor := Compiler; elsif Arg'Length > 7 and then Arg (1 .. 7) = "-cargs:" then Name_Len := 0; Add_Str_To_Name_Buffer (Arg (8 .. Arg'Last)); To_Lower (Name_Buffer (1 .. Name_Len)); declare Lang : constant Name_Id := Name_Find; begin Current_Language := Language_Indexes.Get (Lang); if Current_Language = No_Language_Index then Add_Language_Name (Lang); Current_Language := Last_Language_Index; end if; Current_Processor := Compiler; end; elsif Arg = "-largs" then Current_Processor := Linker; -- -gargs: gprmake elsif Arg = "-gargs" then Current_Processor := None; -- A special test is needed for the -o switch within a -largs since -- that is another way to specify the name of the final executable. elsif Current_Processor = Linker and then Arg = "-o" then Osint.Fail ("switch -o not allowed within a -largs. Use -o directly."); -- If current processor is not gprmake directly, store the option in -- the appropriate table. elsif Current_Processor /= None then Add_Option (Arg); -- Switches start with '-' elsif Arg (1) = '-' then if Arg = "-c" then Compile_Only := True; -- Make sure that when a main is specified and switch -c is used, -- only the main(s) is/are compiled. if Mains.Number_Of_Mains > 0 then Unique_Compile := True; end if; elsif Arg = "-d" then Display_Compilation_Progress := True; elsif Arg = "-f" then Force_Compilations := True; elsif Arg = "-h" then Usage; elsif Arg = "-k" then Keep_Going := True; elsif Arg = "-o" then if Output_File_Name /= null then Osint.Fail ("cannot specify several -o switches"); else Output_File_Name_Expected := True; end if; elsif Arg'Length >= 2 and then Arg (2) = 'P' then if Project_File_Name /= null then Osint.Fail ("cannot have several project files specified"); elsif Arg'Length = 2 then Project_File_Name_Expected := True; else Project_File_Name := new String'(Arg (3 .. Arg'Last)); end if; elsif Arg = "-q" then Quiet_Output := True; elsif Arg = "-u" then Unique_Compile := True; Compile_Only := True; elsif Arg = "-v" then Verbose_Mode := True; Copyright; elsif Arg'Length = 4 and then Arg (1 .. 3) = "-vP" and then Arg (4) in '0' .. '2' then case Arg (4) is when '0' => Current_Verbosity := Prj.Default; when '1' => Current_Verbosity := Prj.Medium; when '2' => Current_Verbosity := Prj.High; when others => null; end case; elsif Arg'Length >= 3 and then Arg (2) = 'X' and then Is_External_Assignment (Arg) then -- Is_External_Assignment has side effects when it returns True -- Record the -X switch, so that they can be passed to gnatmake, -- if gnatmake is called. X_Switches.Increment_Last; X_Switches.Table (X_Switches.Last) := new String'(Arg); else Osint.Fail ("illegal option """, Arg, """"); end if; else -- Not a switch: must be a main Mains.Add_Main (Arg); -- Make sure that when a main is specified and switch -c is used, -- only the main(s) is/are compiled. if Compile_Only then Unique_Compile := True; end if; end if; end Scan_Arg; ----------------- -- Strip_CR_LF -- ----------------- function Strip_CR_LF (Text : String) return String is To : String (1 .. Text'Length); Index_To : Natural := 0; begin for Index in Text'Range loop if (Text (Index) /= ASCII.CR) and then (Text (Index) /= ASCII.LF) then Index_To := Index_To + 1; To (Index_To) := Text (Index); end if; end loop; return To (1 .. Index_To); end Strip_CR_LF; ----------- -- Usage -- ----------- procedure Usage is begin if not Usage_Output then Usage_Output := True; Copyright; Write_Str ("Usage: "); Osint.Write_Program_Name; Write_Str (" -P<project file> [opts] [name] {"); for Lang in First_Language_Indexes loop Write_Str ("[-cargs:lang opts] "); end loop; Write_Str ("[-largs opts] [-gargs opts]}"); Write_Eol; Write_Eol; Write_Str (" name is zero or more file names"); Write_Eol; Write_Eol; -- GPRMAKE switches Write_Str ("gprmake switches:"); Write_Eol; -- Line for -c Write_Str (" -c Compile only"); Write_Eol; -- Line for -f Write_Str (" -f Force recompilations"); Write_Eol; -- Line for -k Write_Str (" -k Keep going after compilation errors"); Write_Eol; -- Line for -o Write_Str (" -o name Choose an alternate executable name"); Write_Eol; -- Line for -P Write_Str (" -Pproj Use GNAT Project File proj"); Write_Eol; -- Line for -q Write_Str (" -q Be quiet/terse"); Write_Eol; -- Line for -u Write_Str (" -u Unique compilation. Only compile the given files"); Write_Eol; -- Line for -v Write_Str (" -v Verbose output"); Write_Eol; -- Line for -vPx Write_Str (" -vPx Specify verbosity when parsing Project Files"); Write_Eol; -- Line for -X Write_Str (" -Xnm=val Specify an external reference for " & "Project Files"); Write_Eol; Write_Eol; -- Line for -cargs Write_Line (" -cargs opts opts are passed to the Ada compiler"); -- Line for -cargs:lang Write_Line (" -cargs:<lang> opts"); Write_Line (" opts are passed to the compiler " & "for language < lang > "); -- Line for -largs Write_Str (" -largs opts opts are passed to the linker"); Write_Eol; -- Line for -gargs Write_Str (" -gargs opts opts directly interpreted by gprmake"); Write_Eol; Write_Eol; end if; end Usage; begin Makeutl.Do_Fail := Report_Error'Access; end Makegpr;
true
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- PI:NAME:<NAME>END_PI -- -- -- -- B o d y -- -- -- -- Copyright (C) 2004-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Command_Line; use Ada.Command_Line; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Text_IO; use Ada.Text_IO; with Ada.Unchecked_Deallocation; with Csets; with Gnatvsn; with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Dynamic_Tables; with GNAT.Expect; use GNAT.Expect; with GNAT.HTable; with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.Regpat; use GNAT.Regpat; with Makeutl; use Makeutl; with MLib.Tgt; use MLib.Tgt; with Namet; use Namet; with Output; use Output; with Opt; use Opt; with Osint; use Osint; with Prj; use Prj; with Prj.Pars; with Prj.Util; use Prj.Util; with Snames; use Snames; with System; with System.Case_Util; use System.Case_Util; with Table; with Types; use Types; package body Makegpr is Max_In_Archives : constant := 50; -- The maximum number of arguments for a single invocation of the -- Archive Indexer (ar). No_Argument : aliased Argument_List := (1 .. 0 => null); -- Null argument list representing case of no arguments FD : Process_Descriptor; -- The process descriptor used when invoking a non GNU compiler with -M -- and getting the output with GNAT.Expect. Line_Matcher : constant Pattern_Matcher := Compile ("^.*?\n", Single_Line); -- Pattern for GNAT.Expect for the invocation of a non GNU compiler with -M Name_Ide : Name_Id; Name_Compiler_Command : Name_Id; -- Names of package IDE and its attribute Compiler_Command. -- Set up by Initialize. Unique_Compile : Boolean := False; -- True when switch -u is used on the command line type Source_Index_Rec is record Project : Project_Id; Id : Other_Source_Id; Found : Boolean := False; end record; -- Used as Source_Indexes component to check if archive needs to be rebuilt type Source_Index_Array is array (Positive range <>) of Source_Index_Rec; type Source_Indexes_Ref is access Source_Index_Array; procedure Free is new Ada.Unchecked_Deallocation (Source_Index_Array, Source_Indexes_Ref); Initial_Source_Index_Count : constant Positive := 20; Source_Indexes : Source_Indexes_Ref := new Source_Index_Array (1 .. Initial_Source_Index_Count); -- A list of the Other_Source_Ids of a project file, with an indication -- that they have been found in the archive dependency file. Last_Source : Natural := 0; -- The index of the last valid component of Source_Indexes Compiler_Names : array (First_Language_Indexes) of String_Access; -- The names of the compilers to be used. Set up by Get_Compiler. -- Used to display the commands spawned. Gnatmake_String : constant String_Access := new String'("gnatmake"); GCC_String : constant String_Access := new String'("gcc"); G_Plus_Plus_String : constant String_Access := new String'("g++"); Default_Compiler_Names : constant array (First_Language_Indexes range Ada_Language_Index .. C_Plus_Plus_Language_Index) of String_Access := (Ada_Language_Index => Gnatmake_String, C_Language_Index => GCC_String, C_Plus_Plus_Language_Index => G_Plus_Plus_String); Compiler_Paths : array (First_Language_Indexes) of String_Access; -- The path names of the compiler to be used. Set up by Get_Compiler. -- Used to spawn compiling/linking processes. Compiler_Is_Gcc : array (First_Language_Indexes) of Boolean; -- An indication that a compiler is a GCC compiler, to be able to use -- specific GCC switches. Archive_Builder_Path : String_Access := null; -- The path name of the archive builder (ar). To be used when spawning -- ar commands. Archive_Indexer_Path : String_Access := null; -- The path name of the archive indexer (ranlib), if it exists Copyright_Output : Boolean := False; Usage_Output : Boolean := False; -- Flags to avoid multiple displays of Copyright notice and of Usage Output_File_Name : String_Access := null; -- The name given after a switch -o Output_File_Name_Expected : Boolean := False; -- True when last switch was -o Project_File_Name : String_Access := null; -- The name of the project file specified with switch -P Project_File_Name_Expected : Boolean := False; -- True when last switch was -P Naming_String : aliased String := "naming"; Builder_String : aliased String := "builder"; Compiler_String : aliased String := "compiler"; Binder_String : aliased String := "binder"; Linker_String : aliased String := "linker"; -- Name of packages to be checked when parsing/processing project files List_Of_Packages : aliased String_List := (Naming_String 'Access, Builder_String 'Access, Compiler_String 'Access, Binder_String 'Access, Linker_String 'Access); Packages_To_Check : constant String_List_Access := List_Of_Packages'Access; -- List of the packages to be checked when parsing/processing project files Project_Tree : constant Project_Tree_Ref := new Project_Tree_Data; Main_Project : Project_Id; -- The project id of the main project type Processor is (None, Linker, Compiler); Current_Processor : Processor := None; -- This variable changes when switches -*args are used Current_Language : Language_Index := Ada_Language_Index; -- The compiler language to consider when Processor is Compiler package Comp_Opts is new GNAT.Dynamic_Tables (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100); Options : array (First_Language_Indexes) of Comp_Opts.Instance; -- Tables to store compiling options for the different compilers package Linker_Options is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Makegpr.Linker_Options"); -- Table to store the linking options package Library_Opts is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Makegpr.Library_Opts"); -- Table to store the linking options package Ada_Mains is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Makegpr.Ada_Mains"); -- Table to store the Ada mains, either specified on the command line -- or found in attribute Main of the main project file. package Other_Mains is new Table.Table (Table_Component_Type => Other_Source, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 20, Table_Increment => 100, Table_Name => "Makegpr.Other_Mains"); -- Table to store the mains of languages other than Ada, either specified -- on the command line or found in attribute Main of the main project file. package Sources_Compiled is new GNAT.HTable.Simple_HTable (Header_Num => Header_Num, Element => Boolean, No_Element => False, Key => PI:NAME:<NAME>END_PI, Hash => Hash, Equal => "="); package X_Switches is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 2, Table_Increment => 100, Table_Name => "Makegpr.X_Switches"); -- Table to store the -X switches to be passed to gnatmake Initial_Argument_Count : constant Positive := 20; type Boolean_Array is array (Positive range <>) of Boolean; type Booleans is access Boolean_Array; procedure Free is new Ada.Unchecked_Deallocation (Boolean_Array, Booleans); Arguments : Argument_List_Access := new Argument_List (1 .. Initial_Argument_Count); -- Used to store lists of arguments to be used when spawning a process Arguments_Displayed : Booleans := new Boolean_Array (1 .. Initial_Argument_Count); -- For each argument in Arguments, indicate if the argument should be -- displayed when procedure Display_Command is called. Last_Argument : Natural := 0; -- Index of the last valid argument in Arguments package Cache_Args is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 200, Table_Increment => 50, Table_Name => "Makegpr.Cache_Args"); -- A table to cache arguments, to avoid multiple allocation of the same -- strings. It is not possible to use a hash table, because String is -- an unconstrained type. -- Various switches used when spawning processes: Dash_B_String : aliased String := "-B"; Dash_B : constant String_Access := Dash_B_String'Access; Dash_c_String : aliased String := "-c"; Dash_c : constant String_Access := Dash_c_String'Access; Dash_cargs_String : aliased String := "-cargs"; Dash_cargs : constant String_Access := Dash_cargs_String'Access; Dash_d_String : aliased String := "-d"; Dash_d : constant String_Access := Dash_d_String'Access; Dash_f_String : aliased String := "-f"; Dash_f : constant String_Access := Dash_f_String'Access; Dash_k_String : aliased String := "-k"; Dash_k : constant String_Access := Dash_k_String'Access; Dash_largs_String : aliased String := "-largs"; Dash_largs : constant String_Access := Dash_largs_String'Access; Dash_M_String : aliased String := "-M"; Dash_M : constant String_Access := Dash_M_String'Access; Dash_margs_String : aliased String := "-margs"; Dash_margs : constant String_Access := Dash_margs_String'Access; Dash_o_String : aliased String := "-o"; Dash_o : constant String_Access := Dash_o_String'Access; Dash_P_String : aliased String := "-P"; Dash_P : constant String_Access := Dash_P_String'Access; Dash_q_String : aliased String := "-q"; Dash_q : constant String_Access := Dash_q_String'Access; Dash_u_String : aliased String := "-u"; Dash_u : constant String_Access := Dash_u_String'Access; Dash_v_String : aliased String := "-v"; Dash_v : constant String_Access := Dash_v_String'Access; Dash_vP1_String : aliased String := "-vP1"; Dash_vP1 : constant String_Access := Dash_vP1_String'Access; Dash_vP2_String : aliased String := "-vP2"; Dash_vP2 : constant String_Access := Dash_vP2_String'Access; Dash_x_String : aliased String := "-x"; Dash_x : constant String_Access := Dash_x_String'Access; r_String : aliased String := "r"; r : constant String_Access := r_String'Access; CPATH : constant String := "CPATH"; -- The environment variable to set when compiler is a GCC compiler -- to indicate the include directory path. Current_Include_Paths : array (First_Language_Indexes) of String_Access; -- A cache for the paths of included directories, to avoid setting -- env var CPATH unnecessarily. C_Plus_Plus_Is_Used : Boolean := False; -- True when there are sources in C++ Link_Options_Switches : Argument_List_Access := null; -- The link options coming from the attributes Linker'Linker_Options in -- project files imported, directly or indirectly, by the main project. Total_Number_Of_Errors : Natural := 0; -- Used when Keep_Going is True (switch -k) to keep the total number -- of compilation/linking errors, to report at the end of execution. Need_To_Rebuild_Global_Archive : Boolean := False; Error_Header : constant String := "*** ERROR: "; -- The beginning of error message, when Keep_Going is True Need_To_Relink : Boolean := False; -- True when an executable of a language other than Ada need to be linked Global_Archive_Exists : Boolean := False; -- True if there is a non empty global archive, to prevent creation -- of such archives. Path_Option : String_Access; -- The path option switch, when supported package Lib_Path is new Table.Table (Table_Component_Type => Character, Table_Index_Type => Integer, Table_Low_Bound => 1, Table_Initial => 200, Table_Increment => 50, Table_Name => "Makegpr.Lib_Path"); -- A table to compute the path to put in the path option switch, when it -- is supported. procedure Add_Archives (For_Gnatmake : Boolean); -- Add to Arguments the list of archives for linking an executable procedure Add_Argument (Arg : String_Access; Display : Boolean); procedure Add_Argument (Arg : String; Display : Boolean); -- Add an argument to Arguments. Reallocate if necessary procedure Add_Arguments (Args : Argument_List; Display : Boolean); -- Add a list of arguments to Arguments. Reallocate if necessary procedure Add_Option (Arg : String); -- Add a switch for the Ada, C or C++ compiler, or for the linker. -- The table where this option is stored depends on the values of -- Current_Processor and Current_Language. procedure Add_Search_Directories (Data : Project_Data; Language : First_Language_Indexes); -- Either add to the Arguments the necessary -I switches needed to -- compile, or, when compiler is gcc/g++, set up the C*INCLUDE_PATH -- environment variable, if necessary. procedure Add_Source_Id (Project : Project_Id; Id : Other_Source_Id); -- Add a source id to Source_Indexes, with Found set to False procedure Add_Switches (Data : Project_Data; Proc : Processor; Language : Language_Index; File_Name : Name_Id); -- Add to Arguments the switches, if any, for a source (attribute Switches) -- or language (attribute Default_Switches), coming from package Compiler -- or Linker (depending on Proc) of a specified project file. procedure Build_Global_Archive; -- Build the archive for the main project procedure Build_Library (Project : Project_Id; Unconditionally : Boolean); -- Build the library for a library project. If Unconditionally is -- False, first check if the library is up to date, and build it only -- if it is not. procedure Check (Option : String); -- Check that a switch coming from a project file is not the concatenation -- of several valid switch, for example "-g -v". If it is, issue a warning. procedure Check_Archive_Builder; -- Check if the archive builder (ar) is there procedure Check_Compilation_Needed (Source : Other_Source; Need_To_Compile : out Boolean); -- Check if a source of a language other than Ada needs to be compiled or -- recompiled. procedure Check_For_C_Plus_Plus; -- Check if C++ is used in at least one project procedure Compile (Source_Id : Other_Source_Id; Data : Project_Data; Local_Errors : in out Boolean); -- Compile one non-Ada source procedure Compile_Individual_Sources; -- Compile the sources specified on the command line, when in -- Unique_Compile mode. procedure Compile_Link_With_Gnatmake (Mains_Specified : Boolean); -- Compile/Link with gnatmake when there are Ada sources in the main -- project. Arguments may already contain options to be used by -- gnatmake. Used for both Ada mains and mains of other languages. -- When Compile_Only is True, do not use the linking options procedure Compile_Sources; -- Compile the sources of languages other than Ada, if necessary procedure Copyright; -- Output the Copyright notice procedure Create_Archive_Dependency_File (Name : String; First_Source : Other_Source_Id); -- Create the archive dependency file for a library project procedure Create_Global_Archive_Dependency_File (Name : String); -- Create the archive depenency file for the main project procedure Display_Command (Name : String; Path : String_Access; CPATH : String_Access := null); -- Display the command for a spawned process, if in Verbose_Mode or -- not in Quiet_Output. procedure Get_Compiler (For_Language : First_Language_Indexes); -- Find the compiler name and path name for a specified programming -- language, if not already done. Results are in the corresponding -- elements of arrays Compiler_Names and Compiler_Paths. Name of compiler -- is found in package IDE of the main project, or defaulted. -- Fail if compiler cannot be found on the path. For the Ada language, -- gnatmake, rather than the Ada compiler is returned. procedure Get_Imported_Directories (Project : Project_Id; Data : in out Project_Data); -- Find the necessary switches -I to be used when compiling sources -- of languages other than Ada, in a specified project file. Cache the -- result in component Imported_Directories_Switches of the project data. -- For gcc/g++ compilers, get the value of the C*_INCLUDE_PATH, instead. procedure Initialize; -- Do the necessary package initialization and process the command line -- arguments. function Is_Included_In_Global_Archive (Object_Name : Name_Id; Project : Project_Id) return Boolean; -- Return True if the object Object_Name is not overridden by a source -- in a project extending project Project. procedure Link_Executables; -- Link executables procedure Report_Error (S1 : String; S2 : String := ""; S3 : String := ""); -- Report an error. If Keep_Going is False, just call Osint.Fail. -- If Keep_Going is True, display the error and increase the total number -- of errors. procedure Report_Total_Errors (Kind : String); -- If Total_Number_Of_Errors is not zero, report it, and fail procedure Scan_Arg (Arg : String); -- Process one command line argument function Strip_CR_LF (Text : String) return String; -- Remove characters ASCII.CR and ASCII.LF from a String procedure Usage; -- Display the usage ------------------ -- Add_Archives -- ------------------ procedure Add_Archives (For_Gnatmake : Boolean) is Last_Arg : constant Natural := Last_Argument; -- The position of the last argument before adding the archives. -- Used to reverse the order of the arguments added when processing -- the archives. procedure Recursive_Add_Archives (Project : Project_Id); -- Recursive procedure to add the archive of a project file, if any, -- then call itself for the project imported. ---------------------------- -- Recursive_Add_Archives -- ---------------------------- procedure Recursive_Add_Archives (Project : Project_Id) is Data : Project_Data; Imported : Project_List; Prj : Project_Id; procedure Add_Archive_Path; -- For a library project or the main project, add the archive -- path to the arguments. ---------------------- -- Add_Archive_Path -- ---------------------- procedure Add_Archive_Path is Increment : Positive; Prev_Last : Positive; begin if Data.Library then -- If it is a library project file, nothing to do if -- gnatmake will be invoked, because gnatmake will take -- care of it, even if the library is not an Ada library. if not For_Gnatmake then if Data.Library_Kind = Static then Add_Argument (Get_Name_String (Data.Library_Dir) & Directory_Separator & "lib" & Get_Name_String (Data.Library_Name) & '.' & Archive_Ext, Verbose_Mode); else -- As we first insert in the reverse order, -- -L<dir> is put after -l<lib> Add_Argument ("-l" & Get_Name_String (Data.Library_Name), Verbose_Mode); Get_Name_String (Data.Library_Dir); Add_Argument ("-L" & Name_Buffer (1 .. Name_Len), Verbose_Mode); -- If there is a run path option, prepend this -- directory to the library path. It is probable -- that the order of the directories in the path -- option is not important, but just in case -- put the directories in the same order as the -- libraries. if Path_Option /= null then -- If it is not the first directory, make room -- at the beginning of the table, including -- for a path separator. if Lib_Path.Last > 0 then Increment := Name_Len + 1; Prev_Last := Lib_Path.Last; Lib_Path.Set_Last (Prev_Last + Increment); for Index in reverse 1 .. Prev_Last loop Lib_Path.Table (Index + Increment) := Lib_Path.Table (Index); end loop; Lib_Path.Table (Increment) := Path_Separator; else -- If it is the first directory, just set -- Last to the length of the directory. Lib_Path.Set_Last (Name_Len); end if; -- Put the directory at the beginning of the -- table. for Index in 1 .. Name_Len loop Lib_Path.Table (Index) := Name_Buffer (Index); end loop; end if; end if; end if; -- For a non-library project, the only archive needed -- is the one for the main project, if there is one. elsif Project = Main_Project and then Global_Archive_Exists then Add_Argument (Get_Name_String (Data.Object_Directory) & Directory_Separator & "lib" & Get_Name_String (Data.Name) & '.' & Archive_Ext, Verbose_Mode); end if; end Add_Archive_Path; begin -- Nothing to do when there is no project specified if Project /= No_Project then Data := Project_Tree.Projects.Table (Project); -- Nothing to do if the project has already been processed if not Data.Seen then -- Mark the project as processed, to avoid processing it again Project_Tree.Projects.Table (Project).Seen := True; Recursive_Add_Archives (Data.Extends); Imported := Data.Imported_Projects; -- Call itself recursively for all imported projects while Imported /= Empty_Project_List loop Prj := Project_Tree.Project_Lists.Table (Imported).Project; if Prj /= No_Project then while Project_Tree.Projects.Table (Prj).Extended_By /= No_Project loop Prj := Project_Tree.Projects.Table (Prj).Extended_By; end loop; Recursive_Add_Archives (Prj); end if; Imported := Project_Tree.Project_Lists.Table (Imported).Next; end loop; -- If there is sources of language other than Ada in this -- project, add the path of the archive to Arguments. if Project = Main_Project or else Data.Other_Sources_Present then Add_Archive_Path; end if; end if; end if; end Recursive_Add_Archives; -- Start of processing for Add_Archives begin -- First, mark all projects as not processed for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Project_Tree.Projects.Table (Project).Seen := False; end loop; -- Take care of the run path option if Path_Option = null then Path_Option := MLib.Linker_Library_Path_Option; end if; Lib_Path.Set_Last (0); -- Add archives in the reverse order Recursive_Add_Archives (Main_Project); -- And reverse the order declare First : Positive := Last_Arg + 1; Last : Natural := Last_Argument; Temp : String_Access; begin while First < Last loop Temp := Arguments (First); Arguments (First) := Arguments (Last); Arguments (Last) := Temp; First := First + 1; Last := Last - 1; end loop; end; end Add_Archives; ------------------ -- Add_Argument -- ------------------ procedure Add_Argument (Arg : String_Access; Display : Boolean) is begin -- Nothing to do if no argument is specified or if argument is empty if Arg /= null or else Arg'Length = 0 then -- Reallocate arrays if necessary if Last_Argument = Arguments'Last then declare New_Arguments : constant Argument_List_Access := new Argument_List (1 .. Last_Argument + Initial_Argument_Count); New_Arguments_Displayed : constant Booleans := new Boolean_Array (1 .. Last_Argument + Initial_Argument_Count); begin New_Arguments (Arguments'Range) := Arguments.all; -- To avoid deallocating the strings, nullify all components -- of Arguments before calling Free. Arguments.all := (others => null); Free (Arguments); Arguments := New_Arguments; New_Arguments_Displayed (Arguments_Displayed'Range) := Arguments_Displayed.all; Free (Arguments_Displayed); Arguments_Displayed := New_Arguments_Displayed; end; end if; -- Add the argument and its display indication Last_Argument := Last_Argument + 1; Arguments (Last_Argument) := Arg; Arguments_Displayed (Last_Argument) := Display; end if; end Add_Argument; procedure Add_Argument (Arg : String; Display : Boolean) is Argument : String_Access := null; begin -- Nothing to do if argument is empty if Arg'Length > 0 then -- Check if the argument is already in the Cache_Args table. -- If it is already there, reuse the allocated value. for Index in 1 .. Cache_Args.Last loop if Cache_Args.Table (Index).all = Arg then Argument := Cache_Args.Table (Index); exit; end if; end loop; -- If the argument is not in the cache, create a new entry in the -- cache. if Argument = null then Argument := new String'(Arg); Cache_Args.Increment_Last; Cache_Args.Table (Cache_Args.Last) := Argument; end if; -- And add the argument Add_Argument (Argument, Display); end if; end Add_Argument; ------------------- -- Add_Arguments -- ------------------- procedure Add_Arguments (Args : Argument_List; Display : Boolean) is begin -- Reallocate the arrays, if necessary if Last_Argument + Args'Length > Arguments'Last then declare New_Arguments : constant Argument_List_Access := new Argument_List (1 .. Last_Argument + Args'Length + Initial_Argument_Count); New_Arguments_Displayed : constant Booleans := new Boolean_Array (1 .. Last_Argument + Args'Length + Initial_Argument_Count); begin New_Arguments (1 .. Last_Argument) := Arguments (1 .. Last_Argument); -- To avoid deallocating the strings, nullify all components -- of Arguments before calling Free. Arguments.all := (others => null); Free (Arguments); Arguments := New_Arguments; New_Arguments_Displayed (1 .. Last_Argument) := Arguments_Displayed (1 .. Last_Argument); Free (Arguments_Displayed); Arguments_Displayed := New_Arguments_Displayed; end; end if; -- Add the new arguments and the display indications Arguments (Last_Argument + 1 .. Last_Argument + Args'Length) := Args; Arguments_Displayed (Last_Argument + 1 .. Last_Argument + Args'Length) := (others => Display); Last_Argument := Last_Argument + Args'Length; end Add_Arguments; ---------------- -- Add_Option -- ---------------- procedure Add_Option (Arg : String) is Option : constant String_Access := new String'(Arg); begin case Current_Processor is when None => null; when Linker => -- Add option to the linker table Linker_Options.Increment_Last; Linker_Options.Table (Linker_Options.Last) := Option; when Compiler => -- Add option to the compiler option table, depending on the -- value of Current_Language. Comp_Opts.Increment_Last (Options (Current_Language)); Options (Current_Language).Table (Comp_Opts.Last (Options (Current_Language))) := Option; end case; end Add_Option; ------------------- -- Add_Source_Id -- ------------------- procedure Add_Source_Id (Project : Project_Id; Id : Other_Source_Id) is begin -- Reallocate the array, if necessary if Last_Source = Source_Indexes'Last then declare New_Indexes : constant Source_Indexes_Ref := new Source_Index_Array (1 .. Source_Indexes'Last + Initial_Source_Index_Count); begin New_Indexes (Source_Indexes'Range) := Source_Indexes.all; Free (Source_Indexes); Source_Indexes := New_Indexes; end; end if; Last_Source := Last_Source + 1; Source_Indexes (Last_Source) := (Project, Id, False); end Add_Source_Id; ---------------------------- -- Add_Search_Directories -- ---------------------------- procedure Add_Search_Directories (Data : Project_Data; Language : First_Language_Indexes) is begin -- If a GNU compiler is used, set the CPATH environment variable, -- if it does not already has the correct value. if Compiler_Is_Gcc (Language) then if Current_Include_Paths (Language) /= Data.Include_Path then Current_Include_Paths (Language) := Data.Include_Path; Setenv (CPATH, Data.Include_Path.all); end if; else Add_Arguments (Data.Imported_Directories_Switches.all, Verbose_Mode); end if; end Add_Search_Directories; ------------------ -- Add_Switches -- ------------------ procedure Add_Switches (Data : Project_Data; Proc : Processor; Language : Language_Index; File_Name : Name_Id) is Switches : Variable_Value; -- The switches, if any, for the file/language Pkg : Package_Id; -- The id of the package where to look for the switches Defaults : Array_Element_Id; -- The Default_Switches associative array Switches_Array : Array_Element_Id; -- The Switches associative array Element_Id : String_List_Id; Element : String_Element; begin -- First, choose the proper package case Proc is when None => raise Program_Error; when Linker => Pkg := Value_Of (Name_Linker, Data.Decl.Packages, Project_Tree); when Compiler => Pkg := Value_Of (Name_Compiler, Data.Decl.Packages, Project_Tree); end case; if Pkg /= No_Package then -- Get the Switches ("file name"), if they exist Switches_Array := Prj.Util.Value_Of (Name => Name_Switches, In_Arrays => Project_Tree.Packages.Table (Pkg).Decl.Arrays, In_Tree => Project_Tree); Switches := Prj.Util.Value_Of (Index => File_Name, Src_Index => 0, In_Array => Switches_Array, In_Tree => Project_Tree); -- Otherwise, get the Default_Switches ("language"), if they exist if Switches = Nil_Variable_Value then Defaults := Prj.Util.Value_Of (Name => Name_Default_Switches, In_Arrays => Project_Tree.Packages.Table (Pkg).Decl.Arrays, In_Tree => Project_Tree); Switches := Prj.Util.Value_Of (Index => Language_Names.Table (Language), Src_Index => 0, In_Array => Defaults, In_Tree => Project_Tree); end if; -- If there are switches, add them to Arguments if Switches /= Nil_Variable_Value then Element_Id := Switches.Values; while Element_Id /= Nil_String loop Element := Project_Tree.String_Elements.Table (Element_Id); if Element.Value /= No_Name then Get_Name_String (Element.Value); if not Quiet_Output then -- When not in quiet output (no -q), check that the -- switch is not the concatenation of several valid -- switches, such as "-g -v". If it is, issue a warning. Check (Option => Name_Buffer (1 .. Name_Len)); end if; Add_Argument (Name_Buffer (1 .. Name_Len), True); end if; Element_Id := Element.Next; end loop; end if; end if; end Add_Switches; -------------------------- -- Build_Global_Archive -- -------------------------- procedure Build_Global_Archive is Data : Project_Data := Project_Tree.Projects.Table (Main_Project); Source_Id : Other_Source_Id; S_Id : Other_Source_Id; Source : Other_Source; Success : Boolean; Archive_Name : constant String := "lib" & Get_Name_String (Data.Name) & '.' & Archive_Ext; -- The name of the archive file for this project Archive_Dep_Name : constant String := "lib" & Get_Name_String (Data.Name) & ".deps"; -- The name of the archive dependency file for this project Need_To_Rebuild : Boolean := Need_To_Rebuild_Global_Archive; -- When True, archive will be rebuilt File : Prj.Util.Text_File; Object_Path : Name_Id; Time_Stamp : Time_Stamp_Type; Saved_Last_Argument : Natural; First_Object : Natural; Discard : Boolean; begin Check_Archive_Builder; Change_Dir (Get_Name_String (Data.Object_Directory)); if not Need_To_Rebuild then if Verbose_Mode then Write_Str (" Checking "); Write_Line (Archive_Name); end if; -- If the archive does not exist, of course it needs to be built if not Is_Regular_File (Archive_Name) then Need_To_Rebuild := True; if Verbose_Mode then Write_Line (" -> archive does not exist"); end if; -- Archive does exist else -- Check the archive dependency file Open (File, Archive_Dep_Name); -- If the archive dependency file does not exist, we need to -- to rebuild the archive and to create its dependency file. if not Is_Valid (File) then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Str (Archive_Dep_Name); Write_Line (" does not exist"); end if; else -- Put all sources of language other than Ada in -- Source_Indexes. declare Local_Data : Project_Data; begin Last_Source := 0; for Proj in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Local_Data := Project_Tree.Projects.Table (Proj); if not Local_Data.Library then Source_Id := Local_Data.First_Other_Source; while Source_Id /= No_Other_Source loop Add_Source_Id (Proj, Source_Id); Source_Id := Project_Tree.Other_Sources.Table (Source_Id).Next; end loop; end if; end loop; end; -- Read the dependency file, line by line while not End_Of_File (File) loop Get_Line (File, Name_Buffer, Name_Len); -- First line is the path of the object file Object_Path := Name_Find; Source_Id := No_Other_Source; -- Check if this object file is for a source of this project for S in 1 .. Last_Source loop S_Id := Source_Indexes (S).Id; Source := Project_Tree.Other_Sources.Table (S_Id); if (not Source_Indexes (S).Found) and then Source.Object_Path = Object_Path then -- We have found the object file: get the source -- data, and mark it as found. Source_Id := S_Id; Source_Indexes (S).Found := True; exit; end if; end loop; -- If it is not for a source of this project, then the -- archive needs to be rebuilt. if Source_Id = No_Other_Source then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> "); Write_Str (Get_Name_String (Object_Path)); Write_Line (" is not an object of any project"); end if; exit; end if; -- The second line is the time stamp of the object file. -- If there is no next line, then the dependency file is -- truncated, and the archive need to be rebuilt. if End_Of_File (File) then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Line (" is truncated"); end if; exit; end if; Get_Line (File, Name_Buffer, Name_Len); -- If the line has the wrong number of characters, then -- the dependency file is incorrectly formatted, and the -- archive needs to be rebuilt. if Name_Len /= Time_Stamp_Length then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Line (" is incorrectly formatted (time stamp)"); end if; exit; end if; Time_Stamp := Time_Stamp_Type (Name_Buffer (1 .. Name_Len)); -- If the time stamp in the dependency file is different -- from the time stamp of the object file, then the archive -- needs to be rebuilt. if Time_Stamp /= Source.Object_TS then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> time stamp of "); Write_Str (Get_Name_String (Object_Path)); Write_Str (" is incorrect in the archive"); Write_Line (" dependency file"); end if; exit; end if; end loop; Close (File); end if; end if; end if; if not Need_To_Rebuild then if Verbose_Mode then Write_Line (" -> up to date"); end if; -- No need to create a global archive, if there is no object -- file to put into. Global_Archive_Exists := Last_Source /= 0; -- Archive needs to be rebuilt else -- If archive already exists, first delete it -- Comment needed on why we discard result??? if Is_Regular_File (Archive_Name) then Delete_File (Archive_Name, Discard); end if; Last_Argument := 0; -- Start with the options found in MLib.Tgt (usually just "rc") Add_Arguments (Archive_Builder_Options.all, True); -- Followed by the archive name Add_Argument (Archive_Name, True); First_Object := Last_Argument; -- Followed by all the object files of the non library projects for Proj in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Data := Project_Tree.Projects.Table (Proj); if not Data.Library then Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); -- Only include object file name that have not been -- overriden in extending projects. if Is_Included_In_Global_Archive (Source.Object_Name, Proj) then Add_Argument (Get_Name_String (Source.Object_Path), Verbose_Mode); end if; Source_Id := Source.Next; end loop; end if; end loop; -- No need to create a global archive, if there is no object -- file to put into. Global_Archive_Exists := Last_Argument > First_Object; if Global_Archive_Exists then -- If the archive is built, then linking will need to occur -- unconditionally. Need_To_Relink := True; -- Spawn the archive builder (ar) Saved_Last_Argument := Last_Argument; Last_Argument := First_Object + Max_In_Archives; loop if Last_Argument > Saved_Last_Argument then Last_Argument := Saved_Last_Argument; end if; Display_Command (Archive_Builder, Archive_Builder_Path); Spawn (Archive_Builder_Path.all, Arguments (1 .. Last_Argument), Success); exit when not Success; exit when Last_Argument = Saved_Last_Argument; Arguments (1) := r; Arguments (3 .. Saved_Last_Argument - Last_Argument + 2) := Arguments (Last_Argument + 1 .. Saved_Last_Argument); Saved_Last_Argument := Saved_Last_Argument - Last_Argument + 2; end loop; -- If the archive was built, run the archive indexer (ranlib) -- if there is one. if Success then -- If the archive was built, run the archive indexer (ranlib), -- if there is one. if Archive_Indexer_Path /= null then Last_Argument := 0; Add_Argument (Archive_Name, True); Display_Command (Archive_Indexer, Archive_Indexer_Path); Spawn (Archive_Indexer_Path.all, Arguments (1 .. 1), Success); if not Success then -- Running ranlib failed, delete the dependency file, -- if it exists. if Is_Regular_File (Archive_Dep_Name) then Delete_File (Archive_Dep_Name, Success); end if; -- And report the error Report_Error ("running" & Archive_Indexer & " for project """, Get_Name_String (Data.Name), """ failed"); return; end if; end if; -- The archive was correctly built, create its dependency file Create_Global_Archive_Dependency_File (Archive_Dep_Name); -- Building the archive failed, delete dependency file if one -- exists. else if Is_Regular_File (Archive_Dep_Name) then Delete_File (Archive_Dep_Name, Success); end if; -- And report the error Report_Error ("building archive for project """, Get_Name_String (Data.Name), """ failed"); end if; end if; end if; end Build_Global_Archive; ------------------- -- Build_Library -- ------------------- procedure Build_Library (Project : Project_Id; Unconditionally : Boolean) is Data : constant Project_Data := Project_Tree.Projects.Table (Project); Source_Id : Other_Source_Id; Source : Other_Source; Archive_Name : constant String := "lib" & Get_Name_String (Data.Name) & '.' & Archive_Ext; -- The name of the archive file for this project Archive_Dep_Name : constant String := "lib" & Get_Name_String (Data.Name) & ".deps"; -- The name of the archive dependency file for this project Need_To_Rebuild : Boolean := Unconditionally; -- When True, archive will be rebuilt File : Prj.Util.Text_File; Object_Name : Name_Id; Time_Stamp : Time_Stamp_Type; Driver_Name : Name_Id := No_Name; Lib_Opts : Argument_List_Access := No_Argument'Access; begin Check_Archive_Builder; -- If Unconditionally is False, check if the archive need to be built if not Need_To_Rebuild then if Verbose_Mode then Write_Str (" Checking "); Write_Line (Archive_Name); end if; -- If the archive does not exist, of course it needs to be built if not Is_Regular_File (Archive_Name) then Need_To_Rebuild := True; if Verbose_Mode then Write_Line (" -> archive does not exist"); end if; -- Archive does exist else -- Check the archive dependency file Open (File, Archive_Dep_Name); -- If the archive dependency file does not exist, we need to -- to rebuild the archive and to create its dependency file. if not Is_Valid (File) then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Str (Archive_Dep_Name); Write_Line (" does not exist"); end if; else -- Put all sources of language other than Ada in Source_Indexes Last_Source := 0; Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Add_Source_Id (Project, Source_Id); Source_Id := Project_Tree.Other_Sources.Table (Source_Id).Next; end loop; -- Read the dependency file, line by line while not End_Of_File (File) loop Get_Line (File, Name_Buffer, Name_Len); -- First line is the name of an object file Object_Name := Name_Find; Source_Id := No_Other_Source; -- Check if this object file is for a source of this project for S in 1 .. Last_Source loop if (not Source_Indexes (S).Found) and then Project_Tree.Other_Sources.Table (Source_Indexes (S).Id).Object_Name = Object_Name then -- We have found the object file: get the source -- data, and mark it as found. Source_Id := Source_Indexes (S).Id; Source := Project_Tree.Other_Sources.Table (Source_Id); Source_Indexes (S).Found := True; exit; end if; end loop; -- If it is not for a source of this project, then the -- archive needs to be rebuilt. if Source_Id = No_Other_Source then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> "); Write_Str (Get_Name_String (Object_Name)); Write_Line (" is not an object of the project"); end if; exit; end if; -- The second line is the time stamp of the object file. -- If there is no next line, then the dependency file is -- truncated, and the archive need to be rebuilt. if End_Of_File (File) then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Line (" is truncated"); end if; exit; end if; Get_Line (File, Name_Buffer, Name_Len); -- If the line has the wrong number of character, then -- the dependency file is incorrectly formatted, and the -- archive needs to be rebuilt. if Name_Len /= Time_Stamp_Length then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> archive dependency file "); Write_Line (" is incorrectly formatted (time stamp)"); end if; exit; end if; Time_Stamp := Time_Stamp_Type (Name_Buffer (1 .. Name_Len)); -- If the time stamp in the dependency file is different -- from the time stamp of the object file, then the archive -- needs to be rebuilt. if Time_Stamp /= Source.Object_TS then Need_To_Rebuild := True; if Verbose_Mode then Write_Str (" -> time stamp of "); Write_Str (Get_Name_String (Object_Name)); Write_Str (" is incorrect in the archive"); Write_Line (" dependency file"); end if; exit; end if; end loop; Close (File); if not Need_To_Rebuild then -- Now, check if all object files of the project have been -- accounted for. If any of them is not in the dependency -- file, the archive needs to be rebuilt. for Index in 1 .. Last_Source loop if not Source_Indexes (Index).Found then Need_To_Rebuild := True; if Verbose_Mode then Source_Id := Source_Indexes (Index).Id; Source := Project_Tree.Other_Sources.Table (Source_Id); Write_Str (" -> "); Write_Str (Get_Name_String (Source.Object_Name)); Write_Str (" is not in the archive "); Write_Line ("dependency file"); end if; exit; end if; end loop; end if; if (not Need_To_Rebuild) and Verbose_Mode then Write_Line (" -> up to date"); end if; end if; end if; end if; -- Build the library if necessary if Need_To_Rebuild then -- If a library is built, then linking will need to occur -- unconditionally. Need_To_Relink := True; Last_Argument := 0; -- If there are sources in Ada, then gnatmake will build the -- library, so nothing to do. if not Data.Languages (Ada_Language_Index) then -- Get all the object files of the project Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); Add_Argument (Get_Name_String (Source.Object_Name), Verbose_Mode); Source_Id := Source.Next; end loop; -- If it is a library, it need to be built it the same way -- Ada libraries are built. if Data.Library_Kind = Static then MLib.Build_Library (Ofiles => Arguments (1 .. Last_Argument), Afiles => No_Argument, Output_File => Get_Name_String (Data.Library_Name), Output_Dir => Get_Name_String (Data.Library_Dir)); else -- Link with g++ if C++ is one of the languages, otherwise -- building the library may fail with unresolved symbols. if C_Plus_Plus_Is_Used then if Compiler_Names (C_Plus_Plus_Language_Index) = null then Get_Compiler (C_Plus_Plus_Language_Index); end if; if Compiler_Is_Gcc (C_Plus_Plus_Language_Index) then Name_Len := 0; Add_Str_To_Name_Buffer (Compiler_Names (C_Plus_Plus_Language_Index).all); Driver_Name := Name_Find; end if; end if; -- If Library_Options is specified, add these options declare Library_Options : constant Variable_Value := Value_Of (Name_Library_Options, Data.Decl.Attributes, Project_Tree); begin if not Library_Options.Default then declare Current : String_List_Id := Library_Options.Values; Element : String_Element; begin while Current /= Nil_String loop Element := Project_Tree.String_Elements. Table (Current); Get_Name_String (Element.Value); if Name_Len /= 0 then Library_Opts.Increment_Last; Library_Opts.Table (Library_Opts.Last) := new String'(Name_Buffer (1 .. Name_Len)); end if; Current := Element.Next; end loop; end; end if; Lib_Opts := new Argument_List'(Argument_List (Library_Opts.Table (1 .. Library_Opts.Last))); end; MLib.Tgt.Build_Dynamic_Library (Ofiles => Arguments (1 .. Last_Argument), Foreign => Arguments (1 .. Last_Argument), Afiles => No_Argument, Options => No_Argument, Options_2 => Lib_Opts.all, Interfaces => No_Argument, Lib_Filename => Get_Name_String (Data.Library_Name), Lib_Dir => Get_Name_String (Data.Library_Dir), Symbol_Data => No_Symbols, Driver_Name => Driver_Name, Lib_Version => "", Auto_Init => False); end if; end if; -- Create fake empty archive, so we can check its time stamp later declare Archive : Ada.Text_IO.File_Type; begin Create (Archive, Out_File, Archive_Name); Close (Archive); end; Create_Archive_Dependency_File (Archive_Dep_Name, Data.First_Other_Source); end if; end Build_Library; ----------- -- Check -- ----------- procedure Check (Option : String) is First : Positive := Option'First; Last : Natural; begin for Index in Option'First + 1 .. Option'Last - 1 loop if Option (Index) = ' ' and then Option (Index + 1) = '-' then Write_Str ("warning: switch """); Write_Str (Option); Write_Str (""" is suspicious; consider using "); Last := First; while Last <= Option'Last loop if Option (Last) = ' ' then if First /= Option'First then Write_Str (", "); end if; Write_Char ('"'); Write_Str (Option (First .. Last - 1)); Write_Char ('"'); while Last <= Option'Last and then Option (Last) = ' ' loop Last := Last + 1; end loop; First := Last; else if Last = Option'Last then if First /= Option'First then Write_Str (", "); end if; Write_Char ('"'); Write_Str (Option (First .. Last)); Write_Char ('"'); end if; Last := Last + 1; end if; end loop; Write_Line (" instead"); exit; end if; end loop; end Check; --------------------------- -- Check_Archive_Builder -- --------------------------- procedure Check_Archive_Builder is begin -- First, make sure that the archive builder (ar) is on the path if Archive_Builder_Path = null then Archive_Builder_Path := Locate_Exec_On_Path (Archive_Builder); if Archive_Builder_Path = null then Osint.Fail ("unable to locate archive builder """, Archive_Builder, """"); end if; -- If there is an archive indexer (ranlib), try to locate it on the -- path. Don't fail if it is not found. if Archive_Indexer /= "" then Archive_Indexer_Path := Locate_Exec_On_Path (Archive_Indexer); end if; end if; end Check_Archive_Builder; ------------------------------ -- Check_Compilation_Needed -- ------------------------------ procedure Check_Compilation_Needed (Source : Other_Source; Need_To_Compile : out Boolean) is Source_Name : constant String := Get_Name_String (Source.File_Name); Source_Path : constant String := Get_Name_String (Source.Path_Name); Object_Name : constant String := Get_Name_String (Source.Object_Name); Dep_Name : constant String := Get_Name_String (Source.Dep_Name); Source_In_Dependencies : Boolean := False; -- Set True if source was found in dependency file of its object file Dep_File : Prj.Util.Text_File; Start : Natural; Finish : Natural; begin -- Assume the worst, so that statement "return;" may be used if there -- is any problem. Need_To_Compile := True; if Verbose_Mode then Write_Str (" Checking "); Write_Str (Source_Name); Write_Line (" ... "); end if; -- If object file does not exist, of course source need to be compiled if Source.Object_TS = Empty_Time_Stamp then if Verbose_Mode then Write_Str (" -> object file "); Write_Str (Object_Name); Write_Line (" does not exist"); end if; return; end if; -- If the object file has been created before the last modification -- of the source, the source need to be recompiled. if Source.Object_TS < Source.Source_TS then if Verbose_Mode then Write_Str (" -> object file "); Write_Str (Object_Name); Write_Line (" has time stamp earlier than source"); end if; return; end if; -- If there is no dependency file, then the source needs to be -- recompiled and the dependency file need to be created. if Source.Dep_TS = Empty_Time_Stamp then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" does not exist"); end if; return; end if; -- The source needs to be recompiled if the source has been modified -- after the dependency file has been created. if Source.Dep_TS < Source.Source_TS then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" has time stamp earlier than source"); end if; return; end if; -- Look for all dependencies Open (Dep_File, Dep_Name); -- If dependency file cannot be open, we need to recompile the source if not Is_Valid (Dep_File) then if Verbose_Mode then Write_Str (" -> could not open dependency file "); Write_Line (Dep_Name); end if; return; end if; declare End_Of_File_Reached : Boolean := False; begin loop if End_Of_File (Dep_File) then End_Of_File_Reached := True; exit; end if; Get_Line (Dep_File, Name_Buffer, Name_Len); exit when Name_Len > 0 and then Name_Buffer (1) /= '#'; end loop; -- If dependency file contains only empty lines or comments, then -- dependencies are unknown, and the source needs to be recompiled. if End_Of_File_Reached then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" is empty"); end if; Close (Dep_File); return; end if; end; Start := 1; Finish := Index (Name_Buffer (1 .. Name_Len), ": "); -- First line must start with name of object file, followed by colon if Finish = 0 or else Name_Buffer (1 .. Finish - 1) /= Object_Name then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" has wrong format"); end if; Close (Dep_File); return; else Start := Finish + 2; -- Process each line Line_Loop : loop declare Line : constant String := Name_Buffer (1 .. Name_Len); Last : constant Natural := Name_Len; begin Name_Loop : loop -- Find the beginning of the next source path name while Start < Last and then Line (Start) = ' ' loop Start := Start + 1; end loop; -- Go to next line when there is a continuation character \ -- at the end of the line. exit Name_Loop when Start = Last and then Line (Start) = '\'; -- We should not be at the end of the line, without -- a continuation character \. if Start = Last then if Verbose_Mode then Write_Str (" -> dependency file "); Write_Str (Dep_Name); Write_Line (" has wrong format"); end if; Close (Dep_File); return; end if; -- Look for the end of the source path name Finish := Start; while Finish < Last and then Line (Finish + 1) /= ' ' loop Finish := Finish + 1; end loop; -- Check this source declare Src_Name : constant String := Normalize_Pathname (Name => Line (Start .. Finish), Case_Sensitive => False); Src_TS : Time_Stamp_Type; begin -- If it is original source, set Source_In_Dependencies if Src_Name = Source_Path then Source_In_Dependencies := True; end if; Name_Len := 0; Add_Str_To_Name_Buffer (Src_Name); Src_TS := File_Stamp (Name_Find); -- If the source does not exist, we need to recompile if Src_TS = Empty_Time_Stamp then if Verbose_Mode then Write_Str (" -> source "); Write_Str (Src_Name); Write_Line (" does not exist"); end if; Close (Dep_File); return; -- If the source has been modified after the object file, -- we need to recompile. elsif Src_TS > Source.Object_TS then if Verbose_Mode then Write_Str (" -> source "); Write_Str (Src_Name); Write_Line (" has time stamp later than object file"); end if; Close (Dep_File); return; end if; end; -- If the source path name ends the line, we are done exit Line_Loop when Finish = Last; -- Go get the next source on the line Start := Finish + 1; end loop Name_Loop; end; -- If we are here, we had a continuation character \ at the end -- of the line, so we continue with the next line. Get_Line (Dep_File, Name_Buffer, Name_Len); Start := 1; end loop Line_Loop; end if; Close (Dep_File); -- If the original sources were not in the dependency file, then we -- need to recompile. It may mean that we are using a different source -- (different variant) for this object file. if not Source_In_Dependencies then if Verbose_Mode then Write_Str (" -> source "); Write_Str (Source_Path); Write_Line (" is not in the dependencies"); end if; return; end if; -- If we are here, then everything is OK, and we don't need -- to recompile. if Verbose_Mode then Write_Line (" -> up to date"); end if; Need_To_Compile := False; end Check_Compilation_Needed; --------------------------- -- Check_For_C_Plus_Plus -- --------------------------- procedure Check_For_C_Plus_Plus is begin C_Plus_Plus_Is_Used := False; for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop if Project_Tree.Projects.Table (Project).Languages (C_Plus_Plus_Language_Index) then C_Plus_Plus_Is_Used := True; exit; end if; end loop; end Check_For_C_Plus_Plus; ------------- -- Compile -- ------------- procedure Compile (Source_Id : Other_Source_Id; Data : Project_Data; Local_Errors : in out Boolean) is Source : Other_Source := Project_Tree.Other_Sources.Table (Source_Id); Success : Boolean; CPATH : String_Access := null; begin -- If the compiler is not known yet, get its path name if Compiler_Names (Source.Language) = null then Get_Compiler (Source.Language); end if; -- For non GCC compilers, get the dependency file, first calling the -- compiler with the switch -M. if not Compiler_Is_Gcc (Source.Language) then Last_Argument := 0; -- Add the source name, preceded by -M Add_Argument (Dash_M, True); Add_Argument (Get_Name_String (Source.Path_Name), True); -- Add the compiling switches for this source found in -- package Compiler of the project file, if they exist. Add_Switches (Data, Compiler, Source.Language, Source.File_Name); -- Add the compiling switches for the language specified -- on the command line, if any. for J in 1 .. Comp_Opts.Last (Options (Source.Language)) loop Add_Argument (Options (Source.Language).Table (J), True); end loop; -- Finally, add imported directory switches for this project file Add_Search_Directories (Data, Source.Language); -- And invoke the compiler using GNAT.Expect Display_Command (Compiler_Names (Source.Language).all, Compiler_Paths (Source.Language)); begin Non_Blocking_Spawn (FD, Compiler_Paths (Source.Language).all, Arguments (1 .. Last_Argument), Buffer_Size => 0, Err_To_Out => True); declare Dep_File : Ada.Text_IO.File_Type; Result : Expect_Match; Status : Integer; begin -- Create the dependency file Create (Dep_File, Out_File, Get_Name_String (Source.Dep_Name)); loop Expect (FD, Result, Line_Matcher); exit when Result = Expect_Timeout; declare S : constant String := Strip_CR_LF (Expect_Out (FD)); begin -- Each line of the output is put in the dependency -- file, including errors. If there are errors, the -- syntax of the dependency file will be incorrect and -- recompilation will occur automatically the next time -- the dependencies are checked. Put_Line (Dep_File, S); end; end loop; -- If we are here, it means we had a timeout, so the -- dependency file may be incomplete. It is safer to -- delete it, otherwise the dependencies may be wrong. Close (FD, Status); Close (Dep_File); Delete_File (Get_Name_String (Source.Dep_Name), Success); exception when Process_Died => -- This is the normal outcome. Just close the file Close (FD, Status); Close (Dep_File); when others => -- Something wrong happened. It is safer to delete the -- dependency file, otherwise the dependencies may be wrong. Close (FD, Status); if Is_Open (Dep_File) then Close (Dep_File); end if; Delete_File (Get_Name_String (Source.Dep_Name), Success); end; exception -- If we cannot spawn the compiler, then the dependencies are -- not updated. It is safer then to delete the dependency file, -- otherwise the dependencies may be wrong. when Invalid_Process => Delete_File (Get_Name_String (Source.Dep_Name), Success); end; end if; Last_Argument := 0; -- For GCC compilers, make sure the language is always specified to -- to the GCC driver, in case the extension is not recognized by the -- GCC driver as a source of the language. if Compiler_Is_Gcc (Source.Language) then Add_Argument (Dash_x, Verbose_Mode); Add_Argument (Get_Name_String (Language_Names.Table (Source.Language)), Verbose_Mode); end if; Add_Argument (Dash_c, True); -- Add the compiling switches for this source found in -- package Compiler of the project file, if they exist. Add_Switches (Data, Compiler, Source.Language, Source.File_Name); -- Specify the source to be compiled Add_Argument (Get_Name_String (Source.Path_Name), True); -- If non static library project, compile with the PIC option if there -- is one (when there is no PIC option, function MLib.Tgt.PIC_Option -- returns an empty string, and Add_Argument with an empty string has -- no effect). if Data.Library and then Data.Library_Kind /= Static then Add_Argument (PIC_Option, True); end if; -- Indicate the name of the object Add_Argument (Dash_o, True); Add_Argument (Get_Name_String (Source.Object_Name), True); -- When compiler is GCC, use the magic switch that creates -- the dependency file in the correct format. if Compiler_Is_Gcc (Source.Language) then Add_Argument ("-Wp,-MD," & Get_Name_String (Source.Dep_Name), Verbose_Mode); end if; -- Add the compiling switches for the language specified -- on the command line, if any. for J in 1 .. Comp_Opts.Last (Options (Source.Language)) loop Add_Argument (Options (Source.Language).Table (J), True); end loop; -- Finally, add the imported directory switches for this -- project file (or, for gcc compilers, set up the CPATH env var -- if needed). Add_Search_Directories (Data, Source.Language); -- Set CPATH, if compiler is GCC if Compiler_Is_Gcc (Source.Language) then CPATH := Current_Include_Paths (Source.Language); end if; -- And invoke the compiler Display_Command (Name => Compiler_Names (Source.Language).all, Path => Compiler_Paths (Source.Language), CPATH => CPATH); Spawn (Compiler_Paths (Source.Language).all, Arguments (1 .. Last_Argument), Success); -- Case of successful compilation if Success then -- Update the time stamp of the object file Source.Object_TS := File_Stamp (Source.Object_Name); -- Do some sanity checks if Source.Object_TS = Empty_Time_Stamp then Local_Errors := True; Report_Error ("object file ", Get_Name_String (Source.Object_Name), " has not been created"); elsif Source.Object_TS < Source.Source_TS then Local_Errors := True; Report_Error ("object file ", Get_Name_String (Source.Object_Name), " has not been modified"); else -- Everything looks fine, update the Other_Sources table Project_Tree.Other_Sources.Table (Source_Id) := Source; end if; -- Compilation failed else Local_Errors := True; Report_Error ("compilation of ", Get_Name_String (Source.Path_Name), " failed"); end if; end Compile; -------------------------------- -- Compile_Individual_Sources -- -------------------------------- procedure Compile_Individual_Sources is Data : Project_Data := Project_Tree.Projects.Table (Main_Project); Source_Id : Other_Source_Id; Source : Other_Source; Source_Name : Name_Id; Project_Name : String := Get_Name_String (Data.Name); Dummy : Boolean := False; Ada_Is_A_Language : constant Boolean := Data.Languages (Ada_Language_Index); begin Ada_Mains.Init; To_Mixed (Project_Name); Compile_Only := True; Get_Imported_Directories (Main_Project, Data); Project_Tree.Projects.Table (Main_Project) := Data; -- Compilation will occur in the object directory Change_Dir (Get_Name_String (Data.Object_Directory)); if not Data.Other_Sources_Present then if Ada_Is_A_Language then Mains.Reset; loop declare Main : constant String := Mains.Next_Main; begin exit when Main'Length = 0; Ada_Mains.Increment_Last; Ada_Mains.Table (Ada_Mains.Last) := new String'(Main); end; end loop; else Osint.Fail ("project ", Project_Name, " contains no source"); end if; else Mains.Reset; loop declare Main : constant String := Mains.Next_Main; begin Name_Len := Main'Length; exit when Name_Len = 0; Name_Buffer (1 .. Name_Len) := Main; Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Source_Name := Name_Find; if not Sources_Compiled.Get (Source_Name) then Sources_Compiled.Set (Source_Name, True); Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); exit when Source.File_Name = Source_Name; Source_Id := Source.Next; end loop; if Source_Id = No_Other_Source then if Ada_Is_A_Language then Ada_Mains.Increment_Last; Ada_Mains.Table (Ada_Mains.Last) := new String'(Main); else Report_Error (Main, " is not a valid source of project ", Project_Name); end if; else Compile (Source_Id, Data, Dummy); end if; end if; end; end loop; end if; if Ada_Mains.Last > 0 then -- Invoke gnatmake for all Ada sources Last_Argument := 0; Add_Argument (Dash_u, True); for Index in 1 .. Ada_Mains.Last loop Add_Argument (Ada_Mains.Table (Index), True); end loop; Compile_Link_With_Gnatmake (Mains_Specified => False); end if; end Compile_Individual_Sources; -------------------------------- -- Compile_Link_With_Gnatmake -- -------------------------------- procedure Compile_Link_With_Gnatmake (Mains_Specified : Boolean) is Data : constant Project_Data := Project_Tree.Projects.Table (Main_Project); Success : Boolean; begin -- Array Arguments may already contain some arguments, so we don't -- set Last_Argument to 0. -- Get the gnatmake to invoke Get_Compiler (Ada_Language_Index); -- Specify the project file Add_Argument (Dash_P, True); Add_Argument (Get_Name_String (Data.Path_Name), True); -- Add the -X switches, if any for Index in 1 .. X_Switches.Last loop Add_Argument (X_Switches.Table (Index), True); end loop; -- If Mains_Specified is True, find the mains in package Mains if Mains_Specified then Mains.Reset; loop declare Main : constant String := Mains.Next_Main; begin exit when Main'Length = 0; Add_Argument (Main, True); end; end loop; end if; -- Specify output file name, if any was specified on the command line if Output_File_Name /= null then Add_Argument (Dash_o, True); Add_Argument (Output_File_Name, True); end if; -- Transmit some switches to gnatmake -- -c if Compile_Only then Add_Argument (Dash_c, True); end if; -- -d if Display_Compilation_Progress then Add_Argument (Dash_d, True); end if; -- -k if Keep_Going then Add_Argument (Dash_k, True); end if; -- -f if Force_Compilations then Add_Argument (Dash_f, True); end if; -- -v if Verbose_Mode then Add_Argument (Dash_v, True); end if; -- -q if Quiet_Output then Add_Argument (Dash_q, True); end if; -- -vP1 and -vP2 case Current_Verbosity is when Default => null; when Medium => Add_Argument (Dash_vP1, True); when High => Add_Argument (Dash_vP2, True); end case; -- If there are compiling options for Ada, transmit them to gnatmake if Comp_Opts.Last (Options (Ada_Language_Index)) /= 0 then Add_Argument (Dash_cargs, True); for Arg in 1 .. Comp_Opts.Last (Options (Ada_Language_Index)) loop Add_Argument (Options (Ada_Language_Index).Table (Arg), True); end loop; end if; if not Compile_Only then -- Linking options if Linker_Options.Last /= 0 then Add_Argument (Dash_largs, True); else Add_Argument (Dash_largs, Verbose_Mode); end if; -- Add the archives Add_Archives (For_Gnatmake => True); -- If there are linking options from the command line, -- transmit them to gnatmake. for Arg in 1 .. Linker_Options.Last loop Add_Argument (Linker_Options.Table (Arg), True); end loop; end if; -- And invoke gnatmake Display_Command (Compiler_Names (Ada_Language_Index).all, Compiler_Paths (Ada_Language_Index)); Spawn (Compiler_Paths (Ada_Language_Index).all, Arguments (1 .. Last_Argument), Success); -- Report an error if call to gnatmake failed if not Success then Report_Error ("invocation of ", Compiler_Names (Ada_Language_Index).all, " failed"); end if; end Compile_Link_With_Gnatmake; --------------------- -- Compile_Sources -- --------------------- procedure Compile_Sources is Data : Project_Data; Source_Id : Other_Source_Id; Source : Other_Source; Local_Errors : Boolean := False; -- Set to True when there is a compilation error. Used only when -- Keep_Going is True, to inhibit the building of the archive. Need_To_Compile : Boolean; -- Set to True when a source needs to be compiled/recompiled Need_To_Rebuild_Archive : Boolean := Force_Compilations; -- True when the archive needs to be built/rebuilt unconditionally Total_Number_Of_Sources : Int := 0; Current_Source_Number : Int := 0; begin -- First, get the number of sources for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Data := Project_Tree.Projects.Table (Project); if (not Data.Virtual) and then Data.Other_Sources_Present then Source_Id := Data.First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); Total_Number_Of_Sources := Total_Number_Of_Sources + 1; Source_Id := Source.Next; end loop; end if; end loop; -- Loop through project files for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Local_Errors := False; Data := Project_Tree.Projects.Table (Project); -- Nothing to do when no sources of language other than Ada if (not Data.Virtual) and then Data.Other_Sources_Present then -- If the imported directory switches are unknown, compute them if not Data.Include_Data_Set then Get_Imported_Directories (Project, Data); Data.Include_Data_Set := True; Project_Tree.Projects.Table (Project) := Data; end if; Need_To_Rebuild_Archive := Force_Compilations; -- Compilation will occur in the object directory Change_Dir (Get_Name_String (Data.Object_Directory)); Source_Id := Data.First_Other_Source; -- Process each source one by one while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); Current_Source_Number := Current_Source_Number + 1; Need_To_Compile := Force_Compilations; -- Check if compilation is needed if not Need_To_Compile then Check_Compilation_Needed (Source, Need_To_Compile); end if; -- Proceed, if compilation is needed if Need_To_Compile then -- If a source is compiled/recompiled, of course the -- archive will need to be built/rebuilt. Need_To_Rebuild_Archive := True; Compile (Source_Id, Data, Local_Errors); end if; if Display_Compilation_Progress then Write_Str ("completed "); Write_Int (Current_Source_Number); Write_Str (" out of "); Write_Int (Total_Number_Of_Sources); Write_Str (" ("); Write_Int ((Current_Source_Number * 100) / Total_Number_Of_Sources); Write_Str ("%)..."); Write_Eol; end if; -- Next source, if any Source_Id := Source.Next; end loop; if Need_To_Rebuild_Archive and then (not Data.Library) then Need_To_Rebuild_Global_Archive := True; end if; -- If there was no compilation error and -c was not used, -- build / rebuild the archive if necessary. if not Local_Errors and then Data.Library and then not Data.Languages (Ada_Language_Index) and then not Compile_Only then Build_Library (Project, Need_To_Rebuild_Archive); end if; end if; end loop; end Compile_Sources; --------------- -- Copyright -- --------------- procedure Copyright is begin -- Only output the Copyright notice once if not Copyright_Output then Copyright_Output := True; Write_Eol; Write_Str ("GPRMAKE "); Write_Str (Gnatvsn.Gnat_Version_String); Write_Str (" Copyright 2004 Free Software Foundation, Inc."); Write_Eol; end if; end Copyright; ------------------------------------ -- Create_Archive_Dependency_File -- ------------------------------------ procedure Create_Archive_Dependency_File (Name : String; First_Source : Other_Source_Id) is Source_Id : Other_Source_Id := First_Source; Source : Other_Source; Dep_File : Ada.Text_IO.File_Type; begin -- Create the file in Append mode, to avoid automatic insertion of -- an end of line if file is empty. Create (Dep_File, Append_File, Name); while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); Put_Line (Dep_File, Get_Name_String (Source.Object_Name)); Put_Line (Dep_File, String (Source.Object_TS)); Source_Id := Source.Next; end loop; Close (Dep_File); exception when others => if Is_Open (Dep_File) then Close (Dep_File); end if; end Create_Archive_Dependency_File; ------------------------------------------- -- Create_Global_Archive_Dependency_File -- ------------------------------------------- procedure Create_Global_Archive_Dependency_File (Name : String) is Source_Id : Other_Source_Id; Source : Other_Source; Dep_File : Ada.Text_IO.File_Type; begin -- Create the file in Append mode, to avoid automatic insertion of -- an end of line if file is empty. Create (Dep_File, Append_File, Name); -- Get all the object files of non-Ada sources in non-library projects for Project in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop if not Project_Tree.Projects.Table (Project).Library then Source_Id := Project_Tree.Projects.Table (Project).First_Other_Source; while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); -- Put only those object files that are in the global archive if Is_Included_In_Global_Archive (Source.Object_Name, Project) then Put_Line (Dep_File, Get_Name_String (Source.Object_Path)); Put_Line (Dep_File, String (Source.Object_TS)); end if; Source_Id := Source.Next; end loop; end if; end loop; Close (Dep_File); exception when others => if Is_Open (Dep_File) then Close (Dep_File); end if; end Create_Global_Archive_Dependency_File; --------------------- -- Display_Command -- --------------------- procedure Display_Command (Name : String; Path : String_Access; CPATH : String_Access := null) is begin -- Only display the command in Verbose Mode (-v) or when -- not in Quiet Output (no -q). if Verbose_Mode or (not Quiet_Output) then -- In Verbose Mode output the full path of the spawned process if Verbose_Mode then if CPATH /= null then Write_Str ("CPATH = "); Write_Line (CPATH.all); end if; Write_Str (Path.all); else Write_Str (Name); end if; -- Display only the arguments for which the display flag is set -- (in Verbose Mode, the display flag is set for all arguments) for Arg in 1 .. Last_Argument loop if Arguments_Displayed (Arg) then Write_Char (' '); Write_Str (Arguments (Arg).all); end if; end loop; Write_Eol; end if; end Display_Command; ------------------ -- Get_Compiler -- ------------------ procedure Get_Compiler (For_Language : First_Language_Indexes) is Data : constant Project_Data := Project_Tree.Projects.Table (Main_Project); Ide : constant Package_Id := Value_Of (Name_Ide, In_Packages => Data.Decl.Packages, In_Tree => Project_Tree); -- The id of the package IDE in the project file Compiler : constant Variable_Value := Value_Of (Name => Language_Names.Table (For_Language), Index => 0, Attribute_Or_Array_Name => Name_Compiler_Command, In_Package => Ide, In_Tree => Project_Tree); -- The value of Compiler_Command ("language") in package IDE, if defined begin -- No need to do it again if the compiler is known for this language if Compiler_Names (For_Language) = null then -- If compiler command is not defined for this language in package -- IDE, use the default compiler for this language. if Compiler = Nil_Variable_Value then if For_Language in Default_Compiler_Names'Range then Compiler_Names (For_Language) := Default_Compiler_Names (For_Language); else Osint.Fail ("unknow compiler name for language """, Get_Name_String (Language_Names.Table (For_Language)), """"); end if; else Compiler_Names (For_Language) := new String'(Get_Name_String (Compiler.Value)); end if; -- Check we have a GCC compiler (name ends with "gcc" or "g++") declare Comp_Name : constant String := Compiler_Names (For_Language).all; Last3 : String (1 .. 3); begin if Comp_Name'Length >= 3 then Last3 := Comp_Name (Comp_Name'Last - 2 .. Comp_Name'Last); Compiler_Is_Gcc (For_Language) := (Last3 = "gcc") or (Last3 = "g++"); else Compiler_Is_Gcc (For_Language) := False; end if; end; -- Locate the compiler on the path Compiler_Paths (For_Language) := Locate_Exec_On_Path (Compiler_Names (For_Language).all); -- Fail if compiler cannot be found if Compiler_Paths (For_Language) = null then if For_Language = Ada_Language_Index then Osint.Fail ("unable to locate """, Compiler_Names (For_Language).all, """"); else Osint.Fail ("unable to locate " & Get_Name_String (Language_Names.Table (For_Language)), " compiler """, Compiler_Names (For_Language).all & '"'); end if; end if; end if; end Get_Compiler; ------------------------------ -- Get_Imported_Directories -- ------------------------------ procedure Get_Imported_Directories (Project : Project_Id; Data : in out Project_Data) is Imported_Projects : Project_List := Data.Imported_Projects; Path_Length : Natural := 0; Position : Natural := 0; procedure Add (Source_Dirs : String_List_Id); -- Add a list of source directories procedure Recursive_Get_Dirs (Prj : Project_Id); -- Recursive procedure to get the source directories of this project -- file and of the project files it imports, in the correct order. --------- -- Add -- --------- procedure Add (Source_Dirs : String_List_Id) is Element_Id : String_List_Id := Source_Dirs; Element : String_Element; Add_Arg : Boolean := True; begin -- Add each source directory path name, preceded by "-I" to Arguments while Element_Id /= Nil_String loop Element := Project_Tree.String_Elements.Table (Element_Id); if Element.Value /= No_Name then Get_Name_String (Element.Value); if Name_Len > 0 then -- Remove a trailing directory separator: this may cause -- problems on Windows. if Name_Len > 1 and then Name_Buffer (Name_Len) = Directory_Separator then Name_Len := Name_Len - 1; end if; declare Arg : constant String := "-I" & Name_Buffer (1 .. Name_Len); begin -- Check if directory is already in the list. -- If it is, no need to put it again. for Index in 1 .. Last_Argument loop if Arguments (Index).all = Arg then Add_Arg := False; exit; end if; end loop; if Add_Arg then if Path_Length /= 0 then Path_Length := Path_Length + 1; end if; Path_Length := Path_Length + Name_Len; Add_Argument (Arg, True); end if; end; end if; end if; Element_Id := Element.Next; end loop; end Add; ------------------------ -- Recursive_Get_Dirs -- ------------------------ procedure Recursive_Get_Dirs (Prj : Project_Id) is Data : Project_Data; Imported : Project_List; begin -- Nothing to do if project is undefined if Prj /= No_Project then Data := Project_Tree.Projects.Table (Prj); -- Nothing to do if project has already been processed if not Data.Seen then -- Mark the project as processed, to avoid multiple processing -- of the same project. Project_Tree.Projects.Table (Prj).Seen := True; -- Add the source directories of this project if not Data.Virtual then Add (Data.Source_Dirs); end if; Recursive_Get_Dirs (Data.Extends); Imported := Data.Imported_Projects; -- Call itself for all imported projects, if any while Imported /= Empty_Project_List loop Recursive_Get_Dirs (Project_Tree.Project_Lists.Table (Imported).Project); Imported := Project_Tree.Project_Lists.Table (Imported).Next; end loop; end if; end if; end Recursive_Get_Dirs; -- Start of processing for Get_Imported_Directories begin -- First, mark all project as not processed for J in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Project_Tree.Projects.Table (J).Seen := False; end loop; -- Empty Arguments Last_Argument := 0; -- Process this project individually, project data are already known Project_Tree.Projects.Table (Project).Seen := True; Add (Data.Source_Dirs); Recursive_Get_Dirs (Data.Extends); while Imported_Projects /= Empty_Project_List loop Recursive_Get_Dirs (Project_Tree.Project_Lists.Table (Imported_Projects).Project); Imported_Projects := Project_Tree.Project_Lists.Table (Imported_Projects).Next; end loop; Data.Imported_Directories_Switches := new Argument_List'(Arguments (1 .. Last_Argument)); -- Create the Include_Path, from the Arguments Data.Include_Path := new String (1 .. Path_Length); Data.Include_Path (1 .. Arguments (1)'Length - 2) := Arguments (1)(Arguments (1)'First + 2 .. Arguments (1)'Last); Position := Arguments (1)'Length - 2; for Arg in 2 .. Last_Argument loop Position := Position + 1; Data.Include_Path (Position) := Path_Separator; Data.Include_Path (Position + 1 .. Position + Arguments (Arg)'Length - 2) := Arguments (Arg)(Arguments (Arg)'First + 2 .. Arguments (Arg)'Last); Position := Position + Arguments (Arg)'Length - 2; end loop; Last_Argument := 0; end Get_Imported_Directories; ------------- -- Gprmake -- ------------- procedure Gprmake is begin Makegpr.Initialize; if Verbose_Mode then Write_Eol; Write_Str ("Parsing Project File """); Write_Str (Project_File_Name.all); Write_Str ("""."); Write_Eol; end if; -- Parse and process project files for other languages (not for Ada) Prj.Pars.Parse (Project => Main_Project, In_Tree => Project_Tree, Project_File_Name => Project_File_Name.all, Packages_To_Check => Packages_To_Check); -- Fail if parsing/processing was unsuccessful if Main_Project = No_Project then Osint.Fail ("""", Project_File_Name.all, """ processing failed"); end if; if Verbose_Mode then Write_Eol; Write_Str ("Parsing of Project File """); Write_Str (Project_File_Name.all); Write_Str (""" is finished."); Write_Eol; end if; -- If -f was specified, we will certainly need to link (except when -- -u or -c were specified, of course). Need_To_Relink := Force_Compilations; if Unique_Compile then if Mains.Number_Of_Mains = 0 then Osint.Fail ("No source specified to compile in 'unique compile' mode"); else Compile_Individual_Sources; Report_Total_Errors ("compilation"); end if; else declare Data : constant Prj.Project_Data := Project_Tree.Projects.Table (Main_Project); begin if Data.Library and then Mains.Number_Of_Mains /= 0 then Osint.Fail ("Cannot specify mains on the command line " & "for a Library Project"); end if; -- First check for C++, to link libraries with g++, -- rather than gcc. Check_For_C_Plus_Plus; -- Compile sources and build archives for library project, -- if necessary. Compile_Sources; -- When Keep_Going is True, if we had some errors, fail now, -- reporting the number of compilation errors. -- Do not attempt to link. Report_Total_Errors ("compilation"); -- If -c was not specified, link the executables, -- if there are any. if not Compile_Only and then not Data.Library and then Data.Object_Directory /= No_Name then Build_Global_Archive; Link_Executables; end if; -- When Keep_Going is True, if we had some errors, fail, reporting -- the number of linking errors. Report_Total_Errors ("linking"); end; end if; end Gprmake; ---------------- -- Initialize -- ---------------- procedure Initialize is begin -- Do some necessary package initializations Csets.Initialize; Namet.Initialize; Snames.Initialize; Prj.Initialize (Project_Tree); Mains.Delete; -- Set Name_Ide and Name_Compiler_Command Name_Len := 0; Add_Str_To_Name_Buffer ("ide"); Name_Ide := Name_Find; Name_Len := 0; Add_Str_To_Name_Buffer ("compiler_command"); Name_Compiler_Command := Name_Find; -- Make sure the -X switch table is empty X_Switches.Set_Last (0); -- Get the command line arguments Scan_Args : for Next_Arg in 1 .. Argument_Count loop Scan_Arg (Argument (Next_Arg)); end loop Scan_Args; -- Fail if command line ended with "-P" if Project_File_Name_Expected then Osint.Fail ("project file name missing after -P"); -- Or if it ended with "-o" elsif Output_File_Name_Expected then Osint.Fail ("output file name missing after -o"); end if; -- If no project file was specified, display the usage and fail if Project_File_Name = null then Usage; Exit_Program (E_Success); end if; -- To be able of finding libgnat.a in MLib.Tgt, we need to have the -- default search dirs established in Osint. Osint.Add_Default_Search_Dirs; end Initialize; ----------------------------------- -- Is_Included_In_Global_Archive -- ----------------------------------- function Is_Included_In_Global_Archive (Object_Name : Name_Id; Project : Project_Id) return Boolean is Data : Project_Data := Project_Tree.Projects.Table (Project); Source : Other_Source_Id; begin while Data.Extended_By /= No_Project loop Data := Project_Tree.Projects.Table (Data.Extended_By); Source := Data.First_Other_Source; while Source /= No_Other_Source loop if Project_Tree.Other_Sources.Table (Source).Object_Name = Object_Name then return False; else Source := Project_Tree.Other_Sources.Table (Source).Next; end if; end loop; end loop; return True; end Is_Included_In_Global_Archive; ---------------------- -- Link_Executables -- ---------------------- procedure Link_Executables is Data : constant Project_Data := Project_Tree.Projects.Table (Main_Project); Mains_Specified : constant Boolean := Mains.Number_Of_Mains /= 0; -- True if main sources were specified on the command line Object_Dir : constant String := Get_Name_String (Data.Object_Directory); -- Path of the object directory of the main project Source_Id : Other_Source_Id; Source : Other_Source; Success : Boolean; Linker_Name : String_Access; Linker_Path : String_Access; -- The linker name and path, when linking is not done by gnatlink Link_Done : Boolean := False; -- Set to True when the linker is invoked directly (not through -- gnatmake) to be able to report if mains were up to date at the end -- of execution. procedure Add_C_Plus_Plus_Link_For_Gnatmake; -- Add the --LINK= switch for gnatlink, depending on the C++ compiler procedure Check_Time_Stamps (Exec_Time_Stamp : Time_Stamp_Type); -- Check if there is an archive that is more recent than the executable -- to decide if we need to relink. procedure Choose_C_Plus_Plus_Link_Process; -- If the C++ compiler is not g++, create the correct script to link procedure Link_Foreign (Main : String; Main_Id : Name_Id; Source : Other_Source); -- Link a non-Ada main, when there is no Ada code --------------------------------------- -- Add_C_Plus_Plus_Link_For_Gnatmake -- --------------------------------------- procedure Add_C_Plus_Plus_Link_For_Gnatmake is begin Add_Argument ("--LINK=" & Compiler_Names (C_Plus_Plus_Language_Index).all, Verbose_Mode); end Add_C_Plus_Plus_Link_For_Gnatmake; ----------------------- -- Check_Time_Stamps -- ----------------------- procedure Check_Time_Stamps (Exec_Time_Stamp : Time_Stamp_Type) is Prj_Data : Project_Data; begin for Prj in Project_Table.First .. Project_Table.Last (Project_Tree.Projects) loop Prj_Data := Project_Tree.Projects.Table (Prj); -- There is an archive only in project -- files with sources other than Ada -- sources. if Data.Other_Sources_Present then declare Archive_Path : constant String := Get_Name_String (Prj_Data.Object_Directory) & Directory_Separator & "lib" & Get_Name_String (Prj_Data.Name) & '.' & Archive_Ext; Archive_TS : Time_Stamp_Type; begin Name_Len := 0; Add_Str_To_Name_Buffer (Archive_Path); Archive_TS := File_Stamp (Name_Find); -- If the archive is later than the -- executable, we need to relink. if Archive_TS /= Empty_Time_Stamp and then Exec_Time_Stamp < Archive_TS then Need_To_Relink := True; if Verbose_Mode then Write_Str (" -> "); Write_Str (Archive_Path); Write_Str (" has time stamp "); Write_Str ("later than "); Write_Line ("executable"); end if; exit; end if; end; end if; end loop; end Check_Time_Stamps; ------------------------------------- -- Choose_C_Plus_Plus_Link_Process -- ------------------------------------- procedure Choose_C_Plus_Plus_Link_Process is begin if Compiler_Names (C_Plus_Plus_Language_Index) = null then Get_Compiler (C_Plus_Plus_Language_Index); end if; end Choose_C_Plus_Plus_Link_Process; ------------------ -- Link_Foreign -- ------------------ procedure Link_Foreign (Main : String; Main_Id : Name_Id; Source : Other_Source) is Executable_Name : constant String := Get_Name_String (Executable_Of (Project => Main_Project, In_Tree => Project_Tree, Main => Main_Id, Index => 0, Ada_Main => False)); -- File name of the executable Executable_Path : constant String := Get_Name_String (Data.Exec_Directory) & Directory_Separator & Executable_Name; -- Path name of the executable Exec_Time_Stamp : Time_Stamp_Type; begin -- Now, check if the executable is up to date. It is considered -- up to date if its time stamp is not earlier that the time stamp -- of any archive. Only do that if we don't know if we need to link. if not Need_To_Relink then -- Get the time stamp of the executable Name_Len := 0; Add_Str_To_Name_Buffer (Executable_Path); Exec_Time_Stamp := File_Stamp (Name_Find); if Verbose_Mode then Write_Str (" Checking executable "); Write_Line (Executable_Name); end if; -- If executable does not exist, we need to link if Exec_Time_Stamp = Empty_Time_Stamp then Need_To_Relink := True; if Verbose_Mode then Write_Line (" -> not found"); end if; -- Otherwise, get the time stamps of each archive. If one of -- them is found later than the executable, we need to relink. else Check_Time_Stamps (Exec_Time_Stamp); end if; -- If Need_To_Relink is False, we are done if Verbose_Mode and (not Need_To_Relink) then Write_Line (" -> up to date"); end if; end if; -- Prepare to link if Need_To_Relink then Link_Done := True; Last_Argument := 0; -- Specify the executable path name Add_Argument (Dash_o, True); Add_Argument (Get_Name_String (Data.Exec_Directory) & Directory_Separator & Get_Name_String (Executable_Of (Project => Main_Project, In_Tree => Project_Tree, Main => Main_Id, Index => 0, Ada_Main => False)), True); -- Specify the object file of the main source Add_Argument (Object_Dir & Directory_Separator & Get_Name_String (Source.Object_Name), True); -- Add all the archives, in a correct order Add_Archives (For_Gnatmake => False); -- Add the switches specified in package Linker of -- the main project. Add_Switches (Data => Data, Proc => Linker, Language => Source.Language, File_Name => Main_Id); -- Add the switches specified in attribute -- Linker_Options of packages Linker. if Link_Options_Switches = null then Link_Options_Switches := new Argument_List' (Linker_Options_Switches (Main_Project, Project_Tree)); end if; Add_Arguments (Link_Options_Switches.all, True); -- Add the linking options specified on the -- command line. for Arg in 1 .. Linker_Options.Last loop Add_Argument (Linker_Options.Table (Arg), True); end loop; -- If there are shared libraries and the run path -- option is supported, add the run path switch. if Lib_Path.Last > 0 then Add_Argument (Path_Option.all & String (Lib_Path.Table (1 .. Lib_Path.Last)), Verbose_Mode); end if; -- And invoke the linker Display_Command (Linker_Name.all, Linker_Path); Spawn (Linker_Path.all, Arguments (1 .. Last_Argument), Success); if not Success then Report_Error ("could not link ", Main); end if; end if; end Link_Foreign; -- Start of processing of Link_Executables begin -- If no mains specified, get mains from attribute Main, if it exists if not Mains_Specified then declare Element_Id : String_List_Id := Data.Mains; Element : String_Element; begin while Element_Id /= Nil_String loop Element := Project_Tree.String_Elements.Table (Element_Id); if Element.Value /= No_Name then Mains.Add_Main (Get_Name_String (Element.Value)); end if; Element_Id := Element.Next; end loop; end; end if; if Mains.Number_Of_Mains = 0 then -- If the attribute Main is an empty list or not specified, -- there is nothing to do. if Verbose_Mode then Write_Line ("No main to link"); end if; return; end if; -- Check if -o was used for several mains if Output_File_Name /= null and then Mains.Number_Of_Mains > 1 then Osint.Fail ("cannot specify an executable name for several mains"); end if; -- Check how we are going to do the link if not Data.Other_Sources_Present then -- Only Ada sources in the main project, and even maybe not if not Data.Languages (Ada_Language_Index) then -- Fail if the main project has no source of any language Osint.Fail ("project """, Get_Name_String (Data.Name), """ has no sources, so no main can be linked"); else -- Only Ada sources in the main project, call gnatmake directly Last_Argument := 0; -- Choose correct linker if there is C++ code in other projects if C_Plus_Plus_Is_Used then Choose_C_Plus_Plus_Link_Process; Add_Argument (Dash_largs, Verbose_Mode); Add_C_Plus_Plus_Link_For_Gnatmake; Add_Argument (Dash_margs, Verbose_Mode); end if; Compile_Link_With_Gnatmake (Mains_Specified); end if; else -- There are other language sources. First check if there are also -- sources in Ada. if Data.Languages (Ada_Language_Index) then -- There is a mix of Ada and other language sources in the main -- project. Any main that is not a source of the other languages -- will be deemed to be an Ada main. -- Find the mains of the other languages and the Ada mains Mains.Reset; Ada_Mains.Set_Last (0); Other_Mains.Set_Last (0); -- For each main loop declare Main : constant String := Mains.Next_Main; Main_Id : Name_Id; begin exit when Main'Length = 0; -- Get the main file name Name_Len := 0; Add_Str_To_Name_Buffer (Main); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Main_Id := Name_Find; Source_Id := Data.First_Other_Source; -- Check if it is a source of a language other than Ada while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); exit when Source.File_Name = Main_Id; Source_Id := Source.Next; end loop; -- If it is not, put it in the list of Ada mains if Source_Id = No_Other_Source then Ada_Mains.Increment_Last; Ada_Mains.Table (Ada_Mains.Last) := new String'(Main); -- Otherwise, put it in the list of other mains else Other_Mains.Increment_Last; Other_Mains.Table (Other_Mains.Last) := Source; end if; end; end loop; -- If C++ is one of the other language, create the shell script -- to do the link. if C_Plus_Plus_Is_Used then Choose_C_Plus_Plus_Link_Process; end if; -- Call gnatmake with the necessary switches for each non-Ada -- main, if there are some. for Main in 1 .. Other_Mains.Last loop declare Source : constant Other_Source := Other_Mains.Table (Main); begin Last_Argument := 0; -- Add -o if -o was specified if Output_File_Name = null then Add_Argument (Dash_o, True); Add_Argument (Get_Name_String (Executable_Of (Project => Main_Project, In_Tree => Project_Tree, Main => Other_Mains.Table (Main).File_Name, Index => 0, Ada_Main => False)), True); end if; -- Call gnatmake with the -B switch Add_Argument (Dash_B, True); -- Add to the linking options the object file of the source Add_Argument (Dash_largs, Verbose_Mode); Add_Argument (Get_Name_String (Source.Object_Name), Verbose_Mode); -- If C++ is one of the language, add the --LINK switch -- to the linking switches. if C_Plus_Plus_Is_Used then Add_C_Plus_Plus_Link_For_Gnatmake; end if; -- Add -margs so that the following switches are for -- gnatmake Add_Argument (Dash_margs, Verbose_Mode); -- And link with gnatmake Compile_Link_With_Gnatmake (Mains_Specified => False); end; end loop; -- If there are also Ada mains, call gnatmake for all these mains if Ada_Mains.Last /= 0 then Last_Argument := 0; -- Put all the Ada mains as the first arguments for Main in 1 .. Ada_Mains.Last loop Add_Argument (Ada_Mains.Table (Main).all, True); end loop; -- If C++ is one of the languages, add the --LINK switch to -- the linking switches. if Data.Languages (C_Plus_Plus_Language_Index) then Add_Argument (Dash_largs, Verbose_Mode); Add_C_Plus_Plus_Link_For_Gnatmake; Add_Argument (Dash_margs, Verbose_Mode); end if; -- And link with gnatmake Compile_Link_With_Gnatmake (Mains_Specified => False); end if; else -- No Ada source in main project -- First, get the linker to invoke if Data.Languages (C_Plus_Plus_Language_Index) then Get_Compiler (C_Plus_Plus_Language_Index); Linker_Name := Compiler_Names (C_Plus_Plus_Language_Index); Linker_Path := Compiler_Paths (C_Plus_Plus_Language_Index); else Get_Compiler (C_Language_Index); Linker_Name := Compiler_Names (C_Language_Index); Linker_Path := Compiler_Paths (C_Language_Index); end if; Link_Done := False; Mains.Reset; -- Get each main, check if it is a source of the main project, -- and if it is, invoke the linker. loop declare Main : constant String := Mains.Next_Main; Main_Id : Name_Id; begin exit when Main'Length = 0; -- Get the file name of the main Name_Len := 0; Add_Str_To_Name_Buffer (Main); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Main_Id := Name_Find; Source_Id := Data.First_Other_Source; -- Check if it is a source of the main project file while Source_Id /= No_Other_Source loop Source := Project_Tree.Other_Sources.Table (Source_Id); exit when Source.File_Name = Main_Id; Source_Id := Source.Next; end loop; -- Report an error if it is not if Source_Id = No_Other_Source then Report_Error (Main, "is not a source of project ", Get_Name_String (Data.Name)); else Link_Foreign (Main, Main_Id, Source); end if; end; end loop; -- If no linking was done, report it, except in Quiet Output if (Verbose_Mode or (not Quiet_Output)) and (not Link_Done) then Osint.Write_Program_Name; if Mains.Number_Of_Mains = 1 then -- If there is only one executable, report its name too Write_Str (": """); Mains.Reset; declare Main : constant String := Mains.Next_Main; Main_Id : Name_Id; begin Name_Len := 0; Add_Str_To_Name_Buffer (Main); Main_Id := Name_Find; Write_Str (Get_Name_String (Executable_Of (Project => Main_Project, In_Tree => Project_Tree, Main => Main_Id, Index => 0, Ada_Main => False))); Write_Line (""" up to date"); end; else Write_Line (": all executables up to date"); end if; end if; end if; end if; end Link_Executables; ------------------ -- Report_Error -- ------------------ procedure Report_Error (S1 : String; S2 : String := ""; S3 : String := "") is begin -- If Keep_Going is True, output error message preceded by error header if Keep_Going then Total_Number_Of_Errors := Total_Number_Of_Errors + 1; Write_Str (Error_Header); Write_Str (S1); Write_Str (S2); Write_Str (S3); Write_Eol; -- Otherwise just fail else Osint.Fail (S1, S2, S3); end if; end Report_Error; ------------------------- -- Report_Total_Errors -- ------------------------- procedure Report_Total_Errors (Kind : String) is begin if Total_Number_Of_Errors /= 0 then if Total_Number_Of_Errors = 1 then Osint.Fail ("One ", Kind, " error"); else Osint.Fail ("Total of" & Total_Number_Of_Errors'Img, ' ' & Kind & " errors"); end if; end if; end Report_Total_Errors; -------------- -- Scan_Arg -- -------------- procedure Scan_Arg (Arg : String) is begin pragma Assert (Arg'First = 1); if Arg'Length = 0 then return; end if; -- If preceding switch was -P, a project file name need to be -- specified, not a switch. if Project_File_Name_Expected then if Arg (1) = '-' then Osint.Fail ("project file name missing after -P"); else Project_File_Name_Expected := False; Project_File_Name := new String'(Arg); end if; -- If preceding switch was -o, an executable name need to be -- specified, not a switch. elsif Output_File_Name_Expected then if Arg (1) = '-' then Osint.Fail ("output file name missing after -o"); else Output_File_Name_Expected := False; Output_File_Name := new String'(Arg); end if; -- Set the processor/language for the following switches -- -cargs: Ada compiler arguments elsif Arg = "-cargs" then Current_Language := Ada_Language_Index; Current_Processor := Compiler; elsif Arg'Length > 7 and then Arg (1 .. 7) = "-cargs:" then Name_Len := 0; Add_Str_To_Name_Buffer (Arg (8 .. Arg'Last)); To_Lower (Name_Buffer (1 .. Name_Len)); declare Lang : constant Name_Id := Name_Find; begin Current_Language := Language_Indexes.Get (Lang); if Current_Language = No_Language_Index then Add_Language_Name (Lang); Current_Language := Last_Language_Index; end if; Current_Processor := Compiler; end; elsif Arg = "-largs" then Current_Processor := Linker; -- -gargs: gprmake elsif Arg = "-gargs" then Current_Processor := None; -- A special test is needed for the -o switch within a -largs since -- that is another way to specify the name of the final executable. elsif Current_Processor = Linker and then Arg = "-o" then Osint.Fail ("switch -o not allowed within a -largs. Use -o directly."); -- If current processor is not gprmake directly, store the option in -- the appropriate table. elsif Current_Processor /= None then Add_Option (Arg); -- Switches start with '-' elsif Arg (1) = '-' then if Arg = "-c" then Compile_Only := True; -- Make sure that when a main is specified and switch -c is used, -- only the main(s) is/are compiled. if Mains.Number_Of_Mains > 0 then Unique_Compile := True; end if; elsif Arg = "-d" then Display_Compilation_Progress := True; elsif Arg = "-f" then Force_Compilations := True; elsif Arg = "-h" then Usage; elsif Arg = "-k" then Keep_Going := True; elsif Arg = "-o" then if Output_File_Name /= null then Osint.Fail ("cannot specify several -o switches"); else Output_File_Name_Expected := True; end if; elsif Arg'Length >= 2 and then Arg (2) = 'P' then if Project_File_Name /= null then Osint.Fail ("cannot have several project files specified"); elsif Arg'Length = 2 then Project_File_Name_Expected := True; else Project_File_Name := new String'(Arg (3 .. Arg'Last)); end if; elsif Arg = "-q" then Quiet_Output := True; elsif Arg = "-u" then Unique_Compile := True; Compile_Only := True; elsif Arg = "-v" then Verbose_Mode := True; Copyright; elsif Arg'Length = 4 and then Arg (1 .. 3) = "-vP" and then Arg (4) in '0' .. '2' then case Arg (4) is when '0' => Current_Verbosity := Prj.Default; when '1' => Current_Verbosity := Prj.Medium; when '2' => Current_Verbosity := Prj.High; when others => null; end case; elsif Arg'Length >= 3 and then Arg (2) = 'X' and then Is_External_Assignment (Arg) then -- Is_External_Assignment has side effects when it returns True -- Record the -X switch, so that they can be passed to gnatmake, -- if gnatmake is called. X_Switches.Increment_Last; X_Switches.Table (X_Switches.Last) := new String'(Arg); else Osint.Fail ("illegal option """, Arg, """"); end if; else -- Not a switch: must be a main Mains.Add_Main (Arg); -- Make sure that when a main is specified and switch -c is used, -- only the main(s) is/are compiled. if Compile_Only then Unique_Compile := True; end if; end if; end Scan_Arg; ----------------- -- Strip_CR_LF -- ----------------- function Strip_CR_LF (Text : String) return String is To : String (1 .. Text'Length); Index_To : Natural := 0; begin for Index in Text'Range loop if (Text (Index) /= ASCII.CR) and then (Text (Index) /= ASCII.LF) then Index_To := Index_To + 1; To (Index_To) := Text (Index); end if; end loop; return To (1 .. Index_To); end Strip_CR_LF; ----------- -- Usage -- ----------- procedure Usage is begin if not Usage_Output then Usage_Output := True; Copyright; Write_Str ("Usage: "); Osint.Write_Program_Name; Write_Str (" -P<project file> [opts] [name] {"); for Lang in First_Language_Indexes loop Write_Str ("[-cargs:lang opts] "); end loop; Write_Str ("[-largs opts] [-gargs opts]}"); Write_Eol; Write_Eol; Write_Str (" name is zero or more file names"); Write_Eol; Write_Eol; -- GPRMAKE switches Write_Str ("gprmake switches:"); Write_Eol; -- Line for -c Write_Str (" -c Compile only"); Write_Eol; -- Line for -f Write_Str (" -f Force recompilations"); Write_Eol; -- Line for -k Write_Str (" -k Keep going after compilation errors"); Write_Eol; -- Line for -o Write_Str (" -o name Choose an alternate executable name"); Write_Eol; -- Line for -P Write_Str (" -Pproj Use GNAT Project File proj"); Write_Eol; -- Line for -q Write_Str (" -q Be quiet/terse"); Write_Eol; -- Line for -u Write_Str (" -u Unique compilation. Only compile the given files"); Write_Eol; -- Line for -v Write_Str (" -v Verbose output"); Write_Eol; -- Line for -vPx Write_Str (" -vPx Specify verbosity when parsing Project Files"); Write_Eol; -- Line for -X Write_Str (" -Xnm=val Specify an external reference for " & "Project Files"); Write_Eol; Write_Eol; -- Line for -cargs Write_Line (" -cargs opts opts are passed to the Ada compiler"); -- Line for -cargs:lang Write_Line (" -cargs:<lang> opts"); Write_Line (" opts are passed to the compiler " & "for language < lang > "); -- Line for -largs Write_Str (" -largs opts opts are passed to the linker"); Write_Eol; -- Line for -gargs Write_Str (" -gargs opts opts directly interpreted by gprmake"); Write_Eol; Write_Eol; end if; end Usage; begin Makeutl.Do_Fail := Report_Error'Access; end Makegpr;
[ { "context": "\n-- Author: A. Ireland\n--\n-- Address: School Mathematical & ", "end": 35, "score": 0.9998865127563477, "start": 25, "tag": "NAME", "value": "A. Ireland" }, { "context": " Edinburgh, EH14 4AS\n--\n-- E-mail: a.ireland@hw.ac.uk\n--\n-- Last modified: 13.9.2019\n--\n-- Filena", "end": 239, "score": 0.9999319314956665, "start": 221, "tag": "EMAIL", "value": "a.ireland@hw.ac.uk" } ]
alloy/coursework_two/handler.ads
m-f-1998/university
0
-- Author: A. Ireland -- -- Address: School Mathematical & Computer Sciences -- Heriot-Watt University -- Edinburgh, EH14 4AS -- -- E-mail: a.ireland@hw.ac.uk -- -- Last modified: 13.9.2019 -- -- Filename: handler.ads -- -- Description: Provides the drivers required for simulating the -- environment in which the WTP system operates as -- well as a logging capability. pragma SPARK_Mode (Off); package Handler is subtype Sensor_Range is Integer range 0..2100; type Water_Level_Cat is (Low, Normal, High, Undef); procedure Update_Env; function At_End return Boolean; procedure Open_Env_File; procedure Close_Env_File; procedure Update_Log; procedure Open_Log_File; procedure Close_Log_File; end Handler;
20548
-- Author: <NAME> -- -- Address: School Mathematical & Computer Sciences -- Heriot-Watt University -- Edinburgh, EH14 4AS -- -- E-mail: <EMAIL> -- -- Last modified: 13.9.2019 -- -- Filename: handler.ads -- -- Description: Provides the drivers required for simulating the -- environment in which the WTP system operates as -- well as a logging capability. pragma SPARK_Mode (Off); package Handler is subtype Sensor_Range is Integer range 0..2100; type Water_Level_Cat is (Low, Normal, High, Undef); procedure Update_Env; function At_End return Boolean; procedure Open_Env_File; procedure Close_Env_File; procedure Update_Log; procedure Open_Log_File; procedure Close_Log_File; end Handler;
true
-- Author: PI:NAME:<NAME>END_PI -- -- Address: School Mathematical & Computer Sciences -- Heriot-Watt University -- Edinburgh, EH14 4AS -- -- E-mail: PI:EMAIL:<EMAIL>END_PI -- -- Last modified: 13.9.2019 -- -- Filename: handler.ads -- -- Description: Provides the drivers required for simulating the -- environment in which the WTP system operates as -- well as a logging capability. pragma SPARK_Mode (Off); package Handler is subtype Sensor_Range is Integer range 0..2100; type Water_Level_Cat is (Low, Normal, High, Undef); procedure Update_Env; function At_End return Boolean; procedure Open_Env_File; procedure Close_Env_File; procedure Update_Log; procedure Open_Log_File; procedure Close_Log_File; end Handler;
[ { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --\n-- All rig", "end": 829, "score": 0.9998877644538879, "start": 816, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --\n-- All rights reserved. ", "end": 849, "score": 0.9999317526817322, "start": 831, "tag": "EMAIL", "value": "vgodunko@gmail.com" } ]
source/amf/mof/cmof/amf-internals-cmof_package_merges.adb
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Visitors.CMOF_Iterators; with AMF.Visitors.CMOF_Visitors; package body AMF.Internals.CMOF_Package_Merges is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant CMOF_Package_Merge_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class then AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class (Visitor).Enter_Package_Merge (AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant CMOF_Package_Merge_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class then AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class (Visitor).Leave_Package_Merge (AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant CMOF_Package_Merge_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.CMOF_Iterators.CMOF_Iterator'Class then AMF.Visitors.CMOF_Iterators.CMOF_Iterator'Class (Iterator).Visit_Package_Merge (Visitor, AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access (Self), Control); end if; end Visit_Element; ------------------------ -- All_Owned_Elements -- ------------------------ overriding function All_Owned_Elements (Self : not null access constant CMOF_Package_Merge_Proxy) return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owned_Elements unimplemented"); raise Program_Error; return All_Owned_Elements (Self); end All_Owned_Elements; ------------------------- -- Get_Related_Element -- ------------------------- overriding function Get_Related_Element (Self : not null access constant CMOF_Package_Merge_Proxy) return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Related_Element unimplemented"); raise Program_Error; return Get_Related_Element (Self); end Get_Related_Element; --------------------------- -- Get_Receiving_Package -- --------------------------- overriding function Get_Receiving_Package (Self : not null access constant CMOF_Package_Merge_Proxy) return AMF.CMOF.Packages.CMOF_Package_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Receiving_Package unimplemented"); raise Program_Error; return Get_Receiving_Package (Self); end Get_Receiving_Package; --------------------------- -- Set_Receiving_Package -- --------------------------- overriding procedure Set_Receiving_Package (Self : not null access CMOF_Package_Merge_Proxy; To : AMF.CMOF.Packages.CMOF_Package_Access) is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Set_Receiving_Package unimplemented"); raise Program_Error; end Set_Receiving_Package; ------------------------ -- Get_Merged_Package -- ------------------------ overriding function Get_Merged_Package (Self : not null access constant CMOF_Package_Merge_Proxy) return AMF.CMOF.Packages.CMOF_Package_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Merged_Package unimplemented"); raise Program_Error; return Get_Merged_Package (Self); end Get_Merged_Package; ------------------------ -- Set_Merged_Package -- ------------------------ overriding procedure Set_Merged_Package (Self : not null access CMOF_Package_Merge_Proxy; To : AMF.CMOF.Packages.CMOF_Package_Access) is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Set_Merged_Package unimplemented"); raise Program_Error; end Set_Merged_Package; end AMF.Internals.CMOF_Package_Merges;
24270
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- 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.Visitors.CMOF_Iterators; with AMF.Visitors.CMOF_Visitors; package body AMF.Internals.CMOF_Package_Merges is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant CMOF_Package_Merge_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class then AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class (Visitor).Enter_Package_Merge (AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant CMOF_Package_Merge_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class then AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class (Visitor).Leave_Package_Merge (AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant CMOF_Package_Merge_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.CMOF_Iterators.CMOF_Iterator'Class then AMF.Visitors.CMOF_Iterators.CMOF_Iterator'Class (Iterator).Visit_Package_Merge (Visitor, AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access (Self), Control); end if; end Visit_Element; ------------------------ -- All_Owned_Elements -- ------------------------ overriding function All_Owned_Elements (Self : not null access constant CMOF_Package_Merge_Proxy) return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owned_Elements unimplemented"); raise Program_Error; return All_Owned_Elements (Self); end All_Owned_Elements; ------------------------- -- Get_Related_Element -- ------------------------- overriding function Get_Related_Element (Self : not null access constant CMOF_Package_Merge_Proxy) return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Related_Element unimplemented"); raise Program_Error; return Get_Related_Element (Self); end Get_Related_Element; --------------------------- -- Get_Receiving_Package -- --------------------------- overriding function Get_Receiving_Package (Self : not null access constant CMOF_Package_Merge_Proxy) return AMF.CMOF.Packages.CMOF_Package_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Receiving_Package unimplemented"); raise Program_Error; return Get_Receiving_Package (Self); end Get_Receiving_Package; --------------------------- -- Set_Receiving_Package -- --------------------------- overriding procedure Set_Receiving_Package (Self : not null access CMOF_Package_Merge_Proxy; To : AMF.CMOF.Packages.CMOF_Package_Access) is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Set_Receiving_Package unimplemented"); raise Program_Error; end Set_Receiving_Package; ------------------------ -- Get_Merged_Package -- ------------------------ overriding function Get_Merged_Package (Self : not null access constant CMOF_Package_Merge_Proxy) return AMF.CMOF.Packages.CMOF_Package_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Merged_Package unimplemented"); raise Program_Error; return Get_Merged_Package (Self); end Get_Merged_Package; ------------------------ -- Set_Merged_Package -- ------------------------ overriding procedure Set_Merged_Package (Self : not null access CMOF_Package_Merge_Proxy; To : AMF.CMOF.Packages.CMOF_Package_Access) is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Set_Merged_Package unimplemented"); raise Program_Error; end Set_Merged_Package; end AMF.Internals.CMOF_Package_Merges;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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.Visitors.CMOF_Iterators; with AMF.Visitors.CMOF_Visitors; package body AMF.Internals.CMOF_Package_Merges is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant CMOF_Package_Merge_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class then AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class (Visitor).Enter_Package_Merge (AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant CMOF_Package_Merge_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control) is begin if Visitor in AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class then AMF.Visitors.CMOF_Visitors.CMOF_Visitor'Class (Visitor).Leave_Package_Merge (AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant CMOF_Package_Merge_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.CMOF_Iterators.CMOF_Iterator'Class then AMF.Visitors.CMOF_Iterators.CMOF_Iterator'Class (Iterator).Visit_Package_Merge (Visitor, AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access (Self), Control); end if; end Visit_Element; ------------------------ -- All_Owned_Elements -- ------------------------ overriding function All_Owned_Elements (Self : not null access constant CMOF_Package_Merge_Proxy) return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "All_Owned_Elements unimplemented"); raise Program_Error; return All_Owned_Elements (Self); end All_Owned_Elements; ------------------------- -- Get_Related_Element -- ------------------------- overriding function Get_Related_Element (Self : not null access constant CMOF_Package_Merge_Proxy) return AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Related_Element unimplemented"); raise Program_Error; return Get_Related_Element (Self); end Get_Related_Element; --------------------------- -- Get_Receiving_Package -- --------------------------- overriding function Get_Receiving_Package (Self : not null access constant CMOF_Package_Merge_Proxy) return AMF.CMOF.Packages.CMOF_Package_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Receiving_Package unimplemented"); raise Program_Error; return Get_Receiving_Package (Self); end Get_Receiving_Package; --------------------------- -- Set_Receiving_Package -- --------------------------- overriding procedure Set_Receiving_Package (Self : not null access CMOF_Package_Merge_Proxy; To : AMF.CMOF.Packages.CMOF_Package_Access) is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Set_Receiving_Package unimplemented"); raise Program_Error; end Set_Receiving_Package; ------------------------ -- Get_Merged_Package -- ------------------------ overriding function Get_Merged_Package (Self : not null access constant CMOF_Package_Merge_Proxy) return AMF.CMOF.Packages.CMOF_Package_Access is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Get_Merged_Package unimplemented"); raise Program_Error; return Get_Merged_Package (Self); end Get_Merged_Package; ------------------------ -- Set_Merged_Package -- ------------------------ overriding procedure Set_Merged_Package (Self : not null access CMOF_Package_Merge_Proxy; To : AMF.CMOF.Packages.CMOF_Package_Access) is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Set_Merged_Package unimplemented"); raise Program_Error; end Set_Merged_Package; end AMF.Internals.CMOF_Package_Merges;
[ { "context": "---------------------\n-- G E L A A S I S --\n-", "end": 109, "score": 0.7338326573371887, "start": 108, "tag": "NAME", "value": "G" }, { "context": "---------------------\n-- Copyright (c) 2008-2013, Maxim Reznik\n-- All rights reserved.\n--\n-- Redistribution an", "end": 11757, "score": 0.9998543858528137, "start": 11745, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "the distribution.\n-- * Neither the name of the Maxim Reznik, IE nor the names of its\n-- contributors ma", "end": 12358, "score": 0.9995059967041016, "start": 12346, "tag": "NAME", "value": "Maxim Reznik" } ]
source/asis/asis-gela-private_operations.adb
faelys/gela-asis
4
------------------------------------------------------------------------------ -- G E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $: with Asis.Elements; with Asis.Declarations; with Asis.Gela.Utils; with Asis.Gela.Implicit; with Asis.Gela.Inheritance; with Ada.Wide_Text_IO; package body Asis.Gela.Private_Operations is procedure Create_Type_Data (Data : in Package_Data; Info : in Classes.Type_Info); procedure Check_Dependent (Tipe : in Asis.Declaration; Exist : in Type_Data_Access; Data : in Package_Data; Info : in Classes.Type_Info; Point : in out Visibility.Point); procedure Fill_Dependencies (Element : in Asis.Declaration; Data : in Package_Data; Info : in Classes.Type_Info); function Find (Data : in Package_Data; Info : in Classes.Type_Info) return Type_Data_Access; ------------------------ -- Check_Derived_Type -- ------------------------ procedure Check_Derived_Type (Tipe_Decl : in Asis.Declaration; From : in Asis.Element; Point : in out Visibility.Point) is use Asis.Elements; Def : Asis.Definition; begin case Declaration_Kind (Tipe_Decl) is when An_Ordinary_Type_Declaration | A_Private_Type_Declaration | A_Formal_Type_Declaration => Def := Asis.Declarations.Type_Declaration_View (Tipe_Decl); case Type_Kind (Def) is when A_Derived_Type_Definition | A_Derived_Record_Extension_Definition => Inheritance.Check_Inherited_Subprograms (Tipe_Decl, From, Point); when others => null; end case; when others => null; end case; end Check_Derived_Type; --------------------- -- Check_Dependent -- --------------------- procedure Check_Dependent (Tipe : in Asis.Declaration; Exist : in Type_Data_Access; Data : in Package_Data; Info : in Classes.Type_Info; Point : in out Visibility.Point) is use Type_Info_Lists; use Asis.Gela.Classes; Dependent : Cursor; Found : Type_Data_Access; Refreshed : Type_Info; begin Dependent := First (Exist.Dependent); while Has_Element (Dependent) loop Found := Find (Data, Type_Info_Lists.Element (Dependent)); if Found = null then raise Internal_Error; end if; Refreshed := Type_From_Declaration (Get_Declaration (Found.Info), Tipe); if not Is_Equal_Class (Found.Info, Refreshed) or Is_Limited (Found.Info) /= Is_Limited (Refreshed) then Implicit.Make_Operations (Tipe => Refreshed, Was => Found.Info, Point => Point); Found.Info := Refreshed; Check_Dependent (Tipe, Found, Data, Refreshed, Point); end if; Dependent := Next (Dependent); end loop; end Check_Dependent; ------------ -- Greate -- ------------ function Create (Element : in Asis.Declaration) return Package_Data is Result : constant Package_Data := new Package_Data_Node; begin Result.Element := Element; return Result; end Create; ---------------- -- Check_Type -- ---------------- procedure Check_Type (Element : in Asis.Declaration; Data : in Package_Data; Point : in out Visibility.Point) is use Asis.Elements; use Asis.Gela.Classes; Info : constant Type_Info := Type_From_Declaration (Element, Element); Found : Type_Data_Access; begin if Declaration_Kind (Element) = Asis.A_Private_Type_Declaration then Create_Type_Data (Data, Info); else Found := Find (Data, Info); if Found /= null then if not Is_Equal_Class (Found.Info, Info) or Is_Limited (Found.Info) /= Is_Limited (Info) then Found.Info := Info; Check_Dependent (Element, Found, Data, Info, Point); end if; elsif Is_Composite (Info) then Fill_Dependencies (Element, Data, Info); end if; end if; end Check_Type; ---------------------- -- Create_Type_Data -- ---------------------- procedure Create_Type_Data (Data : in Package_Data; Info : in Classes.Type_Info) is Result : constant Type_Data_Access := new Type_Data; begin Result.Info := Info; Type_Data_List.Append (Data.Types, Result); end Create_Type_Data; ----------------------- -- Fill_Dependencies -- ----------------------- procedure Fill_Dependencies (Element : in Asis.Declaration; Data : in Package_Data; Info : in Classes.Type_Info) is procedure Check_Component (Component_Type : Classes.Type_Info) is use Type_Info_Lists; Found : constant Type_Data_Access := Find (Data, Component_Type); begin -- If component type is subject to change: if Found /= null then -- If not in dependencies list yet: if not Contains (Found.Dependent, Info) then Append (Found.Dependent, Info); -- If new type not in subject_to_change list if Find (Data, Info) = null then -- Add it to the list Create_Type_Data (Data, Info); end if; end if; end if; end Check_Component; procedure Walk_Variant (Item : in Asis.Variant; Continue : out Boolean) is begin Continue := True; end Walk_Variant; procedure Walk_Companent (Item : in Asis.Declaration; Continue : out Boolean) is Component_Type : constant Classes.Type_Info := Classes.Type_Of_Declaration (Item, Element); begin Check_Component (Component_Type); Continue := True; end Walk_Companent; procedure Walk_Components is new Utils.Walk_Components (Element, Walk_Variant, Walk_Companent); Continue : Boolean; begin if Classes.Is_Array (Info) then Check_Component (Classes.Get_Array_Element_Type (Info)); -- elsif Derived? else Walk_Components (Element, Continue); end if; end Fill_Dependencies; ---------- -- Find -- ---------- function Find (Data : in Package_Data; Info : in Classes.Type_Info) return Type_Data_Access is use Type_Data_List; Next : aliased Type_Data_Access; begin while Iterate (Data.Types, Next'Access) loop if Classes.Is_Equal (Next.Info, Info) then return Next; end if; end loop; return null; end Find; --------------------- -- On_Package_Body -- --------------------- procedure On_Package_Body (Element : in Asis.Declaration; Point : in out Visibility.Point) is use Asis.Gela.Classes; function Specification (Element : Asis.Declaration) return Asis.Declaration is use Asis.Declarations; Item : Asis.Declaration := Element; begin if Is_Subunit(Item) then Item := Corresponding_Body_Stub (Item); end if; return Corresponding_Declaration (Item); end Specification; Spec : constant Asis.Declaration := Specification (Element); List : constant Asis.Declarative_Item_List := Asis.Declarations.Visible_Part_Declarative_Items (Spec); Priv : constant Asis.Declarative_Item_List := Asis.Declarations.Private_Part_Declarative_Items (Spec); From : Type_Info; To : Type_Info; Body_View : constant Asis.Element := Visibility.End_Of_Package (Element); Spec_View : Asis.Element; begin if Priv'Length = 0 then Spec_View := Visibility.End_Of_Package (Spec); else Spec_View := Priv (Priv'Last); end if; for J in List'Range loop From := Type_From_Declaration (List (J), Spec_View); To := Type_From_Declaration (List (J), Body_View); if not Is_Equal_Class (From, To) or Is_Limited (From) /= Is_Limited (To) then -- Ada.Wide_Text_IO.Put_Line ("Old:" & Debug_Image (From)); -- Ada.Wide_Text_IO.Put_Line ("New:" & Debug_Image (To)); Implicit.Make_Operations (Tipe => To, Was => From, Point => Point); end if; Check_Derived_Type (List (J), Body_View, Point); end loop; end On_Package_Body; --------------------- -- On_Private_Part -- --------------------- procedure On_Private_Part (Element : in Asis.Declaration; Point : in out Visibility.Point) is use Asis.Gela.Classes; List : constant Asis.Declarative_Item_List := Asis.Declarations.Visible_Part_Declarative_Items (Element); Priv : constant Asis.Declarative_Item_List := Asis.Declarations.Private_Part_Declarative_Items (Element); From : Type_Info; To : Type_Info; Spec_View : Asis.Element; begin if Priv'Length = 0 then Spec_View := Visibility.End_Of_Package (Element); else Spec_View := Priv (Priv'Last); end if; for J in List'Range loop From := Type_From_Declaration (List (J), List (List'Last)); To := Type_From_Declaration (List (J), Spec_View); if not Is_Equal_Class (From, To) or Is_Limited (From) /= Is_Limited (To) then Implicit.Make_Operations (Tipe => To, Was => From, Point => Point); end if; Check_Derived_Type (List (J), Spec_View, Point); end loop; end On_Private_Part; ---------- -- Push -- ---------- procedure Push (Stack : in out Package_Data_Stack; Item : in Package_Data) is begin Prepend (Stack, Item); end Push; procedure Pop (Stack : in out Package_Data_Stack) is Item : Package_Data; begin Delete_First (Stack, Item); end Pop; function Top (Stack : Package_Data_Stack) return Package_Data is begin return First (Stack); end Top; function Get_Next (Item : Package_Data) return Package_Data is begin return Item.Next; end Get_Next; function Get_Next (Item : Type_Data_Access) return Type_Data_Access is begin return Item.Next; end Get_Next; procedure Set_Next (Item, Next : Package_Data) is begin Item.Next := Next; end Set_Next; procedure Set_Next (Item, Next : Type_Data_Access) is begin Item.Next := Next; end Set_Next; end Asis.Gela.Private_Operations; ------------------------------------------------------------------------------ -- Copyright (c) 2008-2013, Maxim Reznik -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the Maxim Reznik, 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 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. ------------------------------------------------------------------------------
12131
------------------------------------------------------------------------------ -- <NAME> E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $: with Asis.Elements; with Asis.Declarations; with Asis.Gela.Utils; with Asis.Gela.Implicit; with Asis.Gela.Inheritance; with Ada.Wide_Text_IO; package body Asis.Gela.Private_Operations is procedure Create_Type_Data (Data : in Package_Data; Info : in Classes.Type_Info); procedure Check_Dependent (Tipe : in Asis.Declaration; Exist : in Type_Data_Access; Data : in Package_Data; Info : in Classes.Type_Info; Point : in out Visibility.Point); procedure Fill_Dependencies (Element : in Asis.Declaration; Data : in Package_Data; Info : in Classes.Type_Info); function Find (Data : in Package_Data; Info : in Classes.Type_Info) return Type_Data_Access; ------------------------ -- Check_Derived_Type -- ------------------------ procedure Check_Derived_Type (Tipe_Decl : in Asis.Declaration; From : in Asis.Element; Point : in out Visibility.Point) is use Asis.Elements; Def : Asis.Definition; begin case Declaration_Kind (Tipe_Decl) is when An_Ordinary_Type_Declaration | A_Private_Type_Declaration | A_Formal_Type_Declaration => Def := Asis.Declarations.Type_Declaration_View (Tipe_Decl); case Type_Kind (Def) is when A_Derived_Type_Definition | A_Derived_Record_Extension_Definition => Inheritance.Check_Inherited_Subprograms (Tipe_Decl, From, Point); when others => null; end case; when others => null; end case; end Check_Derived_Type; --------------------- -- Check_Dependent -- --------------------- procedure Check_Dependent (Tipe : in Asis.Declaration; Exist : in Type_Data_Access; Data : in Package_Data; Info : in Classes.Type_Info; Point : in out Visibility.Point) is use Type_Info_Lists; use Asis.Gela.Classes; Dependent : Cursor; Found : Type_Data_Access; Refreshed : Type_Info; begin Dependent := First (Exist.Dependent); while Has_Element (Dependent) loop Found := Find (Data, Type_Info_Lists.Element (Dependent)); if Found = null then raise Internal_Error; end if; Refreshed := Type_From_Declaration (Get_Declaration (Found.Info), Tipe); if not Is_Equal_Class (Found.Info, Refreshed) or Is_Limited (Found.Info) /= Is_Limited (Refreshed) then Implicit.Make_Operations (Tipe => Refreshed, Was => Found.Info, Point => Point); Found.Info := Refreshed; Check_Dependent (Tipe, Found, Data, Refreshed, Point); end if; Dependent := Next (Dependent); end loop; end Check_Dependent; ------------ -- Greate -- ------------ function Create (Element : in Asis.Declaration) return Package_Data is Result : constant Package_Data := new Package_Data_Node; begin Result.Element := Element; return Result; end Create; ---------------- -- Check_Type -- ---------------- procedure Check_Type (Element : in Asis.Declaration; Data : in Package_Data; Point : in out Visibility.Point) is use Asis.Elements; use Asis.Gela.Classes; Info : constant Type_Info := Type_From_Declaration (Element, Element); Found : Type_Data_Access; begin if Declaration_Kind (Element) = Asis.A_Private_Type_Declaration then Create_Type_Data (Data, Info); else Found := Find (Data, Info); if Found /= null then if not Is_Equal_Class (Found.Info, Info) or Is_Limited (Found.Info) /= Is_Limited (Info) then Found.Info := Info; Check_Dependent (Element, Found, Data, Info, Point); end if; elsif Is_Composite (Info) then Fill_Dependencies (Element, Data, Info); end if; end if; end Check_Type; ---------------------- -- Create_Type_Data -- ---------------------- procedure Create_Type_Data (Data : in Package_Data; Info : in Classes.Type_Info) is Result : constant Type_Data_Access := new Type_Data; begin Result.Info := Info; Type_Data_List.Append (Data.Types, Result); end Create_Type_Data; ----------------------- -- Fill_Dependencies -- ----------------------- procedure Fill_Dependencies (Element : in Asis.Declaration; Data : in Package_Data; Info : in Classes.Type_Info) is procedure Check_Component (Component_Type : Classes.Type_Info) is use Type_Info_Lists; Found : constant Type_Data_Access := Find (Data, Component_Type); begin -- If component type is subject to change: if Found /= null then -- If not in dependencies list yet: if not Contains (Found.Dependent, Info) then Append (Found.Dependent, Info); -- If new type not in subject_to_change list if Find (Data, Info) = null then -- Add it to the list Create_Type_Data (Data, Info); end if; end if; end if; end Check_Component; procedure Walk_Variant (Item : in Asis.Variant; Continue : out Boolean) is begin Continue := True; end Walk_Variant; procedure Walk_Companent (Item : in Asis.Declaration; Continue : out Boolean) is Component_Type : constant Classes.Type_Info := Classes.Type_Of_Declaration (Item, Element); begin Check_Component (Component_Type); Continue := True; end Walk_Companent; procedure Walk_Components is new Utils.Walk_Components (Element, Walk_Variant, Walk_Companent); Continue : Boolean; begin if Classes.Is_Array (Info) then Check_Component (Classes.Get_Array_Element_Type (Info)); -- elsif Derived? else Walk_Components (Element, Continue); end if; end Fill_Dependencies; ---------- -- Find -- ---------- function Find (Data : in Package_Data; Info : in Classes.Type_Info) return Type_Data_Access is use Type_Data_List; Next : aliased Type_Data_Access; begin while Iterate (Data.Types, Next'Access) loop if Classes.Is_Equal (Next.Info, Info) then return Next; end if; end loop; return null; end Find; --------------------- -- On_Package_Body -- --------------------- procedure On_Package_Body (Element : in Asis.Declaration; Point : in out Visibility.Point) is use Asis.Gela.Classes; function Specification (Element : Asis.Declaration) return Asis.Declaration is use Asis.Declarations; Item : Asis.Declaration := Element; begin if Is_Subunit(Item) then Item := Corresponding_Body_Stub (Item); end if; return Corresponding_Declaration (Item); end Specification; Spec : constant Asis.Declaration := Specification (Element); List : constant Asis.Declarative_Item_List := Asis.Declarations.Visible_Part_Declarative_Items (Spec); Priv : constant Asis.Declarative_Item_List := Asis.Declarations.Private_Part_Declarative_Items (Spec); From : Type_Info; To : Type_Info; Body_View : constant Asis.Element := Visibility.End_Of_Package (Element); Spec_View : Asis.Element; begin if Priv'Length = 0 then Spec_View := Visibility.End_Of_Package (Spec); else Spec_View := Priv (Priv'Last); end if; for J in List'Range loop From := Type_From_Declaration (List (J), Spec_View); To := Type_From_Declaration (List (J), Body_View); if not Is_Equal_Class (From, To) or Is_Limited (From) /= Is_Limited (To) then -- Ada.Wide_Text_IO.Put_Line ("Old:" & Debug_Image (From)); -- Ada.Wide_Text_IO.Put_Line ("New:" & Debug_Image (To)); Implicit.Make_Operations (Tipe => To, Was => From, Point => Point); end if; Check_Derived_Type (List (J), Body_View, Point); end loop; end On_Package_Body; --------------------- -- On_Private_Part -- --------------------- procedure On_Private_Part (Element : in Asis.Declaration; Point : in out Visibility.Point) is use Asis.Gela.Classes; List : constant Asis.Declarative_Item_List := Asis.Declarations.Visible_Part_Declarative_Items (Element); Priv : constant Asis.Declarative_Item_List := Asis.Declarations.Private_Part_Declarative_Items (Element); From : Type_Info; To : Type_Info; Spec_View : Asis.Element; begin if Priv'Length = 0 then Spec_View := Visibility.End_Of_Package (Element); else Spec_View := Priv (Priv'Last); end if; for J in List'Range loop From := Type_From_Declaration (List (J), List (List'Last)); To := Type_From_Declaration (List (J), Spec_View); if not Is_Equal_Class (From, To) or Is_Limited (From) /= Is_Limited (To) then Implicit.Make_Operations (Tipe => To, Was => From, Point => Point); end if; Check_Derived_Type (List (J), Spec_View, Point); end loop; end On_Private_Part; ---------- -- Push -- ---------- procedure Push (Stack : in out Package_Data_Stack; Item : in Package_Data) is begin Prepend (Stack, Item); end Push; procedure Pop (Stack : in out Package_Data_Stack) is Item : Package_Data; begin Delete_First (Stack, Item); end Pop; function Top (Stack : Package_Data_Stack) return Package_Data is begin return First (Stack); end Top; function Get_Next (Item : Package_Data) return Package_Data is begin return Item.Next; end Get_Next; function Get_Next (Item : Type_Data_Access) return Type_Data_Access is begin return Item.Next; end Get_Next; procedure Set_Next (Item, Next : Package_Data) is begin Item.Next := Next; end Set_Next; procedure Set_Next (Item, Next : Type_Data_Access) is begin Item.Next := Next; end Set_Next; end Asis.Gela.Private_Operations; ------------------------------------------------------------------------------ -- Copyright (c) 2008-2013, <NAME> -- 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 <NAME>, 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 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. ------------------------------------------------------------------------------
true
------------------------------------------------------------------------------ -- PI:NAME:<NAME>END_PI E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $: with Asis.Elements; with Asis.Declarations; with Asis.Gela.Utils; with Asis.Gela.Implicit; with Asis.Gela.Inheritance; with Ada.Wide_Text_IO; package body Asis.Gela.Private_Operations is procedure Create_Type_Data (Data : in Package_Data; Info : in Classes.Type_Info); procedure Check_Dependent (Tipe : in Asis.Declaration; Exist : in Type_Data_Access; Data : in Package_Data; Info : in Classes.Type_Info; Point : in out Visibility.Point); procedure Fill_Dependencies (Element : in Asis.Declaration; Data : in Package_Data; Info : in Classes.Type_Info); function Find (Data : in Package_Data; Info : in Classes.Type_Info) return Type_Data_Access; ------------------------ -- Check_Derived_Type -- ------------------------ procedure Check_Derived_Type (Tipe_Decl : in Asis.Declaration; From : in Asis.Element; Point : in out Visibility.Point) is use Asis.Elements; Def : Asis.Definition; begin case Declaration_Kind (Tipe_Decl) is when An_Ordinary_Type_Declaration | A_Private_Type_Declaration | A_Formal_Type_Declaration => Def := Asis.Declarations.Type_Declaration_View (Tipe_Decl); case Type_Kind (Def) is when A_Derived_Type_Definition | A_Derived_Record_Extension_Definition => Inheritance.Check_Inherited_Subprograms (Tipe_Decl, From, Point); when others => null; end case; when others => null; end case; end Check_Derived_Type; --------------------- -- Check_Dependent -- --------------------- procedure Check_Dependent (Tipe : in Asis.Declaration; Exist : in Type_Data_Access; Data : in Package_Data; Info : in Classes.Type_Info; Point : in out Visibility.Point) is use Type_Info_Lists; use Asis.Gela.Classes; Dependent : Cursor; Found : Type_Data_Access; Refreshed : Type_Info; begin Dependent := First (Exist.Dependent); while Has_Element (Dependent) loop Found := Find (Data, Type_Info_Lists.Element (Dependent)); if Found = null then raise Internal_Error; end if; Refreshed := Type_From_Declaration (Get_Declaration (Found.Info), Tipe); if not Is_Equal_Class (Found.Info, Refreshed) or Is_Limited (Found.Info) /= Is_Limited (Refreshed) then Implicit.Make_Operations (Tipe => Refreshed, Was => Found.Info, Point => Point); Found.Info := Refreshed; Check_Dependent (Tipe, Found, Data, Refreshed, Point); end if; Dependent := Next (Dependent); end loop; end Check_Dependent; ------------ -- Greate -- ------------ function Create (Element : in Asis.Declaration) return Package_Data is Result : constant Package_Data := new Package_Data_Node; begin Result.Element := Element; return Result; end Create; ---------------- -- Check_Type -- ---------------- procedure Check_Type (Element : in Asis.Declaration; Data : in Package_Data; Point : in out Visibility.Point) is use Asis.Elements; use Asis.Gela.Classes; Info : constant Type_Info := Type_From_Declaration (Element, Element); Found : Type_Data_Access; begin if Declaration_Kind (Element) = Asis.A_Private_Type_Declaration then Create_Type_Data (Data, Info); else Found := Find (Data, Info); if Found /= null then if not Is_Equal_Class (Found.Info, Info) or Is_Limited (Found.Info) /= Is_Limited (Info) then Found.Info := Info; Check_Dependent (Element, Found, Data, Info, Point); end if; elsif Is_Composite (Info) then Fill_Dependencies (Element, Data, Info); end if; end if; end Check_Type; ---------------------- -- Create_Type_Data -- ---------------------- procedure Create_Type_Data (Data : in Package_Data; Info : in Classes.Type_Info) is Result : constant Type_Data_Access := new Type_Data; begin Result.Info := Info; Type_Data_List.Append (Data.Types, Result); end Create_Type_Data; ----------------------- -- Fill_Dependencies -- ----------------------- procedure Fill_Dependencies (Element : in Asis.Declaration; Data : in Package_Data; Info : in Classes.Type_Info) is procedure Check_Component (Component_Type : Classes.Type_Info) is use Type_Info_Lists; Found : constant Type_Data_Access := Find (Data, Component_Type); begin -- If component type is subject to change: if Found /= null then -- If not in dependencies list yet: if not Contains (Found.Dependent, Info) then Append (Found.Dependent, Info); -- If new type not in subject_to_change list if Find (Data, Info) = null then -- Add it to the list Create_Type_Data (Data, Info); end if; end if; end if; end Check_Component; procedure Walk_Variant (Item : in Asis.Variant; Continue : out Boolean) is begin Continue := True; end Walk_Variant; procedure Walk_Companent (Item : in Asis.Declaration; Continue : out Boolean) is Component_Type : constant Classes.Type_Info := Classes.Type_Of_Declaration (Item, Element); begin Check_Component (Component_Type); Continue := True; end Walk_Companent; procedure Walk_Components is new Utils.Walk_Components (Element, Walk_Variant, Walk_Companent); Continue : Boolean; begin if Classes.Is_Array (Info) then Check_Component (Classes.Get_Array_Element_Type (Info)); -- elsif Derived? else Walk_Components (Element, Continue); end if; end Fill_Dependencies; ---------- -- Find -- ---------- function Find (Data : in Package_Data; Info : in Classes.Type_Info) return Type_Data_Access is use Type_Data_List; Next : aliased Type_Data_Access; begin while Iterate (Data.Types, Next'Access) loop if Classes.Is_Equal (Next.Info, Info) then return Next; end if; end loop; return null; end Find; --------------------- -- On_Package_Body -- --------------------- procedure On_Package_Body (Element : in Asis.Declaration; Point : in out Visibility.Point) is use Asis.Gela.Classes; function Specification (Element : Asis.Declaration) return Asis.Declaration is use Asis.Declarations; Item : Asis.Declaration := Element; begin if Is_Subunit(Item) then Item := Corresponding_Body_Stub (Item); end if; return Corresponding_Declaration (Item); end Specification; Spec : constant Asis.Declaration := Specification (Element); List : constant Asis.Declarative_Item_List := Asis.Declarations.Visible_Part_Declarative_Items (Spec); Priv : constant Asis.Declarative_Item_List := Asis.Declarations.Private_Part_Declarative_Items (Spec); From : Type_Info; To : Type_Info; Body_View : constant Asis.Element := Visibility.End_Of_Package (Element); Spec_View : Asis.Element; begin if Priv'Length = 0 then Spec_View := Visibility.End_Of_Package (Spec); else Spec_View := Priv (Priv'Last); end if; for J in List'Range loop From := Type_From_Declaration (List (J), Spec_View); To := Type_From_Declaration (List (J), Body_View); if not Is_Equal_Class (From, To) or Is_Limited (From) /= Is_Limited (To) then -- Ada.Wide_Text_IO.Put_Line ("Old:" & Debug_Image (From)); -- Ada.Wide_Text_IO.Put_Line ("New:" & Debug_Image (To)); Implicit.Make_Operations (Tipe => To, Was => From, Point => Point); end if; Check_Derived_Type (List (J), Body_View, Point); end loop; end On_Package_Body; --------------------- -- On_Private_Part -- --------------------- procedure On_Private_Part (Element : in Asis.Declaration; Point : in out Visibility.Point) is use Asis.Gela.Classes; List : constant Asis.Declarative_Item_List := Asis.Declarations.Visible_Part_Declarative_Items (Element); Priv : constant Asis.Declarative_Item_List := Asis.Declarations.Private_Part_Declarative_Items (Element); From : Type_Info; To : Type_Info; Spec_View : Asis.Element; begin if Priv'Length = 0 then Spec_View := Visibility.End_Of_Package (Element); else Spec_View := Priv (Priv'Last); end if; for J in List'Range loop From := Type_From_Declaration (List (J), List (List'Last)); To := Type_From_Declaration (List (J), Spec_View); if not Is_Equal_Class (From, To) or Is_Limited (From) /= Is_Limited (To) then Implicit.Make_Operations (Tipe => To, Was => From, Point => Point); end if; Check_Derived_Type (List (J), Spec_View, Point); end loop; end On_Private_Part; ---------- -- Push -- ---------- procedure Push (Stack : in out Package_Data_Stack; Item : in Package_Data) is begin Prepend (Stack, Item); end Push; procedure Pop (Stack : in out Package_Data_Stack) is Item : Package_Data; begin Delete_First (Stack, Item); end Pop; function Top (Stack : Package_Data_Stack) return Package_Data is begin return First (Stack); end Top; function Get_Next (Item : Package_Data) return Package_Data is begin return Item.Next; end Get_Next; function Get_Next (Item : Type_Data_Access) return Type_Data_Access is begin return Item.Next; end Get_Next; procedure Set_Next (Item, Next : Package_Data) is begin Item.Next := Next; end Set_Next; procedure Set_Next (Item, Next : Type_Data_Access) is begin Item.Next := Next; end Set_Next; end Asis.Gela.Private_Operations; ------------------------------------------------------------------------------ -- Copyright (c) 2008-2013, PI:NAME:<NAME>END_PI -- 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 PI:NAME:<NAME>END_PI, 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 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. ------------------------------------------------------------------------------
[ { "context": "les -- File and directories\n-- Copyright (C) 2014 Stephane.Carrez\n-- Written by Stephane.Carrez (Stephane.Carrez@g", "end": 148, "score": 0.9998822808265686, "start": 133, "tag": "NAME", "value": "Stephane.Carrez" }, { "context": " Copyright (C) 2014 Stephane.Carrez\n-- Written by Stephane.Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 179, "score": 0.9998859763145447, "start": 164, "tag": "NAME", "value": "Stephane.Carrez" }, { "context": "4 Stephane.Carrez\n-- Written by Stephane.Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 206, "score": 0.999925971031189, "start": 181, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
src/babel-files.ads
stcarrez/babel
1
----------------------------------------------------------------------- -- bkp-files -- File and directories -- Copyright (C) 2014 Stephane.Carrez -- Written by Stephane.Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar; with Ada.Strings.Unbounded; with Ada.Containers.Vectors; with Ada.Containers.Hashed_Maps; with Util.Strings; with Util.Systems.Types; with Util.Encoders.SHA1; with ADO; package Babel.Files is NO_IDENTIFIER : constant ADO.Identifier := ADO.NO_IDENTIFIER; subtype File_Identifier is ADO.Identifier; subtype Directory_Identifier is ADO.Identifier; subtype File_Size is Long_Long_Integer; subtype File_Mode is Util.Systems.Types.mode_t; -- type File_Mode is mod 2**16; type File_Type is private; type File_Type_Array is array (Positive range <>) of File_Type; type File_Type_Array_Access is access all File_Type_Array; type Directory_Type is private; type Directory_Type_Array is array (Positive range <>) of Directory_Type; type Directory_Type_Array_Access is access all Directory_Type_Array; NO_DIRECTORY : constant Directory_Type; NO_FILE : constant File_Type; type Status_Type is mod 2**16; -- The file was modified. FILE_MODIFIED : constant Status_Type := 16#0001#; -- There was some error while processing this file. FILE_ERROR : constant Status_Type := 16#8000#; -- The SHA1 signature for the file is known and valid. FILE_HAS_SHA1 : constant Status_Type := 16#0002#; -- Allocate a File_Type entry with the given name for the directory. function Allocate (Name : in String; Dir : in Directory_Type) return File_Type; -- Allocate a Directory_Type entry with the given name for the directory. function Allocate (Name : in String; Dir : in Directory_Type) return Directory_Type; type File (Len : Positive) is record Id : File_Identifier := NO_IDENTIFIER; Size : File_Size := 0; Dir : Directory_Type := NO_DIRECTORY; Mode : File_Mode := 8#644#; User : Uid_Type := 0; Group : Gid_Type := 0; Status : Status_Type := 0; Date : Ada.Calendar.Time; SHA1 : Util.Encoders.SHA1.Hash_Array; Name : aliased String (1 .. Len); end record; -- Compare two files on their name and directory. function "<" (Left, Right : in File_Type) return Boolean; -- Return true if the file was modified and need a backup. function Is_Modified (Element : in File_Type) return Boolean; -- Return true if the file is a new file. function Is_New (Element : in File_Type) return Boolean; -- Set the file as modified. procedure Set_Modified (Element : in File_Type); -- Set the SHA1 signature that was computed for this file. -- If the computed signature is different from the current signature, -- the FILE_MODIFIED flag is set on the file. The FILE_HAS_SHA1 flag -- is set on the file. procedure Set_Signature (Element : in File_Type; Signature : in Util.Encoders.SHA1.Hash_Array); -- Set the file size. If the new size is different, the FILE_MODIFIED -- flag is set on the file. procedure Set_Size (Element : in File_Type; Size : in File_Size); -- Set the owner and group of the file. procedure Set_Owner (Element : in File_Type; User : in Uid_Type; Group : in Gid_Type); -- Set the file modification date. procedure Set_Date (Element : in File_Type; Date : in Util.Systems.Types.Timespec); procedure Set_Date (Element : in File_Type; Date : in Ada.Calendar.Time); -- Return the path for the file. function Get_Path (Element : in File_Type) return String; -- Return the path for the directory. function Get_Path (Element : in Directory_Type) return String; -- Return the SHA1 signature computed for the file. function Get_SHA1 (Element : in File_Type) return String; -- Return the file size. function Get_Size (Element : in File_Type) return File_Size; -- Return the file modification date. function Get_Date (Element : in File_Type) return Ada.Calendar.Time; -- Return the user uid. function Get_User (Element : in File_Type) return Uid_Type; -- Return the group gid. function Get_Group (Element : in File_Type) return Gid_Type; -- Return the file unix mode. function Get_Mode (Element : in File_Type) return File_Mode; type File_Container is limited interface; -- Add the file with the given name in the container. procedure Add_File (Into : in out File_Container; Element : in File_Type) is abstract; -- Add the directory with the given name in the container. procedure Add_Directory (Into : in out File_Container; Element : in Directory_Type) is abstract; -- Create a new file instance with the given name in the container. function Create (Into : in File_Container; Name : in String) return File_Type is abstract; -- Create a new directory instance with the given name in the container. function Create (Into : in File_Container; Name : in String) return Directory_Type is abstract; -- Find the file with the given name in this file container. -- Returns NO_FILE if the file was not found. function Find (From : in File_Container; Name : in String) return File_Type is abstract; -- Find the directory with the given name in this file container. -- Returns NO_DIRECTORY if the directory was not found. function Find (From : in File_Container; Name : in String) return Directory_Type is abstract; -- Set the directory object associated with the container. procedure Set_Directory (Into : in out File_Container; Directory : in Directory_Type) is abstract; -- Execute the Process procedure on each directory found in the container. procedure Each_Directory (Container : in File_Container; Process : not null access procedure (Dir : in Directory_Type)) is abstract; -- Execute the Process procedure on each file found in the container. procedure Each_File (Container : in File_Container; Process : not null access procedure (F : in File_Type)) is abstract; type Default_Container is new File_Container with private; -- Add the file with the given name in the container. overriding procedure Add_File (Into : in out Default_Container; Element : in File_Type); -- Add the directory with the given name in the container. overriding procedure Add_Directory (Into : in out Default_Container; Element : in Directory_Type); -- Create a new file instance with the given name in the container. overriding function Create (Into : in Default_Container; Name : in String) return File_Type; -- Create a new directory instance with the given name in the container. overriding function Create (Into : in Default_Container; Name : in String) return Directory_Type; -- Find the file with the given name in this file container. -- Returns NO_FILE if the file was not found. overriding function Find (From : in Default_Container; Name : in String) return File_Type; -- Find the directory with the given name in this file container. -- Returns NO_DIRECTORY if the directory was not found. overriding function Find (From : in Default_Container; Name : in String) return Directory_Type; -- Set the directory object associated with the container. overriding procedure Set_Directory (Into : in out Default_Container; Directory : in Directory_Type); -- Execute the Process procedure on each directory found in the container. overriding procedure Each_Directory (Container : in Default_Container; Process : not null access procedure (Dir : in Directory_Type)); -- Execute the Process procedure on each file found in the container. overriding procedure Each_File (Container : in Default_Container; Process : not null access procedure (F : in File_Type)); private type Directory; type String_Access is access all String; type File_Type is access all File; type Directory_Type is access all Directory; package File_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Util.Strings.Name_Access, Element_Type => File_Type, Hash => Util.Strings.Hash, Equivalent_Keys => Util.Strings.Equivalent_Keys, "=" => "="); package Directory_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Util.Strings.Name_Access, Element_Type => Directory_Type, Hash => Util.Strings.Hash, Equivalent_Keys => Util.Strings.Equivalent_Keys, "=" => "="); type Directory is record Id : Directory_Identifier := NO_IDENTIFIER; Parent : Directory_Type; Mode : File_Mode := 8#755#; User : Uid_Type := 0; Group : Gid_Type := 0; Files : File_Maps.Map; Children : Directory_Maps.Map; -- Children : Directory_Type_Array_Access; Name_Pos : Natural := 0; Name : String_Access; end record; package File_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => File_Type, "=" => "="); package Directory_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Directory_Type, "=" => "="); subtype Directory_Vector is Directory_Vectors.Vector; type Default_Container is new Babel.Files.File_Container with record Current : Directory_Type; Files : File_Vectors.Vector; Dirs : Directory_Vectors.Vector; end record; NO_DIRECTORY : constant Directory_Type := null; NO_FILE : constant File_Type := null; end Babel.Files;
2900
----------------------------------------------------------------------- -- bkp-files -- File and directories -- Copyright (C) 2014 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar; with Ada.Strings.Unbounded; with Ada.Containers.Vectors; with Ada.Containers.Hashed_Maps; with Util.Strings; with Util.Systems.Types; with Util.Encoders.SHA1; with ADO; package Babel.Files is NO_IDENTIFIER : constant ADO.Identifier := ADO.NO_IDENTIFIER; subtype File_Identifier is ADO.Identifier; subtype Directory_Identifier is ADO.Identifier; subtype File_Size is Long_Long_Integer; subtype File_Mode is Util.Systems.Types.mode_t; -- type File_Mode is mod 2**16; type File_Type is private; type File_Type_Array is array (Positive range <>) of File_Type; type File_Type_Array_Access is access all File_Type_Array; type Directory_Type is private; type Directory_Type_Array is array (Positive range <>) of Directory_Type; type Directory_Type_Array_Access is access all Directory_Type_Array; NO_DIRECTORY : constant Directory_Type; NO_FILE : constant File_Type; type Status_Type is mod 2**16; -- The file was modified. FILE_MODIFIED : constant Status_Type := 16#0001#; -- There was some error while processing this file. FILE_ERROR : constant Status_Type := 16#8000#; -- The SHA1 signature for the file is known and valid. FILE_HAS_SHA1 : constant Status_Type := 16#0002#; -- Allocate a File_Type entry with the given name for the directory. function Allocate (Name : in String; Dir : in Directory_Type) return File_Type; -- Allocate a Directory_Type entry with the given name for the directory. function Allocate (Name : in String; Dir : in Directory_Type) return Directory_Type; type File (Len : Positive) is record Id : File_Identifier := NO_IDENTIFIER; Size : File_Size := 0; Dir : Directory_Type := NO_DIRECTORY; Mode : File_Mode := 8#644#; User : Uid_Type := 0; Group : Gid_Type := 0; Status : Status_Type := 0; Date : Ada.Calendar.Time; SHA1 : Util.Encoders.SHA1.Hash_Array; Name : aliased String (1 .. Len); end record; -- Compare two files on their name and directory. function "<" (Left, Right : in File_Type) return Boolean; -- Return true if the file was modified and need a backup. function Is_Modified (Element : in File_Type) return Boolean; -- Return true if the file is a new file. function Is_New (Element : in File_Type) return Boolean; -- Set the file as modified. procedure Set_Modified (Element : in File_Type); -- Set the SHA1 signature that was computed for this file. -- If the computed signature is different from the current signature, -- the FILE_MODIFIED flag is set on the file. The FILE_HAS_SHA1 flag -- is set on the file. procedure Set_Signature (Element : in File_Type; Signature : in Util.Encoders.SHA1.Hash_Array); -- Set the file size. If the new size is different, the FILE_MODIFIED -- flag is set on the file. procedure Set_Size (Element : in File_Type; Size : in File_Size); -- Set the owner and group of the file. procedure Set_Owner (Element : in File_Type; User : in Uid_Type; Group : in Gid_Type); -- Set the file modification date. procedure Set_Date (Element : in File_Type; Date : in Util.Systems.Types.Timespec); procedure Set_Date (Element : in File_Type; Date : in Ada.Calendar.Time); -- Return the path for the file. function Get_Path (Element : in File_Type) return String; -- Return the path for the directory. function Get_Path (Element : in Directory_Type) return String; -- Return the SHA1 signature computed for the file. function Get_SHA1 (Element : in File_Type) return String; -- Return the file size. function Get_Size (Element : in File_Type) return File_Size; -- Return the file modification date. function Get_Date (Element : in File_Type) return Ada.Calendar.Time; -- Return the user uid. function Get_User (Element : in File_Type) return Uid_Type; -- Return the group gid. function Get_Group (Element : in File_Type) return Gid_Type; -- Return the file unix mode. function Get_Mode (Element : in File_Type) return File_Mode; type File_Container is limited interface; -- Add the file with the given name in the container. procedure Add_File (Into : in out File_Container; Element : in File_Type) is abstract; -- Add the directory with the given name in the container. procedure Add_Directory (Into : in out File_Container; Element : in Directory_Type) is abstract; -- Create a new file instance with the given name in the container. function Create (Into : in File_Container; Name : in String) return File_Type is abstract; -- Create a new directory instance with the given name in the container. function Create (Into : in File_Container; Name : in String) return Directory_Type is abstract; -- Find the file with the given name in this file container. -- Returns NO_FILE if the file was not found. function Find (From : in File_Container; Name : in String) return File_Type is abstract; -- Find the directory with the given name in this file container. -- Returns NO_DIRECTORY if the directory was not found. function Find (From : in File_Container; Name : in String) return Directory_Type is abstract; -- Set the directory object associated with the container. procedure Set_Directory (Into : in out File_Container; Directory : in Directory_Type) is abstract; -- Execute the Process procedure on each directory found in the container. procedure Each_Directory (Container : in File_Container; Process : not null access procedure (Dir : in Directory_Type)) is abstract; -- Execute the Process procedure on each file found in the container. procedure Each_File (Container : in File_Container; Process : not null access procedure (F : in File_Type)) is abstract; type Default_Container is new File_Container with private; -- Add the file with the given name in the container. overriding procedure Add_File (Into : in out Default_Container; Element : in File_Type); -- Add the directory with the given name in the container. overriding procedure Add_Directory (Into : in out Default_Container; Element : in Directory_Type); -- Create a new file instance with the given name in the container. overriding function Create (Into : in Default_Container; Name : in String) return File_Type; -- Create a new directory instance with the given name in the container. overriding function Create (Into : in Default_Container; Name : in String) return Directory_Type; -- Find the file with the given name in this file container. -- Returns NO_FILE if the file was not found. overriding function Find (From : in Default_Container; Name : in String) return File_Type; -- Find the directory with the given name in this file container. -- Returns NO_DIRECTORY if the directory was not found. overriding function Find (From : in Default_Container; Name : in String) return Directory_Type; -- Set the directory object associated with the container. overriding procedure Set_Directory (Into : in out Default_Container; Directory : in Directory_Type); -- Execute the Process procedure on each directory found in the container. overriding procedure Each_Directory (Container : in Default_Container; Process : not null access procedure (Dir : in Directory_Type)); -- Execute the Process procedure on each file found in the container. overriding procedure Each_File (Container : in Default_Container; Process : not null access procedure (F : in File_Type)); private type Directory; type String_Access is access all String; type File_Type is access all File; type Directory_Type is access all Directory; package File_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Util.Strings.Name_Access, Element_Type => File_Type, Hash => Util.Strings.Hash, Equivalent_Keys => Util.Strings.Equivalent_Keys, "=" => "="); package Directory_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Util.Strings.Name_Access, Element_Type => Directory_Type, Hash => Util.Strings.Hash, Equivalent_Keys => Util.Strings.Equivalent_Keys, "=" => "="); type Directory is record Id : Directory_Identifier := NO_IDENTIFIER; Parent : Directory_Type; Mode : File_Mode := 8#755#; User : Uid_Type := 0; Group : Gid_Type := 0; Files : File_Maps.Map; Children : Directory_Maps.Map; -- Children : Directory_Type_Array_Access; Name_Pos : Natural := 0; Name : String_Access; end record; package File_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => File_Type, "=" => "="); package Directory_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Directory_Type, "=" => "="); subtype Directory_Vector is Directory_Vectors.Vector; type Default_Container is new Babel.Files.File_Container with record Current : Directory_Type; Files : File_Vectors.Vector; Dirs : Directory_Vectors.Vector; end record; NO_DIRECTORY : constant Directory_Type := null; NO_FILE : constant File_Type := null; end Babel.Files;
true
----------------------------------------------------------------------- -- bkp-files -- File and directories -- Copyright (C) 2014 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar; with Ada.Strings.Unbounded; with Ada.Containers.Vectors; with Ada.Containers.Hashed_Maps; with Util.Strings; with Util.Systems.Types; with Util.Encoders.SHA1; with ADO; package Babel.Files is NO_IDENTIFIER : constant ADO.Identifier := ADO.NO_IDENTIFIER; subtype File_Identifier is ADO.Identifier; subtype Directory_Identifier is ADO.Identifier; subtype File_Size is Long_Long_Integer; subtype File_Mode is Util.Systems.Types.mode_t; -- type File_Mode is mod 2**16; type File_Type is private; type File_Type_Array is array (Positive range <>) of File_Type; type File_Type_Array_Access is access all File_Type_Array; type Directory_Type is private; type Directory_Type_Array is array (Positive range <>) of Directory_Type; type Directory_Type_Array_Access is access all Directory_Type_Array; NO_DIRECTORY : constant Directory_Type; NO_FILE : constant File_Type; type Status_Type is mod 2**16; -- The file was modified. FILE_MODIFIED : constant Status_Type := 16#0001#; -- There was some error while processing this file. FILE_ERROR : constant Status_Type := 16#8000#; -- The SHA1 signature for the file is known and valid. FILE_HAS_SHA1 : constant Status_Type := 16#0002#; -- Allocate a File_Type entry with the given name for the directory. function Allocate (Name : in String; Dir : in Directory_Type) return File_Type; -- Allocate a Directory_Type entry with the given name for the directory. function Allocate (Name : in String; Dir : in Directory_Type) return Directory_Type; type File (Len : Positive) is record Id : File_Identifier := NO_IDENTIFIER; Size : File_Size := 0; Dir : Directory_Type := NO_DIRECTORY; Mode : File_Mode := 8#644#; User : Uid_Type := 0; Group : Gid_Type := 0; Status : Status_Type := 0; Date : Ada.Calendar.Time; SHA1 : Util.Encoders.SHA1.Hash_Array; Name : aliased String (1 .. Len); end record; -- Compare two files on their name and directory. function "<" (Left, Right : in File_Type) return Boolean; -- Return true if the file was modified and need a backup. function Is_Modified (Element : in File_Type) return Boolean; -- Return true if the file is a new file. function Is_New (Element : in File_Type) return Boolean; -- Set the file as modified. procedure Set_Modified (Element : in File_Type); -- Set the SHA1 signature that was computed for this file. -- If the computed signature is different from the current signature, -- the FILE_MODIFIED flag is set on the file. The FILE_HAS_SHA1 flag -- is set on the file. procedure Set_Signature (Element : in File_Type; Signature : in Util.Encoders.SHA1.Hash_Array); -- Set the file size. If the new size is different, the FILE_MODIFIED -- flag is set on the file. procedure Set_Size (Element : in File_Type; Size : in File_Size); -- Set the owner and group of the file. procedure Set_Owner (Element : in File_Type; User : in Uid_Type; Group : in Gid_Type); -- Set the file modification date. procedure Set_Date (Element : in File_Type; Date : in Util.Systems.Types.Timespec); procedure Set_Date (Element : in File_Type; Date : in Ada.Calendar.Time); -- Return the path for the file. function Get_Path (Element : in File_Type) return String; -- Return the path for the directory. function Get_Path (Element : in Directory_Type) return String; -- Return the SHA1 signature computed for the file. function Get_SHA1 (Element : in File_Type) return String; -- Return the file size. function Get_Size (Element : in File_Type) return File_Size; -- Return the file modification date. function Get_Date (Element : in File_Type) return Ada.Calendar.Time; -- Return the user uid. function Get_User (Element : in File_Type) return Uid_Type; -- Return the group gid. function Get_Group (Element : in File_Type) return Gid_Type; -- Return the file unix mode. function Get_Mode (Element : in File_Type) return File_Mode; type File_Container is limited interface; -- Add the file with the given name in the container. procedure Add_File (Into : in out File_Container; Element : in File_Type) is abstract; -- Add the directory with the given name in the container. procedure Add_Directory (Into : in out File_Container; Element : in Directory_Type) is abstract; -- Create a new file instance with the given name in the container. function Create (Into : in File_Container; Name : in String) return File_Type is abstract; -- Create a new directory instance with the given name in the container. function Create (Into : in File_Container; Name : in String) return Directory_Type is abstract; -- Find the file with the given name in this file container. -- Returns NO_FILE if the file was not found. function Find (From : in File_Container; Name : in String) return File_Type is abstract; -- Find the directory with the given name in this file container. -- Returns NO_DIRECTORY if the directory was not found. function Find (From : in File_Container; Name : in String) return Directory_Type is abstract; -- Set the directory object associated with the container. procedure Set_Directory (Into : in out File_Container; Directory : in Directory_Type) is abstract; -- Execute the Process procedure on each directory found in the container. procedure Each_Directory (Container : in File_Container; Process : not null access procedure (Dir : in Directory_Type)) is abstract; -- Execute the Process procedure on each file found in the container. procedure Each_File (Container : in File_Container; Process : not null access procedure (F : in File_Type)) is abstract; type Default_Container is new File_Container with private; -- Add the file with the given name in the container. overriding procedure Add_File (Into : in out Default_Container; Element : in File_Type); -- Add the directory with the given name in the container. overriding procedure Add_Directory (Into : in out Default_Container; Element : in Directory_Type); -- Create a new file instance with the given name in the container. overriding function Create (Into : in Default_Container; Name : in String) return File_Type; -- Create a new directory instance with the given name in the container. overriding function Create (Into : in Default_Container; Name : in String) return Directory_Type; -- Find the file with the given name in this file container. -- Returns NO_FILE if the file was not found. overriding function Find (From : in Default_Container; Name : in String) return File_Type; -- Find the directory with the given name in this file container. -- Returns NO_DIRECTORY if the directory was not found. overriding function Find (From : in Default_Container; Name : in String) return Directory_Type; -- Set the directory object associated with the container. overriding procedure Set_Directory (Into : in out Default_Container; Directory : in Directory_Type); -- Execute the Process procedure on each directory found in the container. overriding procedure Each_Directory (Container : in Default_Container; Process : not null access procedure (Dir : in Directory_Type)); -- Execute the Process procedure on each file found in the container. overriding procedure Each_File (Container : in Default_Container; Process : not null access procedure (F : in File_Type)); private type Directory; type String_Access is access all String; type File_Type is access all File; type Directory_Type is access all Directory; package File_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Util.Strings.Name_Access, Element_Type => File_Type, Hash => Util.Strings.Hash, Equivalent_Keys => Util.Strings.Equivalent_Keys, "=" => "="); package Directory_Maps is new Ada.Containers.Hashed_Maps (Key_Type => Util.Strings.Name_Access, Element_Type => Directory_Type, Hash => Util.Strings.Hash, Equivalent_Keys => Util.Strings.Equivalent_Keys, "=" => "="); type Directory is record Id : Directory_Identifier := NO_IDENTIFIER; Parent : Directory_Type; Mode : File_Mode := 8#755#; User : Uid_Type := 0; Group : Gid_Type := 0; Files : File_Maps.Map; Children : Directory_Maps.Map; -- Children : Directory_Type_Array_Access; Name_Pos : Natural := 0; Name : String_Access; end record; package File_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => File_Type, "=" => "="); package Directory_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Directory_Type, "=" => "="); subtype Directory_Vector is Directory_Vectors.Vector; type Default_Container is new Babel.Files.File_Container with record Current : Directory_Type; Files : File_Vectors.Vector; Dirs : Directory_Vectors.Vector; end record; NO_DIRECTORY : constant Directory_Type := null; NO_FILE : constant File_Type := null; end Babel.Files;
[ { "context": "elock);\n -- GStreamer\n -- * Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>\n -- *\n -- * This library is", "end": 2516, "score": 0.9998792409896851, "start": 2501, "tag": "NAME", "value": "Philippe Khalaf" }, { "context": "amer\n -- * Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>\n -- *\n -- * This library is free software; you", "end": 2535, "score": 0.9999299645423889, "start": 2518, "tag": "EMAIL", "value": "burger@speedy.org" } ]
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_rtp_gstbasertpdepayload_h.ads
persan/A-gst
1
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.gstreamer_0_10_gst_gstelement_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h; -- with GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h; -- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h; -- limited with GStreamer.GST_Low_Level.glib_2_0_glib_gqueue_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h; with System; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h; with glib; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtp_gstbasertpdepayload_h is -- unsupported macro: GST_TYPE_BASE_RTP_DEPAYLOAD (gst_base_rtp_depayload_get_type()) -- arg-macro: function GST_BASE_RTP_DEPAYLOAD (obj) -- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayload); -- arg-macro: function GST_BASE_RTP_DEPAYLOAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass); -- arg-macro: function GST_BASE_RTP_DEPAYLOAD_GET_CLASS (obj) -- return G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass); -- arg-macro: function GST_IS_BASE_RTP_DEPAYLOAD (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_RTP_DEPAYLOAD); -- arg-macro: function GST_IS_BASE_RTP_DEPAYLOAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_RTP_DEPAYLOAD); -- arg-macro: function GST_BASE_RTP_DEPAYLOAD_SINKPAD (depayload) -- return GST_BASE_RTP_DEPAYLOAD (depayload).sinkpad; -- arg-macro: function GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload) -- return GST_BASE_RTP_DEPAYLOAD (depayload).srcpad; -- arg-macro: function QUEUE_LOCK_INIT (base) -- return g_static_rec_mutex_init(andbase.queuelock); -- arg-macro: function QUEUE_LOCK_FREE (base) -- return g_static_rec_mutex_free(andbase.queuelock); -- arg-macro: function QUEUE_LOCK (base) -- return g_static_rec_mutex_lock(andbase.queuelock); -- arg-macro: function QUEUE_UNLOCK (base) -- return g_static_rec_mutex_unlock(andbase.queuelock); -- GStreamer -- * Copyright (C) <2005> Philippe Khalaf <burger@speedy.org> -- * -- * 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. -- -- this was presumably never meant to be public API, or should at least -- * have been prefixed if it was. Don't use. (FIXME: remove in 0.11) type GstBaseRTPDepayload; type u_GstBaseRTPDepayload_u_gst_reserved_array is array (0 .. 2) of System.Address; --subtype GstBaseRTPDepayload is u_GstBaseRTPDepayload; -- gst/rtp/gstbasertpdepayload.h:52 type GstBaseRTPDepayloadClass; type u_GstBaseRTPDepayloadClass_u_gst_reserved_array is array (0 .. 1) of System.Address; --subtype GstBaseRTPDepayloadClass is u_GstBaseRTPDepayloadClass; -- gst/rtp/gstbasertpdepayload.h:53 -- skipped empty struct u_GstBaseRTPDepayloadPrivate -- skipped empty struct GstBaseRTPDepayloadPrivate type GstBaseRTPDepayload is record parent : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/rtp/gstbasertpdepayload.h:58 sinkpad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/rtp/gstbasertpdepayload.h:60 srcpad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/rtp/gstbasertpdepayload.h:60 queuelock : aliased GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h.GStaticRecMutex; -- gst/rtp/gstbasertpdepayload.h:64 thread_running : aliased GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:67 thread : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThread; -- gst/rtp/gstbasertpdepayload.h:69 clock_rate : aliased GLIB.guint; -- gst/rtp/gstbasertpdepayload.h:73 queue_delay : aliased GLIB.guint; -- gst/rtp/gstbasertpdepayload.h:77 queue : access GStreamer.GST_Low_Level.glib_2_0_glib_gqueue_h.GQueue; -- gst/rtp/gstbasertpdepayload.h:84 segment : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h.GstSegment; -- gst/rtp/gstbasertpdepayload.h:86 need_newsegment : aliased GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:87 priv : System.Address; -- gst/rtp/gstbasertpdepayload.h:90 u_gst_reserved : u_GstBaseRTPDepayload_u_gst_reserved_array; -- gst/rtp/gstbasertpdepayload.h:92 end record; pragma Convention (C_Pass_By_Copy, GstBaseRTPDepayload); -- gst/rtp/gstbasertpdepayload.h:56 -- lock to protect the queue, deprecated -- deprecated -- the releaser thread, deprecated -- this attribute must be set by the child -- this value can be modified by the child if needed, deprecated -- we will queue up to RTP_QUEUEDELAY ms of packets, -- * reordering them if necessary -- * dropping any packets that are more than -- * RTP_QUEUEDELAY ms late, deprecated --< private > --* -- * GstBaseRTPDepayloadClass: -- * @parent_class: the parent class -- * @set_caps: configure the depayloader -- * @add_to_queue: (deprecated) -- * @process: process incoming rtp packets -- * @set_gst_timestamp: convert from RTP timestamp to GST timestamp -- * @packet_lost: signal the depayloader about packet loss -- * @handle_event: custom event handling -- * -- * Base class for audio RTP payloader. -- type GstBaseRTPDepayloadClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElementClass; -- gst/rtp/gstbasertpdepayload.h:109 set_caps : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:112 add_to_queue : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/rtp/gstbasertpdepayload.h:116 process : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/rtp/gstbasertpdepayload.h:123 set_gst_timestamp : access procedure (arg1 : access GstBaseRTPDepayload; arg2 : GLIB.guint32; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer); -- gst/rtp/gstbasertpdepayload.h:127 packet_lost : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:132 handle_event : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:137 u_gst_reserved : u_GstBaseRTPDepayloadClass_u_gst_reserved_array; -- gst/rtp/gstbasertpdepayload.h:140 end record; pragma Convention (C_Pass_By_Copy, GstBaseRTPDepayloadClass); -- gst/rtp/gstbasertpdepayload.h:107 -- virtuals, inform the subclass of the caps. -- non-pure function, default implementation in base class -- * this does buffering, reordering and dropping, deprecated -- pure virtual function, child must use this to process incoming -- * rtp packets. If the child returns a buffer without a valid timestamp, -- * the timestamp of @in will be applied to the result buffer and the -- * buffer will be pushed. If this function returns %NULL, nothing is -- * pushed. -- non-pure function used to convert from RTP timestamp to GST timestamp -- * this function is used by the child class before gst_pad_pushing -- non-pure function used to to signal the depayloader about packet loss. the -- * timestamp and duration are the estimated values of the lost packet. -- * The default implementation of this message pushes a segment update. -- the default implementation does the default actions for events but -- * implementation can override. -- * Since: 0.10.32 --< private > function gst_base_rtp_depayload_get_type return GLIB.GType; -- gst/rtp/gstbasertpdepayload.h:143 pragma Import (C, gst_base_rtp_depayload_get_type, "gst_base_rtp_depayload_get_type"); function gst_base_rtp_depayload_push (filter : access GstBaseRTPDepayload; out_buf : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/rtp/gstbasertpdepayload.h:145 pragma Import (C, gst_base_rtp_depayload_push, "gst_base_rtp_depayload_push"); function gst_base_rtp_depayload_push_ts (filter : access GstBaseRTPDepayload; timestamp : GLIB.guint32; out_buf : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/rtp/gstbasertpdepayload.h:146 pragma Import (C, gst_base_rtp_depayload_push_ts, "gst_base_rtp_depayload_push_ts"); function gst_base_rtp_depayload_push_list (filter : access GstBaseRTPDepayload; out_list : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/rtp/gstbasertpdepayload.h:148 pragma Import (C, gst_base_rtp_depayload_push_list, "gst_base_rtp_depayload_push_list"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtp_gstbasertpdepayload_h;
25589
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.gstreamer_0_10_gst_gstelement_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h; -- with GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h; -- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h; -- limited with GStreamer.GST_Low_Level.glib_2_0_glib_gqueue_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h; with System; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h; with glib; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtp_gstbasertpdepayload_h is -- unsupported macro: GST_TYPE_BASE_RTP_DEPAYLOAD (gst_base_rtp_depayload_get_type()) -- arg-macro: function GST_BASE_RTP_DEPAYLOAD (obj) -- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayload); -- arg-macro: function GST_BASE_RTP_DEPAYLOAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass); -- arg-macro: function GST_BASE_RTP_DEPAYLOAD_GET_CLASS (obj) -- return G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass); -- arg-macro: function GST_IS_BASE_RTP_DEPAYLOAD (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_RTP_DEPAYLOAD); -- arg-macro: function GST_IS_BASE_RTP_DEPAYLOAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_RTP_DEPAYLOAD); -- arg-macro: function GST_BASE_RTP_DEPAYLOAD_SINKPAD (depayload) -- return GST_BASE_RTP_DEPAYLOAD (depayload).sinkpad; -- arg-macro: function GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload) -- return GST_BASE_RTP_DEPAYLOAD (depayload).srcpad; -- arg-macro: function QUEUE_LOCK_INIT (base) -- return g_static_rec_mutex_init(andbase.queuelock); -- arg-macro: function QUEUE_LOCK_FREE (base) -- return g_static_rec_mutex_free(andbase.queuelock); -- arg-macro: function QUEUE_LOCK (base) -- return g_static_rec_mutex_lock(andbase.queuelock); -- arg-macro: function QUEUE_UNLOCK (base) -- return g_static_rec_mutex_unlock(andbase.queuelock); -- GStreamer -- * Copyright (C) <2005> <NAME> <<EMAIL>> -- * -- * 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. -- -- this was presumably never meant to be public API, or should at least -- * have been prefixed if it was. Don't use. (FIXME: remove in 0.11) type GstBaseRTPDepayload; type u_GstBaseRTPDepayload_u_gst_reserved_array is array (0 .. 2) of System.Address; --subtype GstBaseRTPDepayload is u_GstBaseRTPDepayload; -- gst/rtp/gstbasertpdepayload.h:52 type GstBaseRTPDepayloadClass; type u_GstBaseRTPDepayloadClass_u_gst_reserved_array is array (0 .. 1) of System.Address; --subtype GstBaseRTPDepayloadClass is u_GstBaseRTPDepayloadClass; -- gst/rtp/gstbasertpdepayload.h:53 -- skipped empty struct u_GstBaseRTPDepayloadPrivate -- skipped empty struct GstBaseRTPDepayloadPrivate type GstBaseRTPDepayload is record parent : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/rtp/gstbasertpdepayload.h:58 sinkpad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/rtp/gstbasertpdepayload.h:60 srcpad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/rtp/gstbasertpdepayload.h:60 queuelock : aliased GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h.GStaticRecMutex; -- gst/rtp/gstbasertpdepayload.h:64 thread_running : aliased GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:67 thread : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThread; -- gst/rtp/gstbasertpdepayload.h:69 clock_rate : aliased GLIB.guint; -- gst/rtp/gstbasertpdepayload.h:73 queue_delay : aliased GLIB.guint; -- gst/rtp/gstbasertpdepayload.h:77 queue : access GStreamer.GST_Low_Level.glib_2_0_glib_gqueue_h.GQueue; -- gst/rtp/gstbasertpdepayload.h:84 segment : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h.GstSegment; -- gst/rtp/gstbasertpdepayload.h:86 need_newsegment : aliased GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:87 priv : System.Address; -- gst/rtp/gstbasertpdepayload.h:90 u_gst_reserved : u_GstBaseRTPDepayload_u_gst_reserved_array; -- gst/rtp/gstbasertpdepayload.h:92 end record; pragma Convention (C_Pass_By_Copy, GstBaseRTPDepayload); -- gst/rtp/gstbasertpdepayload.h:56 -- lock to protect the queue, deprecated -- deprecated -- the releaser thread, deprecated -- this attribute must be set by the child -- this value can be modified by the child if needed, deprecated -- we will queue up to RTP_QUEUEDELAY ms of packets, -- * reordering them if necessary -- * dropping any packets that are more than -- * RTP_QUEUEDELAY ms late, deprecated --< private > --* -- * GstBaseRTPDepayloadClass: -- * @parent_class: the parent class -- * @set_caps: configure the depayloader -- * @add_to_queue: (deprecated) -- * @process: process incoming rtp packets -- * @set_gst_timestamp: convert from RTP timestamp to GST timestamp -- * @packet_lost: signal the depayloader about packet loss -- * @handle_event: custom event handling -- * -- * Base class for audio RTP payloader. -- type GstBaseRTPDepayloadClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElementClass; -- gst/rtp/gstbasertpdepayload.h:109 set_caps : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:112 add_to_queue : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/rtp/gstbasertpdepayload.h:116 process : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/rtp/gstbasertpdepayload.h:123 set_gst_timestamp : access procedure (arg1 : access GstBaseRTPDepayload; arg2 : GLIB.guint32; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer); -- gst/rtp/gstbasertpdepayload.h:127 packet_lost : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:132 handle_event : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:137 u_gst_reserved : u_GstBaseRTPDepayloadClass_u_gst_reserved_array; -- gst/rtp/gstbasertpdepayload.h:140 end record; pragma Convention (C_Pass_By_Copy, GstBaseRTPDepayloadClass); -- gst/rtp/gstbasertpdepayload.h:107 -- virtuals, inform the subclass of the caps. -- non-pure function, default implementation in base class -- * this does buffering, reordering and dropping, deprecated -- pure virtual function, child must use this to process incoming -- * rtp packets. If the child returns a buffer without a valid timestamp, -- * the timestamp of @in will be applied to the result buffer and the -- * buffer will be pushed. If this function returns %NULL, nothing is -- * pushed. -- non-pure function used to convert from RTP timestamp to GST timestamp -- * this function is used by the child class before gst_pad_pushing -- non-pure function used to to signal the depayloader about packet loss. the -- * timestamp and duration are the estimated values of the lost packet. -- * The default implementation of this message pushes a segment update. -- the default implementation does the default actions for events but -- * implementation can override. -- * Since: 0.10.32 --< private > function gst_base_rtp_depayload_get_type return GLIB.GType; -- gst/rtp/gstbasertpdepayload.h:143 pragma Import (C, gst_base_rtp_depayload_get_type, "gst_base_rtp_depayload_get_type"); function gst_base_rtp_depayload_push (filter : access GstBaseRTPDepayload; out_buf : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/rtp/gstbasertpdepayload.h:145 pragma Import (C, gst_base_rtp_depayload_push, "gst_base_rtp_depayload_push"); function gst_base_rtp_depayload_push_ts (filter : access GstBaseRTPDepayload; timestamp : GLIB.guint32; out_buf : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/rtp/gstbasertpdepayload.h:146 pragma Import (C, gst_base_rtp_depayload_push_ts, "gst_base_rtp_depayload_push_ts"); function gst_base_rtp_depayload_push_list (filter : access GstBaseRTPDepayload; out_list : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/rtp/gstbasertpdepayload.h:148 pragma Import (C, gst_base_rtp_depayload_push_list, "gst_base_rtp_depayload_push_list"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtp_gstbasertpdepayload_h;
true
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.gstreamer_0_10_gst_gstelement_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h; -- with GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h; -- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h; -- limited with GStreamer.GST_Low_Level.glib_2_0_glib_gqueue_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h; with System; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h; with glib; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtp_gstbasertpdepayload_h is -- unsupported macro: GST_TYPE_BASE_RTP_DEPAYLOAD (gst_base_rtp_depayload_get_type()) -- arg-macro: function GST_BASE_RTP_DEPAYLOAD (obj) -- return G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayload); -- arg-macro: function GST_BASE_RTP_DEPAYLOAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass); -- arg-macro: function GST_BASE_RTP_DEPAYLOAD_GET_CLASS (obj) -- return G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_BASE_RTP_DEPAYLOAD,GstBaseRTPDepayloadClass); -- arg-macro: function GST_IS_BASE_RTP_DEPAYLOAD (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_RTP_DEPAYLOAD); -- arg-macro: function GST_IS_BASE_RTP_DEPAYLOAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_RTP_DEPAYLOAD); -- arg-macro: function GST_BASE_RTP_DEPAYLOAD_SINKPAD (depayload) -- return GST_BASE_RTP_DEPAYLOAD (depayload).sinkpad; -- arg-macro: function GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload) -- return GST_BASE_RTP_DEPAYLOAD (depayload).srcpad; -- arg-macro: function QUEUE_LOCK_INIT (base) -- return g_static_rec_mutex_init(andbase.queuelock); -- arg-macro: function QUEUE_LOCK_FREE (base) -- return g_static_rec_mutex_free(andbase.queuelock); -- arg-macro: function QUEUE_LOCK (base) -- return g_static_rec_mutex_lock(andbase.queuelock); -- arg-macro: function QUEUE_UNLOCK (base) -- return g_static_rec_mutex_unlock(andbase.queuelock); -- GStreamer -- * Copyright (C) <2005> PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- * -- * 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. -- -- this was presumably never meant to be public API, or should at least -- * have been prefixed if it was. Don't use. (FIXME: remove in 0.11) type GstBaseRTPDepayload; type u_GstBaseRTPDepayload_u_gst_reserved_array is array (0 .. 2) of System.Address; --subtype GstBaseRTPDepayload is u_GstBaseRTPDepayload; -- gst/rtp/gstbasertpdepayload.h:52 type GstBaseRTPDepayloadClass; type u_GstBaseRTPDepayloadClass_u_gst_reserved_array is array (0 .. 1) of System.Address; --subtype GstBaseRTPDepayloadClass is u_GstBaseRTPDepayloadClass; -- gst/rtp/gstbasertpdepayload.h:53 -- skipped empty struct u_GstBaseRTPDepayloadPrivate -- skipped empty struct GstBaseRTPDepayloadPrivate type GstBaseRTPDepayload is record parent : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/rtp/gstbasertpdepayload.h:58 sinkpad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/rtp/gstbasertpdepayload.h:60 srcpad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/rtp/gstbasertpdepayload.h:60 queuelock : aliased GStreamer.GST_Low_Level.glib_2_0_glib_deprecated_gthread_h.GStaticRecMutex; -- gst/rtp/gstbasertpdepayload.h:64 thread_running : aliased GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:67 thread : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GThread; -- gst/rtp/gstbasertpdepayload.h:69 clock_rate : aliased GLIB.guint; -- gst/rtp/gstbasertpdepayload.h:73 queue_delay : aliased GLIB.guint; -- gst/rtp/gstbasertpdepayload.h:77 queue : access GStreamer.GST_Low_Level.glib_2_0_glib_gqueue_h.GQueue; -- gst/rtp/gstbasertpdepayload.h:84 segment : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstsegment_h.GstSegment; -- gst/rtp/gstbasertpdepayload.h:86 need_newsegment : aliased GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:87 priv : System.Address; -- gst/rtp/gstbasertpdepayload.h:90 u_gst_reserved : u_GstBaseRTPDepayload_u_gst_reserved_array; -- gst/rtp/gstbasertpdepayload.h:92 end record; pragma Convention (C_Pass_By_Copy, GstBaseRTPDepayload); -- gst/rtp/gstbasertpdepayload.h:56 -- lock to protect the queue, deprecated -- deprecated -- the releaser thread, deprecated -- this attribute must be set by the child -- this value can be modified by the child if needed, deprecated -- we will queue up to RTP_QUEUEDELAY ms of packets, -- * reordering them if necessary -- * dropping any packets that are more than -- * RTP_QUEUEDELAY ms late, deprecated --< private > --* -- * GstBaseRTPDepayloadClass: -- * @parent_class: the parent class -- * @set_caps: configure the depayloader -- * @add_to_queue: (deprecated) -- * @process: process incoming rtp packets -- * @set_gst_timestamp: convert from RTP timestamp to GST timestamp -- * @packet_lost: signal the depayloader about packet loss -- * @handle_event: custom event handling -- * -- * Base class for audio RTP payloader. -- type GstBaseRTPDepayloadClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElementClass; -- gst/rtp/gstbasertpdepayload.h:109 set_caps : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:112 add_to_queue : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/rtp/gstbasertpdepayload.h:116 process : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/rtp/gstbasertpdepayload.h:123 set_gst_timestamp : access procedure (arg1 : access GstBaseRTPDepayload; arg2 : GLIB.guint32; arg3 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer); -- gst/rtp/gstbasertpdepayload.h:127 packet_lost : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:132 handle_event : access function (arg1 : access GstBaseRTPDepayload; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/rtp/gstbasertpdepayload.h:137 u_gst_reserved : u_GstBaseRTPDepayloadClass_u_gst_reserved_array; -- gst/rtp/gstbasertpdepayload.h:140 end record; pragma Convention (C_Pass_By_Copy, GstBaseRTPDepayloadClass); -- gst/rtp/gstbasertpdepayload.h:107 -- virtuals, inform the subclass of the caps. -- non-pure function, default implementation in base class -- * this does buffering, reordering and dropping, deprecated -- pure virtual function, child must use this to process incoming -- * rtp packets. If the child returns a buffer without a valid timestamp, -- * the timestamp of @in will be applied to the result buffer and the -- * buffer will be pushed. If this function returns %NULL, nothing is -- * pushed. -- non-pure function used to convert from RTP timestamp to GST timestamp -- * this function is used by the child class before gst_pad_pushing -- non-pure function used to to signal the depayloader about packet loss. the -- * timestamp and duration are the estimated values of the lost packet. -- * The default implementation of this message pushes a segment update. -- the default implementation does the default actions for events but -- * implementation can override. -- * Since: 0.10.32 --< private > function gst_base_rtp_depayload_get_type return GLIB.GType; -- gst/rtp/gstbasertpdepayload.h:143 pragma Import (C, gst_base_rtp_depayload_get_type, "gst_base_rtp_depayload_get_type"); function gst_base_rtp_depayload_push (filter : access GstBaseRTPDepayload; out_buf : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/rtp/gstbasertpdepayload.h:145 pragma Import (C, gst_base_rtp_depayload_push, "gst_base_rtp_depayload_push"); function gst_base_rtp_depayload_push_ts (filter : access GstBaseRTPDepayload; timestamp : GLIB.guint32; out_buf : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/rtp/gstbasertpdepayload.h:146 pragma Import (C, gst_base_rtp_depayload_push_ts, "gst_base_rtp_depayload_push_ts"); function gst_base_rtp_depayload_push_list (filter : access GstBaseRTPDepayload; out_list : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/rtp/gstbasertpdepayload.h:148 pragma Import (C, gst_base_rtp_depayload_push_list, "gst_base_rtp_depayload_push_list"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_rtp_gstbasertpdepayload_h;
[ { "context": "-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 35, "score": 0.9998579025268555, "start": 23, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 55, "score": 0.9999307990074158, "start": 37, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
source/oasis/program-elements-discriminant_specifications.ads
optikos/oasis
0
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Element_Vectors; with Program.Elements.Declarations; with Program.Elements.Defining_Identifiers; with Program.Lexical_Elements; with Program.Elements.Expressions; package Program.Elements.Discriminant_Specifications is pragma Pure (Program.Elements.Discriminant_Specifications); type Discriminant_Specification is limited interface and Program.Elements.Declarations.Declaration; type Discriminant_Specification_Access is access all Discriminant_Specification'Class with Storage_Size => 0; not overriding function Names (Self : Discriminant_Specification) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access is abstract; not overriding function Object_Subtype (Self : Discriminant_Specification) return not null Program.Elements.Element_Access is abstract; not overriding function Default_Expression (Self : Discriminant_Specification) return Program.Elements.Expressions.Expression_Access is abstract; not overriding function Has_Not_Null (Self : Discriminant_Specification) return Boolean is abstract; type Discriminant_Specification_Text is limited interface; type Discriminant_Specification_Text_Access is access all Discriminant_Specification_Text'Class with Storage_Size => 0; not overriding function To_Discriminant_Specification_Text (Self : aliased in out Discriminant_Specification) return Discriminant_Specification_Text_Access is abstract; not overriding function Colon_Token (Self : Discriminant_Specification_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Not_Token (Self : Discriminant_Specification_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Null_Token (Self : Discriminant_Specification_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Assignment_Token (Self : Discriminant_Specification_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Semicolon_Token (Self : Discriminant_Specification_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; type Discriminant_Specification_Vector is limited interface and Program.Element_Vectors.Element_Vector; type Discriminant_Specification_Vector_Access is access all Discriminant_Specification_Vector'Class with Storage_Size => 0; overriding function Element (Self : Discriminant_Specification_Vector; Index : Positive) return not null Program.Elements.Element_Access is abstract with Post'Class => Element'Result.Is_Discriminant_Specification; function To_Discriminant_Specification (Self : Discriminant_Specification_Vector'Class; Index : Positive) return not null Discriminant_Specification_Access is (Self.Element (Index).To_Discriminant_Specification); end Program.Elements.Discriminant_Specifications;
660
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Element_Vectors; with Program.Elements.Declarations; with Program.Elements.Defining_Identifiers; with Program.Lexical_Elements; with Program.Elements.Expressions; package Program.Elements.Discriminant_Specifications is pragma Pure (Program.Elements.Discriminant_Specifications); type Discriminant_Specification is limited interface and Program.Elements.Declarations.Declaration; type Discriminant_Specification_Access is access all Discriminant_Specification'Class with Storage_Size => 0; not overriding function Names (Self : Discriminant_Specification) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access is abstract; not overriding function Object_Subtype (Self : Discriminant_Specification) return not null Program.Elements.Element_Access is abstract; not overriding function Default_Expression (Self : Discriminant_Specification) return Program.Elements.Expressions.Expression_Access is abstract; not overriding function Has_Not_Null (Self : Discriminant_Specification) return Boolean is abstract; type Discriminant_Specification_Text is limited interface; type Discriminant_Specification_Text_Access is access all Discriminant_Specification_Text'Class with Storage_Size => 0; not overriding function To_Discriminant_Specification_Text (Self : aliased in out Discriminant_Specification) return Discriminant_Specification_Text_Access is abstract; not overriding function Colon_Token (Self : Discriminant_Specification_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Not_Token (Self : Discriminant_Specification_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Null_Token (Self : Discriminant_Specification_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Assignment_Token (Self : Discriminant_Specification_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Semicolon_Token (Self : Discriminant_Specification_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; type Discriminant_Specification_Vector is limited interface and Program.Element_Vectors.Element_Vector; type Discriminant_Specification_Vector_Access is access all Discriminant_Specification_Vector'Class with Storage_Size => 0; overriding function Element (Self : Discriminant_Specification_Vector; Index : Positive) return not null Program.Elements.Element_Access is abstract with Post'Class => Element'Result.Is_Discriminant_Specification; function To_Discriminant_Specification (Self : Discriminant_Specification_Vector'Class; Index : Positive) return not null Discriminant_Specification_Access is (Self.Element (Index).To_Discriminant_Specification); end Program.Elements.Discriminant_Specifications;
true
-- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Element_Vectors; with Program.Elements.Declarations; with Program.Elements.Defining_Identifiers; with Program.Lexical_Elements; with Program.Elements.Expressions; package Program.Elements.Discriminant_Specifications is pragma Pure (Program.Elements.Discriminant_Specifications); type Discriminant_Specification is limited interface and Program.Elements.Declarations.Declaration; type Discriminant_Specification_Access is access all Discriminant_Specification'Class with Storage_Size => 0; not overriding function Names (Self : Discriminant_Specification) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Vector_Access is abstract; not overriding function Object_Subtype (Self : Discriminant_Specification) return not null Program.Elements.Element_Access is abstract; not overriding function Default_Expression (Self : Discriminant_Specification) return Program.Elements.Expressions.Expression_Access is abstract; not overriding function Has_Not_Null (Self : Discriminant_Specification) return Boolean is abstract; type Discriminant_Specification_Text is limited interface; type Discriminant_Specification_Text_Access is access all Discriminant_Specification_Text'Class with Storage_Size => 0; not overriding function To_Discriminant_Specification_Text (Self : aliased in out Discriminant_Specification) return Discriminant_Specification_Text_Access is abstract; not overriding function Colon_Token (Self : Discriminant_Specification_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Not_Token (Self : Discriminant_Specification_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Null_Token (Self : Discriminant_Specification_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Assignment_Token (Self : Discriminant_Specification_Text) return Program.Lexical_Elements.Lexical_Element_Access is abstract; not overriding function Semicolon_Token (Self : Discriminant_Specification_Text) return not null Program.Lexical_Elements.Lexical_Element_Access is abstract; type Discriminant_Specification_Vector is limited interface and Program.Element_Vectors.Element_Vector; type Discriminant_Specification_Vector_Access is access all Discriminant_Specification_Vector'Class with Storage_Size => 0; overriding function Element (Self : Discriminant_Specification_Vector; Index : Positive) return not null Program.Elements.Element_Access is abstract with Post'Class => Element'Result.Is_Discriminant_Specification; function To_Discriminant_Specification (Self : Discriminant_Specification_Vector'Class; Index : Positive) return not null Discriminant_Specification_Access is (Self.Element (Index).To_Discriminant_Specification); end Program.Elements.Discriminant_Specifications;
[ { "context": "- Wiki renderer\n-- Copyright (C) 2015, 2016, 2019 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 155, "score": 0.999886691570282, "start": 140, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "C) 2015, 2016, 2019 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 186, "score": 0.9998920559883118, "start": 171, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "9 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 213, "score": 0.9999263882637024, "start": 188, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
src/wiki-render.adb
jquorning/ada-wiki
18
----------------------------------------------------------------------- -- wiki-render -- Wiki renderer -- Copyright (C) 2015, 2016, 2019 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Wiki.Nodes.Lists; package body Wiki.Render is -- ------------------------------ -- Render the list of nodes from the document. -- ------------------------------ procedure Render (Engine : in out Renderer'Class; Doc : in Wiki.Documents.Document; List : in Wiki.Nodes.Node_List_Access) is use type Wiki.Nodes.Node_List_Access; procedure Process (Node : in Wiki.Nodes.Node_Type); procedure Process (Node : in Wiki.Nodes.Node_Type) is begin Engine.Render (Doc, Node); end Process; begin if List /= null then Wiki.Nodes.Lists.Iterate (List, Process'Access); end if; end Render; -- ------------------------------ -- Render the document. -- ------------------------------ procedure Render (Engine : in out Renderer'Class; Doc : in Wiki.Documents.Document) is procedure Process (Node : in Wiki.Nodes.Node_Type); procedure Process (Node : in Wiki.Nodes.Node_Type) is begin Engine.Render (Doc, Node); end Process; begin Doc.Iterate (Process'Access); Engine.Finish (Doc); end Render; end Wiki.Render;
4323
----------------------------------------------------------------------- -- wiki-render -- Wiki renderer -- Copyright (C) 2015, 2016, 2019 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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 Wiki.Nodes.Lists; package body Wiki.Render is -- ------------------------------ -- Render the list of nodes from the document. -- ------------------------------ procedure Render (Engine : in out Renderer'Class; Doc : in Wiki.Documents.Document; List : in Wiki.Nodes.Node_List_Access) is use type Wiki.Nodes.Node_List_Access; procedure Process (Node : in Wiki.Nodes.Node_Type); procedure Process (Node : in Wiki.Nodes.Node_Type) is begin Engine.Render (Doc, Node); end Process; begin if List /= null then Wiki.Nodes.Lists.Iterate (List, Process'Access); end if; end Render; -- ------------------------------ -- Render the document. -- ------------------------------ procedure Render (Engine : in out Renderer'Class; Doc : in Wiki.Documents.Document) is procedure Process (Node : in Wiki.Nodes.Node_Type); procedure Process (Node : in Wiki.Nodes.Node_Type) is begin Engine.Render (Doc, Node); end Process; begin Doc.Iterate (Process'Access); Engine.Finish (Doc); end Render; end Wiki.Render;
true
----------------------------------------------------------------------- -- wiki-render -- Wiki renderer -- Copyright (C) 2015, 2016, 2019 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- 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 Wiki.Nodes.Lists; package body Wiki.Render is -- ------------------------------ -- Render the list of nodes from the document. -- ------------------------------ procedure Render (Engine : in out Renderer'Class; Doc : in Wiki.Documents.Document; List : in Wiki.Nodes.Node_List_Access) is use type Wiki.Nodes.Node_List_Access; procedure Process (Node : in Wiki.Nodes.Node_Type); procedure Process (Node : in Wiki.Nodes.Node_Type) is begin Engine.Render (Doc, Node); end Process; begin if List /= null then Wiki.Nodes.Lists.Iterate (List, Process'Access); end if; end Render; -- ------------------------------ -- Render the document. -- ------------------------------ procedure Render (Engine : in out Renderer'Class; Doc : in Wiki.Documents.Document) is procedure Process (Node : in Wiki.Nodes.Node_Type); procedure Process (Node : in Wiki.Nodes.Node_Type) is begin Engine.Render (Doc, Node); end Process; begin Doc.Iterate (Process'Access); Engine.Finish (Doc); end Render; end Wiki.Render;
[ { "context": "---------------------------\n-- Copyright (c) 2015, Natacha Porté --\n-- ", "end": 115, "score": 0.9998577833175659, "start": 102, "tag": "NAME", "value": "Natacha Porté" } ]
src/natools-web-backends-filesystem.ads
faelys/natools-web
1
------------------------------------------------------------------------------ -- Copyright (c) 2015, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.Web.Backends.Filesystem provides a very simple filesystem-based -- -- implementation of Natools.Web.Backends.Backend. -- ------------------------------------------------------------------------------ with Natools.S_Expressions.Lockable; private with Natools.S_Expressions.Atom_Refs; package Natools.Web.Backends.Filesystem is type File_Backend is new Backend with private; overriding function Create (Self : in out File_Backend; Directory, Name : in S_Expressions.Atom) return Ada.Streams.Root_Stream_Type'Class; -- Create a new file, which must not exist previously overriding procedure Delete (Self : in out File_Backend; Directory, Name : in S_Expressions.Atom); -- Destroy a file, which must exist previously overriding function Read (Self : in File_Backend; Directory, Name : in S_Expressions.Atom) return Ada.Streams.Root_Stream_Type'Class; -- Read the contents of an existing file overriding function Append (Self : in out File_Backend; Directory, Name : in S_Expressions.Atom) return Ada.Streams.Root_Stream_Type'Class; -- Return a stream to append data to the given file overriding function Overwrite (Self : in out File_Backend; Directory, Name : in S_Expressions.Atom) return Ada.Streams.Root_Stream_Type'Class; -- Reset the given file to empty and return a stream to write on it overriding procedure Iterate (Self : in File_Backend; Directory : in S_Expressions.Atom; Process : not null access procedure (Name : in S_Expressions.Atom)); -- Iterate over all the existing file names in Directory not overriding function Create (Root : in String) return File_Backend; function Create (Arguments : in out S_Expressions.Lockable.Descriptor'Class) return Backend'Class; private type File_Backend is new Backend with record Root : S_Expressions.Atom_Refs.Immutable_Reference; end record; end Natools.Web.Backends.Filesystem;
18480
------------------------------------------------------------------------------ -- Copyright (c) 2015, <NAME> -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.Web.Backends.Filesystem provides a very simple filesystem-based -- -- implementation of Natools.Web.Backends.Backend. -- ------------------------------------------------------------------------------ with Natools.S_Expressions.Lockable; private with Natools.S_Expressions.Atom_Refs; package Natools.Web.Backends.Filesystem is type File_Backend is new Backend with private; overriding function Create (Self : in out File_Backend; Directory, Name : in S_Expressions.Atom) return Ada.Streams.Root_Stream_Type'Class; -- Create a new file, which must not exist previously overriding procedure Delete (Self : in out File_Backend; Directory, Name : in S_Expressions.Atom); -- Destroy a file, which must exist previously overriding function Read (Self : in File_Backend; Directory, Name : in S_Expressions.Atom) return Ada.Streams.Root_Stream_Type'Class; -- Read the contents of an existing file overriding function Append (Self : in out File_Backend; Directory, Name : in S_Expressions.Atom) return Ada.Streams.Root_Stream_Type'Class; -- Return a stream to append data to the given file overriding function Overwrite (Self : in out File_Backend; Directory, Name : in S_Expressions.Atom) return Ada.Streams.Root_Stream_Type'Class; -- Reset the given file to empty and return a stream to write on it overriding procedure Iterate (Self : in File_Backend; Directory : in S_Expressions.Atom; Process : not null access procedure (Name : in S_Expressions.Atom)); -- Iterate over all the existing file names in Directory not overriding function Create (Root : in String) return File_Backend; function Create (Arguments : in out S_Expressions.Lockable.Descriptor'Class) return Backend'Class; private type File_Backend is new Backend with record Root : S_Expressions.Atom_Refs.Immutable_Reference; end record; end Natools.Web.Backends.Filesystem;
true
------------------------------------------------------------------------------ -- Copyright (c) 2015, PI:NAME:<NAME>END_PI -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- Natools.Web.Backends.Filesystem provides a very simple filesystem-based -- -- implementation of Natools.Web.Backends.Backend. -- ------------------------------------------------------------------------------ with Natools.S_Expressions.Lockable; private with Natools.S_Expressions.Atom_Refs; package Natools.Web.Backends.Filesystem is type File_Backend is new Backend with private; overriding function Create (Self : in out File_Backend; Directory, Name : in S_Expressions.Atom) return Ada.Streams.Root_Stream_Type'Class; -- Create a new file, which must not exist previously overriding procedure Delete (Self : in out File_Backend; Directory, Name : in S_Expressions.Atom); -- Destroy a file, which must exist previously overriding function Read (Self : in File_Backend; Directory, Name : in S_Expressions.Atom) return Ada.Streams.Root_Stream_Type'Class; -- Read the contents of an existing file overriding function Append (Self : in out File_Backend; Directory, Name : in S_Expressions.Atom) return Ada.Streams.Root_Stream_Type'Class; -- Return a stream to append data to the given file overriding function Overwrite (Self : in out File_Backend; Directory, Name : in S_Expressions.Atom) return Ada.Streams.Root_Stream_Type'Class; -- Reset the given file to empty and return a stream to write on it overriding procedure Iterate (Self : in File_Backend; Directory : in S_Expressions.Atom; Process : not null access procedure (Name : in S_Expressions.Atom)); -- Iterate over all the existing file names in Directory not overriding function Create (Root : in String) return File_Backend; function Create (Arguments : in out S_Expressions.Lockable.Descriptor'Class) return Backend'Class; private type File_Backend is new Backend with record Root : S_Expressions.Atom_Refs.Immutable_Reference; end record; end Natools.Web.Backends.Filesystem;
[ { "context": "s real valued matrices.\n-- Copyright (C) 2015-2018 Jonathan S. Parker\n--\n-- Permission to use, copy, modify, and/or dis", "end": 183, "score": 0.9998801350593567, "start": 165, "tag": "NAME", "value": "Jonathan S. Parker" } ]
linear_algebra/bidiagonal.adb
jscparker/math_packages
30
----------------------------------------------------------------------- -- package body Bidiagonal; bidiagonalizes real valued matrices. -- Copyright (C) 2015-2018 Jonathan S. Parker -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ----------------------------------------------------------------------- with Ada.Numerics; with Ada.Numerics.Generic_Elementary_Functions; with Givens_Rotation; package body Bidiagonal is package math is new Ada.Numerics.Generic_Elementary_Functions (Real); use math; package Rotate is new Givens_Rotation (Real); use Rotate; Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; ---------------- -- U_Identity -- ---------------- function U_Identity return U_Matrix is U : U_Matrix := (others => (others => Zero)); begin for r in Row_Index loop U(r, r) := One; end loop; return U; end U_Identity; ---------------- -- V_Identity -- ---------------- function V_Identity return V_Matrix is V : V_Matrix := (others => (others => Zero)); begin for c in Col_Index loop V(c, c) := One; end loop; return V; end V_Identity; -------------------- -- Bi_Diagonalize -- -------------------- -- Operates only on square real blocks. -- -- Want to use orthogonal transforms to make A into B, -- a bi-diagonal matrix with the 1st sub-diagonal non-zero. -- Let Uj be a 2x2 givens rotation matrix, -- and let Uj' be its transpose (and inverse). Then form -- -- A = non-zero -- -- (U1*...*Un) * (Un'*...*U1') * A * (V1*...*Vn) * (Vn'*...*V1') = -- -- U * B * V, -- -- where B = U' * A * V'. -- and A = U * B * V. -- -- A = U * B * V where B is bi-diagonal, with the 1st lower off-diagonal -- non-zero, and all upper off-diagonals zero. (So B is lower triangular.) -- procedure Bi_Diagonalize (A : in out A_Matrix; -- A becomes the B in A = U * B * V' V : out V_Matrix; -- U : out U_Matrix; -- Initialized with Identity Initial_V_Matrix : in V_Matrix; -- Normally just use function V_Identity. Initial_U_Matrix : in U_Matrix; -- Normally just use function U_Identity. Starting_Col : in Col_Index := Col_Index'First; Final_Col : in Col_Index := Col_Index'Last; Final_Row : in Row_Index := Row_Index'Last; Matrix_U_Desired : in Boolean := True; Matrix_V_Desired : in Boolean := True) is Starting_Row : constant Row_Index := Row_Index (Starting_Col); type Integer64 is range -2**63+1 .. 2**63-1; No_of_Rows : constant Integer64 := Integer64(Final_Row)-Integer64(Starting_Row)+1; No_of_Cols : constant Integer64 := Integer64(Final_Col)-Integer64(Starting_Col)+1; pragma Assert (No_of_Rows >= No_of_Cols); Pivot_Row : Row_Index; Final_Pivot_Col, Lo_Col : Col_Index; --------------------------------------- -- Rotate_to_Kill_Element_Lo_of_pCol -- --------------------------------------- -- Zero out A(Lo_Row, pCol) procedure Rotate_to_Kill_Element_Lo_of_pCol (pCol : in Col_Index; Hi_Row : in Row_Index; Lo_Row : in Row_Index) is Pivot_Col : Col_Index renames pCol; Pivot_Row : Row_Index renames Hi_Row; Low_Row : Row_Index renames Lo_Row; pragma Assert(Row_Index (Pivot_Col) = Pivot_Row); -- R_index contains Col_Index sn, cs, cs_minus_1, sn_minus_1 : Real; hypot : Real; P_bigger_than_L : Boolean; Skip_Rotation : Boolean; P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot L : constant Real := A(Low_Row, Pivot_Col); A_pvt, A_low, U_pvt, U_low : Real; begin Get_Rotation_That_Zeros_Out_Low (P, L, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_L, Skip_Rotation); if Skip_Rotation then return; end if; -- Rotate rows. -- -- Want U B V' = A (B = bi-diagonal.) -- -- So generally, I A I = A becomes, -- (I * G' * G) * A * (F * F' * I) = A -- U * B * V' = A -- -- So the desired U will be the product of the G' matrices -- which we obtain by repeatedly multiplying I on the RHS by G'. -- -- Start by multiplying A on LHS by givens rotation G. if P_bigger_than_L then -- |s| < |c| for c in Pivot_Col .. Final_Col loop A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_pvt + ( cs_minus_1*A_pvt + sn*A_low); A(Low_Row, c) := A_low + (-sn*A_pvt + cs_minus_1*A_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for c in Pivot_Col .. Final_Col loop A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_low + ( cs*A_pvt + sn_minus_1*A_low); A(Low_Row, c) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_low); end loop; end if; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Pivot_Row, Pivot_Col)); -- Rotate corresponding columns of U. (Multiply on RHS by G', the -- transpose of above givens matrix to accumulate full U.) -- -- U is (Row_Index x Row_Index). if Matrix_U_Desired then if P_bigger_than_L then -- |s| < |c| for r in Starting_Row .. Final_Row loop U_pvt := U(r, Pivot_Row); U_low := U(r, Low_Row); U(r, Pivot_Row) := U_pvt + ( cs_minus_1*U_pvt + sn*U_low); U(r, Low_Row) := U_low + (-sn*U_pvt + cs_minus_1*U_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for r in Starting_Row .. Final_Row loop U_pvt := U(r, Pivot_Row); U_low := U(r, Low_Row); U(r, Pivot_Row) := U_low + ( cs*U_pvt + sn_minus_1*U_low); U(r, Low_Row) :=-U_pvt + (-sn_minus_1*U_pvt + cs*U_low); end loop; end if; end if; end Rotate_to_Kill_Element_Lo_of_pCol; --------------------------------------- -- Rotate_to_Kill_Element_Hi_of_pRow -- --------------------------------------- -- Zero out A(pRow, Hi_Col) procedure Rotate_to_Kill_Element_Hi_of_pRow (pRow : in Row_Index; Lo_Col : in Col_Index; Hi_Col : in Col_Index) is sn, cs, cs_minus_1, sn_minus_1 : Real; hypot : Real; P_bigger_than_H : Boolean; Skip_Rotation : Boolean; Pivot_Row : Row_Index renames pRow; Pivot_Col : Col_Index renames Lo_Col; A_pvt, A_hi , V_pvt, V_hi : Real; P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot H : constant Real := A(Pivot_Row, Hi_Col); pragma Assert(Row_Index (Pivot_Col) = Pivot_Row+1); begin Get_Rotation_That_Zeros_Out_Low (P, H, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_H, Skip_Rotation); if Skip_Rotation then return; end if; -- Rotate columns. Multiply on RHS by the above Givens matrix. (Hi_Col -- is to the rt. visually, and its index is higher than Pivot's.) if P_bigger_than_H then -- |s| < |c| for r in Pivot_Row .. Final_Row loop A_pvt := A(r, Pivot_Col); A_hi := A(r, Hi_Col); A(r, Pivot_Col) := A_pvt + ( cs_minus_1*A_pvt + sn*A_hi); A(r, Hi_Col) := A_hi + (-sn*A_pvt + cs_minus_1*A_hi); end loop; else -- Abs_P <= Abs_H, so abs t := abs (P / H) <= 1 for r in Pivot_Row .. Final_Row loop A_pvt := A(r, Pivot_Col); A_hi := A(r, Hi_Col); A(r, Pivot_Col) := A_hi + ( cs*A_pvt + sn_minus_1*A_hi); A(r, Hi_Col) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_hi); end loop; end if; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Pivot_Row, Pivot_Col)); -- Rotate corresponding rows of V', hence the columns of V. -- (Multiply on LHS of V' by transpose of above givens matrix to -- accumulate full V.) -- -- V is (Col_Index x Col_Index). -- -- We are calculating U * B * V' by inserting pairs of givens -- rotation matrices between the B and the V'. When we rotate rows -- of V', we are rotating the 2 columns (Pivot_Col, Hi_Col) of V: if Matrix_V_Desired then if P_bigger_than_H then -- |s| < |c| for r in Starting_Col .. Final_Col loop V_pvt := V(r, Pivot_Col); V_hi := V(r, Hi_Col); V(r, Pivot_Col) := V_pvt + ( cs_minus_1*V_pvt + sn*V_hi); V(r, Hi_Col) := V_hi + (-sn*V_pvt + cs_minus_1*V_hi); end loop; else -- Abs_P <= Abs_H, so abs t := abs (P / H) <= 1 for r in Starting_Col .. Final_Col loop V_pvt := V(r, Pivot_Col); V_hi := V(r, Hi_Col); V(r, Pivot_Col) := V_hi + ( cs*V_pvt + sn_minus_1*V_hi); V(r, Hi_Col) :=-V_pvt + (-sn_minus_1*V_pvt + cs*V_hi); end loop; end if; end if; end Rotate_to_Kill_Element_Hi_of_pRow; type Column is array(Row_Index) of Real; procedure Get_Sqrt_of_Sum_of_Sqrs_of_Col (Col_Id : in Col_Index; Starting_Row : in Row_Index; Ending_Row : in Row_Index; Col_Sums : out Column) is Max : Real := Zero; Un_Scale, Scale : Real := Zero; Emin : constant Integer := Real'Machine_Emin; Emax : constant Integer := Real'Machine_Emax; Abs_A : Real := Zero; M_exp : Integer := 0; begin Max := Abs A(Starting_Row, Col_Id); if Ending_Row > Starting_Row then for i in Starting_Row+1 .. Ending_Row loop Abs_A := Abs A(i, Col_Id); if Abs_A > Max then Max := Abs_A; end if; end loop; end if; if Max < Two**Emin then Col_Sums := (others => Zero); return; end if; if Max < Two**(Emin / 2) or else Max > Two**(Emax / 4) then M_Exp := Real'Exponent (Max); Scale := Two ** (-M_Exp); Un_Scale := Two ** ( M_Exp); else Scale := One; Un_Scale := One; end if; Col_Sums(Starting_Row) := Abs A(Starting_Row, Col_Id); if Ending_Row > Starting_Row then Compensated_Sum: declare val, Sum_tmp, Err, Sum : Real := Zero; begin for r in Starting_Row .. Ending_Row loop Val := (Scale * A(r, Col_Id)) ** 2; Val := Val - Err; -- correction to Val, next term in sum. Sum_tmp := Sum + Val; -- now increment Sum Err := (Sum_tmp - Sum) - Val; Sum := Sum_tmp; Col_Sums(r) := Un_Scale * Sqrt (Sum); end loop; end Compensated_Sum; end if; end Get_Sqrt_of_Sum_of_Sqrs_of_Col; type Row is array(Col_Index) of Real; procedure Get_Sqrt_of_Sum_of_Sqrs_of_Row (Row_Id : in Row_Index; Starting_Col : in Col_Index; Ending_Col : in Col_Index; Row_Sums : out Row) is Emin : constant Integer := Real'Machine_Emin; Emax : constant Integer := Real'Machine_Emax; Max : Real := Zero; Un_Scale, Scale : Real := Zero; Abs_A : Real := Zero; M_exp : Integer := 0; begin Max := Abs A(Row_Id, Starting_Col); if Ending_Col > Starting_Col then for c in Starting_Col+1 .. Ending_Col loop Abs_A := Abs A(Row_Id, c); if Abs_A > Max then Max := Abs_A; end if; end loop; end if; if Max < Two**Emin then Row_Sums := (others => Zero); return; end if; if Max < Two**(Emin / 2) or else Max > Two**(Emax / 4) then M_Exp := Real'Exponent (Max); Scale := Two ** (-M_Exp); Un_Scale := Two ** ( M_Exp); else Scale := One; Un_Scale := One; end if; Row_Sums(Starting_Col) := Abs A(Row_Id, Starting_Col); if Ending_Col > Starting_Col then Compensated_Sum: declare Term, Sum_tmp, Err, Sum : Real := Zero; begin for c in Starting_Col .. Ending_Col loop Term := (Scale * A(Row_Id, c)) ** 2; Term := Term - Err; -- correction to Term, next term in sum. Sum_tmp := Sum + Term; -- now increment Sum Err := (Sum_tmp - Sum) - Term; Sum := Sum_tmp; Row_Sums(c) := Un_Scale * Sqrt (Sum); end loop; end Compensated_Sum; end if; end Get_Sqrt_of_Sum_of_Sqrs_of_Row; Row_Sums : Row := (others => Zero); Col_Sums : Column := (others => Zero); begin V := Initial_V_Matrix; U := Initial_U_Matrix; -- Always identity unless you preprocessed A with an L*Q transform etc. if No_of_Cols < 2 then return; end if; -- can do a 2x2 if Row_Index (Final_Col) < Final_Row then Final_Pivot_Col := Final_Col; else Final_Pivot_Col := Final_Col - 1; -- A is square end if; for Pivot_Col in Starting_Col .. Final_Pivot_Col loop -- take lo elements in col = Pivot_Col, and rotate them to diagonal. Pivot_Row := Row_Index (Pivot_Col); -- rotate element from Low_Row to Pivot_Row Get_Sqrt_of_Sum_of_Sqrs_of_Col -- gd (Col_id => Pivot_Col, Starting_Row => Pivot_Row, Ending_Row => Final_Row, Col_Sums => Col_Sums); for Low_Row in Pivot_Row+1 .. Final_Row loop -- order important. -- 50% slower because of M(r,c) c stuff Rotate_to_Kill_Element_Lo_of_pCol -- zero out A(Lo_Row, pCol) (pCol => Pivot_Col, Hi_Row => Pivot_Row, -- Hi = high to eye; its id is lower than Lo_Row. Lo_Row => Low_Row); A(Low_Row, Pivot_Col) := Zero; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign (Col_Sums(Low_Row), A(Pivot_Row, Pivot_Col)); end loop; -- A(Pivot_Row, Pivot_Col) := -- Real'Copy_Sign (Col_Sums(Final_Row), A(Pivot_Row, Pivot_Col)); -- Rotate columns. -- Take hi elements in row = Pivot_Col, and Zero them out by -- rotating them to 1st superdiagonal (column Pivot_Col + 1). if Pivot_Col < Final_Col-1 then -- Lo_Col+1 below is Pivot_Col+2 Pivot_Row := Row_Index (Pivot_Col); Lo_Col := Pivot_Col + 1; -- low to the eye Get_Sqrt_of_Sum_of_Sqrs_of_Row (Row_Id => Pivot_Row, Starting_Col => Lo_Col, Ending_Col => Final_Col, Row_Sums => Row_Sums); for Hi_Col in Lo_Col+1 .. Final_Col loop Rotate_to_Kill_Element_Hi_of_pRow -- zero out A(pRow, Hi_Col) (pRow => Pivot_Row, Lo_Col => Lo_Col, Hi_Col => Hi_Col); A(Pivot_Row, Hi_Col) := Zero; A(Pivot_Row, Lo_Col) := Real'Copy_Sign (Row_Sums(Hi_Col), A(Pivot_Row, Lo_Col)); end loop; -- over Hi_Col -- A(Pivot_Row, Lo_Col) := -- Real'Copy_Sign (Row_Sums(Final_Col), A(Pivot_Row, Lo_Col)); end if; end loop; -- over Pivot_Col end Bi_Diagonalize; -- Must input matrices V and U. A must be bidiagonal - zero everywhere, -- except the diagonal and the superdiagonal. This isn't checked. -- Not optimized for speed. procedure Zero_Shift_Bidiagonal_QR (A : in out A_Matrix; -- A becomes the B in A = U * B * V' V : in out V_Matrix; -- U : in out U_Matrix; -- Initialized with Identity Starting_Col : in Col_Index := Col_Index'First; Final_Col : in Col_Index := Col_Index'Last; Final_Row : in Row_Index := Row_Index'Last; Matrix_U_Desired : in Boolean := True; Matrix_V_Desired : in Boolean := True) is Starting_Row : constant Row_Index := Row_Index (Starting_Col); type Integer64 is range -2**63+1 .. 2**63-1; No_of_Rows : constant Integer64 := Integer64(Final_Row)-Integer64(Starting_Row)+1; No_of_Cols : constant Integer64 := Integer64(Final_Col)-Integer64(Starting_Col)+1; pragma Assert (No_of_Rows >= No_of_Cols); Pivot_Row : Row_Index; Final_Pivot_Col : Col_Index; --------------------------------------- -- Rotate_to_Kill_Element_Lo_of_pCol -- --------------------------------------- -- Zero out A(Lo_Row, pCol) procedure Rotate_to_Kill_Element_Lo_of_pCol (pCol : in Col_Index; Hi_Row : in Row_Index; Lo_Row : in Row_Index) is Pivot_Col : Col_Index renames pCol; Pivot_Row : Row_Index renames Hi_Row; Low_Row : Row_Index renames Lo_Row; pragma Assert(Row_Index (Pivot_Col) = Pivot_Row); sn, cs, cs_minus_1, sn_minus_1 : Real; hypot : Real; P_bigger_than_L : Boolean; Skip_Rotation : Boolean; P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot L : constant Real := A(Low_Row, Pivot_Col); A_pvt, A_low, U_pvt, U_low : Real; begin Get_Rotation_That_Zeros_Out_Low (P, L, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_L, Skip_Rotation); if Skip_Rotation then return; end if; -- Rotate rows. -- -- Want U B V' = A (B = bi-diagonal.) -- -- So generally, I A I = A becomes, -- (I * G' * G) * A * (F * F' * I) = A -- U * B * V' = A -- -- So the desired U will be the product of the G' matrices -- which we obtain by repeatedly multiplying I on the RHS by G'. -- -- Start by multiplying A on LHS by givens rotation G. if P_bigger_than_L then -- |s| < |c| for c in Pivot_Col .. Pivot_Col+1 loop A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_pvt + ( cs_minus_1*A_pvt + sn*A_low); A(Low_Row, c) := A_low + (-sn*A_pvt + cs_minus_1*A_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for c in Pivot_Col .. Pivot_Col+1 loop A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_low + ( cs*A_pvt + sn_minus_1*A_low); A(Low_Row, c) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_low); end loop; end if; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Pivot_Row, Pivot_Col)); -- Rotate corresponding columns of U. (Multiply on RHS by G', the -- transpose of above givens matrix to accumulate full U.) -- -- U is (Row_Index x Row_Index). if Matrix_U_Desired then if P_bigger_than_L then -- |s| < |c| for r in Starting_Row .. Final_Row loop U_pvt := U(r, Pivot_Row); U_low := U(r, Low_Row); U(r, Pivot_Row) := U_pvt + ( cs_minus_1*U_pvt + sn*U_low); U(r, Low_Row) := U_low + (-sn*U_pvt + cs_minus_1*U_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for r in Starting_Row .. Final_Row loop U_pvt := U(r, Pivot_Row); U_low := U(r, Low_Row); U(r, Pivot_Row) := U_low + ( cs*U_pvt + sn_minus_1*U_low); U(r, Low_Row) :=-U_pvt + (-sn_minus_1*U_pvt + cs*U_low); end loop; end if; end if; end Rotate_to_Kill_Element_Lo_of_pCol; --------------------------------------- -- Rotate_to_Kill_Element_Hi_of_pRow -- --------------------------------------- -- Zero out A(pRow, Hi_Col) procedure Rotate_to_Kill_Element_Hi_of_pRow (pRow : in Row_Index; Lo_Col : in Col_Index; Hi_Col : in Col_Index) is sn, cs, cs_minus_1, sn_minus_1 : Real; hypot : Real; P_bigger_than_H : Boolean; Skip_Rotation : Boolean; Pivot_Row : Row_Index renames pRow; Pivot_Col : Col_Index renames Lo_Col; A_pvt, A_hi , V_pvt, V_hi : Real; P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot H : constant Real := A(Pivot_Row, Hi_Col); pragma Assert(Row_Index (Pivot_Col) = Pivot_Row); begin Get_Rotation_That_Zeros_Out_Low (P, H, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_H, Skip_Rotation); if Skip_Rotation then return; end if; -- Rotate columns. Multiply on RHS by the above Givens matrix. (Hi_Col -- is to the rt. visually, and its index is higher than Pivot's.) if P_bigger_than_H then -- |s| < |c| for r in Pivot_Row .. Pivot_Row+1 loop A_pvt := A(r, Pivot_Col); A_hi := A(r, Hi_Col); A(r, Pivot_Col) := A_pvt + ( cs_minus_1*A_pvt + sn*A_hi); A(r, Hi_Col) := A_hi + (-sn*A_pvt + cs_minus_1*A_hi); end loop; else -- Abs_P <= Abs_H, so abs t := abs (P / H) <= 1 for r in Pivot_Row .. Pivot_Row+1 loop A_pvt := A(r, Pivot_Col); A_hi := A(r, Hi_Col); A(r, Pivot_Col) := A_hi + ( cs*A_pvt + sn_minus_1*A_hi); A(r, Hi_Col) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_hi); end loop; end if; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Pivot_Row, Pivot_Col)); -- Rotate corresponding rows of V', hence the columns of V. -- (Multiply on LHS of V' by transpose of above givens matrix to -- accumulate full V.) -- -- V is (Col_Index x Col_Index). -- -- We are calculating U * B * V' by inserting pairs of givens -- rotation matrices between the B and the V'. When we rotate rows -- of V', we are rotating the 2 columns (Pivot_Col, Hi_Col) of V: if Matrix_V_Desired then if P_bigger_than_H then -- |s| < |c| for r in Starting_Col .. Final_Col loop V_pvt := V(r, Pivot_Col); V_hi := V(r, Hi_Col); V(r, Pivot_Col) := V_pvt + ( cs_minus_1*V_pvt + sn*V_hi); V(r, Hi_Col) := V_hi + (-sn*V_pvt + cs_minus_1*V_hi); end loop; else -- Abs_P <= Abs_H, so abs t := abs (P / H) <= 1 for r in Starting_Col .. Final_Col loop V_pvt := V(r, Pivot_Col); V_hi := V(r, Hi_Col); V(r, Pivot_Col) := V_hi + ( cs*V_pvt + sn_minus_1*V_hi); V(r, Hi_Col) :=-V_pvt + (-sn_minus_1*V_pvt + cs*V_hi); end loop; end if; end if; end Rotate_to_Kill_Element_Hi_of_pRow; begin if No_of_Cols < 2 then return; end if; -- can do a 2x2 if Row_Index (Final_Col) < Final_Row then Final_Pivot_Col := Final_Col; else Final_Pivot_Col := Final_Col - 1; -- A is square end if; -- Rotate away the superdiagonal by rotating Pivot_Col and Pivot_Col+1 for Pivot_Col in Starting_Col .. Final_Col-1 loop -- Rotate columns. -- Take hi element in (row, col) = (Pivot_Col, Pivot_Col+1) and -- Zero it out by rotating to diagonal (column Pivot_Col). Pivot_Row := Row_Index (Pivot_Col); Rotate_to_Kill_Element_Hi_of_pRow -- zero out A(pRow, Hi_Col) (pRow => Pivot_Row, Lo_Col => Pivot_Col, Hi_Col => Pivot_Col + 1); A(Pivot_Row, Pivot_Col + 1) := Zero; end loop; -- over Pivot_Col -- Rotate away the subdiagonal by rotating Pivot_Row and Pivot_Row+1 for Pivot_Col in Starting_Col .. Final_Pivot_Col loop -- Rotate rows. -- take lo element in col = Pivot_Col, and rotate it to diagonal. Pivot_Row := Row_Index (Pivot_Col); Rotate_to_Kill_Element_Lo_of_pCol -- zero out A(Lo_Row, pCol) (pCol => Pivot_Col, Hi_Row => Pivot_Row, -- Hi = high to eye; its id is lower than Lo_Row. Lo_Row => Pivot_Row + 1); A(Pivot_Row + 1, Pivot_Col) := Zero; end loop; end Zero_Shift_Bidiagonal_QR; end Bidiagonal;
29146
----------------------------------------------------------------------- -- package body Bidiagonal; bidiagonalizes real valued matrices. -- Copyright (C) 2015-2018 <NAME> -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ----------------------------------------------------------------------- with Ada.Numerics; with Ada.Numerics.Generic_Elementary_Functions; with Givens_Rotation; package body Bidiagonal is package math is new Ada.Numerics.Generic_Elementary_Functions (Real); use math; package Rotate is new Givens_Rotation (Real); use Rotate; Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; ---------------- -- U_Identity -- ---------------- function U_Identity return U_Matrix is U : U_Matrix := (others => (others => Zero)); begin for r in Row_Index loop U(r, r) := One; end loop; return U; end U_Identity; ---------------- -- V_Identity -- ---------------- function V_Identity return V_Matrix is V : V_Matrix := (others => (others => Zero)); begin for c in Col_Index loop V(c, c) := One; end loop; return V; end V_Identity; -------------------- -- Bi_Diagonalize -- -------------------- -- Operates only on square real blocks. -- -- Want to use orthogonal transforms to make A into B, -- a bi-diagonal matrix with the 1st sub-diagonal non-zero. -- Let Uj be a 2x2 givens rotation matrix, -- and let Uj' be its transpose (and inverse). Then form -- -- A = non-zero -- -- (U1*...*Un) * (Un'*...*U1') * A * (V1*...*Vn) * (Vn'*...*V1') = -- -- U * B * V, -- -- where B = U' * A * V'. -- and A = U * B * V. -- -- A = U * B * V where B is bi-diagonal, with the 1st lower off-diagonal -- non-zero, and all upper off-diagonals zero. (So B is lower triangular.) -- procedure Bi_Diagonalize (A : in out A_Matrix; -- A becomes the B in A = U * B * V' V : out V_Matrix; -- U : out U_Matrix; -- Initialized with Identity Initial_V_Matrix : in V_Matrix; -- Normally just use function V_Identity. Initial_U_Matrix : in U_Matrix; -- Normally just use function U_Identity. Starting_Col : in Col_Index := Col_Index'First; Final_Col : in Col_Index := Col_Index'Last; Final_Row : in Row_Index := Row_Index'Last; Matrix_U_Desired : in Boolean := True; Matrix_V_Desired : in Boolean := True) is Starting_Row : constant Row_Index := Row_Index (Starting_Col); type Integer64 is range -2**63+1 .. 2**63-1; No_of_Rows : constant Integer64 := Integer64(Final_Row)-Integer64(Starting_Row)+1; No_of_Cols : constant Integer64 := Integer64(Final_Col)-Integer64(Starting_Col)+1; pragma Assert (No_of_Rows >= No_of_Cols); Pivot_Row : Row_Index; Final_Pivot_Col, Lo_Col : Col_Index; --------------------------------------- -- Rotate_to_Kill_Element_Lo_of_pCol -- --------------------------------------- -- Zero out A(Lo_Row, pCol) procedure Rotate_to_Kill_Element_Lo_of_pCol (pCol : in Col_Index; Hi_Row : in Row_Index; Lo_Row : in Row_Index) is Pivot_Col : Col_Index renames pCol; Pivot_Row : Row_Index renames Hi_Row; Low_Row : Row_Index renames Lo_Row; pragma Assert(Row_Index (Pivot_Col) = Pivot_Row); -- R_index contains Col_Index sn, cs, cs_minus_1, sn_minus_1 : Real; hypot : Real; P_bigger_than_L : Boolean; Skip_Rotation : Boolean; P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot L : constant Real := A(Low_Row, Pivot_Col); A_pvt, A_low, U_pvt, U_low : Real; begin Get_Rotation_That_Zeros_Out_Low (P, L, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_L, Skip_Rotation); if Skip_Rotation then return; end if; -- Rotate rows. -- -- Want U B V' = A (B = bi-diagonal.) -- -- So generally, I A I = A becomes, -- (I * G' * G) * A * (F * F' * I) = A -- U * B * V' = A -- -- So the desired U will be the product of the G' matrices -- which we obtain by repeatedly multiplying I on the RHS by G'. -- -- Start by multiplying A on LHS by givens rotation G. if P_bigger_than_L then -- |s| < |c| for c in Pivot_Col .. Final_Col loop A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_pvt + ( cs_minus_1*A_pvt + sn*A_low); A(Low_Row, c) := A_low + (-sn*A_pvt + cs_minus_1*A_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for c in Pivot_Col .. Final_Col loop A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_low + ( cs*A_pvt + sn_minus_1*A_low); A(Low_Row, c) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_low); end loop; end if; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Pivot_Row, Pivot_Col)); -- Rotate corresponding columns of U. (Multiply on RHS by G', the -- transpose of above givens matrix to accumulate full U.) -- -- U is (Row_Index x Row_Index). if Matrix_U_Desired then if P_bigger_than_L then -- |s| < |c| for r in Starting_Row .. Final_Row loop U_pvt := U(r, Pivot_Row); U_low := U(r, Low_Row); U(r, Pivot_Row) := U_pvt + ( cs_minus_1*U_pvt + sn*U_low); U(r, Low_Row) := U_low + (-sn*U_pvt + cs_minus_1*U_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for r in Starting_Row .. Final_Row loop U_pvt := U(r, Pivot_Row); U_low := U(r, Low_Row); U(r, Pivot_Row) := U_low + ( cs*U_pvt + sn_minus_1*U_low); U(r, Low_Row) :=-U_pvt + (-sn_minus_1*U_pvt + cs*U_low); end loop; end if; end if; end Rotate_to_Kill_Element_Lo_of_pCol; --------------------------------------- -- Rotate_to_Kill_Element_Hi_of_pRow -- --------------------------------------- -- Zero out A(pRow, Hi_Col) procedure Rotate_to_Kill_Element_Hi_of_pRow (pRow : in Row_Index; Lo_Col : in Col_Index; Hi_Col : in Col_Index) is sn, cs, cs_minus_1, sn_minus_1 : Real; hypot : Real; P_bigger_than_H : Boolean; Skip_Rotation : Boolean; Pivot_Row : Row_Index renames pRow; Pivot_Col : Col_Index renames Lo_Col; A_pvt, A_hi , V_pvt, V_hi : Real; P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot H : constant Real := A(Pivot_Row, Hi_Col); pragma Assert(Row_Index (Pivot_Col) = Pivot_Row+1); begin Get_Rotation_That_Zeros_Out_Low (P, H, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_H, Skip_Rotation); if Skip_Rotation then return; end if; -- Rotate columns. Multiply on RHS by the above Givens matrix. (Hi_Col -- is to the rt. visually, and its index is higher than Pivot's.) if P_bigger_than_H then -- |s| < |c| for r in Pivot_Row .. Final_Row loop A_pvt := A(r, Pivot_Col); A_hi := A(r, Hi_Col); A(r, Pivot_Col) := A_pvt + ( cs_minus_1*A_pvt + sn*A_hi); A(r, Hi_Col) := A_hi + (-sn*A_pvt + cs_minus_1*A_hi); end loop; else -- Abs_P <= Abs_H, so abs t := abs (P / H) <= 1 for r in Pivot_Row .. Final_Row loop A_pvt := A(r, Pivot_Col); A_hi := A(r, Hi_Col); A(r, Pivot_Col) := A_hi + ( cs*A_pvt + sn_minus_1*A_hi); A(r, Hi_Col) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_hi); end loop; end if; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Pivot_Row, Pivot_Col)); -- Rotate corresponding rows of V', hence the columns of V. -- (Multiply on LHS of V' by transpose of above givens matrix to -- accumulate full V.) -- -- V is (Col_Index x Col_Index). -- -- We are calculating U * B * V' by inserting pairs of givens -- rotation matrices between the B and the V'. When we rotate rows -- of V', we are rotating the 2 columns (Pivot_Col, Hi_Col) of V: if Matrix_V_Desired then if P_bigger_than_H then -- |s| < |c| for r in Starting_Col .. Final_Col loop V_pvt := V(r, Pivot_Col); V_hi := V(r, Hi_Col); V(r, Pivot_Col) := V_pvt + ( cs_minus_1*V_pvt + sn*V_hi); V(r, Hi_Col) := V_hi + (-sn*V_pvt + cs_minus_1*V_hi); end loop; else -- Abs_P <= Abs_H, so abs t := abs (P / H) <= 1 for r in Starting_Col .. Final_Col loop V_pvt := V(r, Pivot_Col); V_hi := V(r, Hi_Col); V(r, Pivot_Col) := V_hi + ( cs*V_pvt + sn_minus_1*V_hi); V(r, Hi_Col) :=-V_pvt + (-sn_minus_1*V_pvt + cs*V_hi); end loop; end if; end if; end Rotate_to_Kill_Element_Hi_of_pRow; type Column is array(Row_Index) of Real; procedure Get_Sqrt_of_Sum_of_Sqrs_of_Col (Col_Id : in Col_Index; Starting_Row : in Row_Index; Ending_Row : in Row_Index; Col_Sums : out Column) is Max : Real := Zero; Un_Scale, Scale : Real := Zero; Emin : constant Integer := Real'Machine_Emin; Emax : constant Integer := Real'Machine_Emax; Abs_A : Real := Zero; M_exp : Integer := 0; begin Max := Abs A(Starting_Row, Col_Id); if Ending_Row > Starting_Row then for i in Starting_Row+1 .. Ending_Row loop Abs_A := Abs A(i, Col_Id); if Abs_A > Max then Max := Abs_A; end if; end loop; end if; if Max < Two**Emin then Col_Sums := (others => Zero); return; end if; if Max < Two**(Emin / 2) or else Max > Two**(Emax / 4) then M_Exp := Real'Exponent (Max); Scale := Two ** (-M_Exp); Un_Scale := Two ** ( M_Exp); else Scale := One; Un_Scale := One; end if; Col_Sums(Starting_Row) := Abs A(Starting_Row, Col_Id); if Ending_Row > Starting_Row then Compensated_Sum: declare val, Sum_tmp, Err, Sum : Real := Zero; begin for r in Starting_Row .. Ending_Row loop Val := (Scale * A(r, Col_Id)) ** 2; Val := Val - Err; -- correction to Val, next term in sum. Sum_tmp := Sum + Val; -- now increment Sum Err := (Sum_tmp - Sum) - Val; Sum := Sum_tmp; Col_Sums(r) := Un_Scale * Sqrt (Sum); end loop; end Compensated_Sum; end if; end Get_Sqrt_of_Sum_of_Sqrs_of_Col; type Row is array(Col_Index) of Real; procedure Get_Sqrt_of_Sum_of_Sqrs_of_Row (Row_Id : in Row_Index; Starting_Col : in Col_Index; Ending_Col : in Col_Index; Row_Sums : out Row) is Emin : constant Integer := Real'Machine_Emin; Emax : constant Integer := Real'Machine_Emax; Max : Real := Zero; Un_Scale, Scale : Real := Zero; Abs_A : Real := Zero; M_exp : Integer := 0; begin Max := Abs A(Row_Id, Starting_Col); if Ending_Col > Starting_Col then for c in Starting_Col+1 .. Ending_Col loop Abs_A := Abs A(Row_Id, c); if Abs_A > Max then Max := Abs_A; end if; end loop; end if; if Max < Two**Emin then Row_Sums := (others => Zero); return; end if; if Max < Two**(Emin / 2) or else Max > Two**(Emax / 4) then M_Exp := Real'Exponent (Max); Scale := Two ** (-M_Exp); Un_Scale := Two ** ( M_Exp); else Scale := One; Un_Scale := One; end if; Row_Sums(Starting_Col) := Abs A(Row_Id, Starting_Col); if Ending_Col > Starting_Col then Compensated_Sum: declare Term, Sum_tmp, Err, Sum : Real := Zero; begin for c in Starting_Col .. Ending_Col loop Term := (Scale * A(Row_Id, c)) ** 2; Term := Term - Err; -- correction to Term, next term in sum. Sum_tmp := Sum + Term; -- now increment Sum Err := (Sum_tmp - Sum) - Term; Sum := Sum_tmp; Row_Sums(c) := Un_Scale * Sqrt (Sum); end loop; end Compensated_Sum; end if; end Get_Sqrt_of_Sum_of_Sqrs_of_Row; Row_Sums : Row := (others => Zero); Col_Sums : Column := (others => Zero); begin V := Initial_V_Matrix; U := Initial_U_Matrix; -- Always identity unless you preprocessed A with an L*Q transform etc. if No_of_Cols < 2 then return; end if; -- can do a 2x2 if Row_Index (Final_Col) < Final_Row then Final_Pivot_Col := Final_Col; else Final_Pivot_Col := Final_Col - 1; -- A is square end if; for Pivot_Col in Starting_Col .. Final_Pivot_Col loop -- take lo elements in col = Pivot_Col, and rotate them to diagonal. Pivot_Row := Row_Index (Pivot_Col); -- rotate element from Low_Row to Pivot_Row Get_Sqrt_of_Sum_of_Sqrs_of_Col -- gd (Col_id => Pivot_Col, Starting_Row => Pivot_Row, Ending_Row => Final_Row, Col_Sums => Col_Sums); for Low_Row in Pivot_Row+1 .. Final_Row loop -- order important. -- 50% slower because of M(r,c) c stuff Rotate_to_Kill_Element_Lo_of_pCol -- zero out A(Lo_Row, pCol) (pCol => Pivot_Col, Hi_Row => Pivot_Row, -- Hi = high to eye; its id is lower than Lo_Row. Lo_Row => Low_Row); A(Low_Row, Pivot_Col) := Zero; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign (Col_Sums(Low_Row), A(Pivot_Row, Pivot_Col)); end loop; -- A(Pivot_Row, Pivot_Col) := -- Real'Copy_Sign (Col_Sums(Final_Row), A(Pivot_Row, Pivot_Col)); -- Rotate columns. -- Take hi elements in row = Pivot_Col, and Zero them out by -- rotating them to 1st superdiagonal (column Pivot_Col + 1). if Pivot_Col < Final_Col-1 then -- Lo_Col+1 below is Pivot_Col+2 Pivot_Row := Row_Index (Pivot_Col); Lo_Col := Pivot_Col + 1; -- low to the eye Get_Sqrt_of_Sum_of_Sqrs_of_Row (Row_Id => Pivot_Row, Starting_Col => Lo_Col, Ending_Col => Final_Col, Row_Sums => Row_Sums); for Hi_Col in Lo_Col+1 .. Final_Col loop Rotate_to_Kill_Element_Hi_of_pRow -- zero out A(pRow, Hi_Col) (pRow => Pivot_Row, Lo_Col => Lo_Col, Hi_Col => Hi_Col); A(Pivot_Row, Hi_Col) := Zero; A(Pivot_Row, Lo_Col) := Real'Copy_Sign (Row_Sums(Hi_Col), A(Pivot_Row, Lo_Col)); end loop; -- over Hi_Col -- A(Pivot_Row, Lo_Col) := -- Real'Copy_Sign (Row_Sums(Final_Col), A(Pivot_Row, Lo_Col)); end if; end loop; -- over Pivot_Col end Bi_Diagonalize; -- Must input matrices V and U. A must be bidiagonal - zero everywhere, -- except the diagonal and the superdiagonal. This isn't checked. -- Not optimized for speed. procedure Zero_Shift_Bidiagonal_QR (A : in out A_Matrix; -- A becomes the B in A = U * B * V' V : in out V_Matrix; -- U : in out U_Matrix; -- Initialized with Identity Starting_Col : in Col_Index := Col_Index'First; Final_Col : in Col_Index := Col_Index'Last; Final_Row : in Row_Index := Row_Index'Last; Matrix_U_Desired : in Boolean := True; Matrix_V_Desired : in Boolean := True) is Starting_Row : constant Row_Index := Row_Index (Starting_Col); type Integer64 is range -2**63+1 .. 2**63-1; No_of_Rows : constant Integer64 := Integer64(Final_Row)-Integer64(Starting_Row)+1; No_of_Cols : constant Integer64 := Integer64(Final_Col)-Integer64(Starting_Col)+1; pragma Assert (No_of_Rows >= No_of_Cols); Pivot_Row : Row_Index; Final_Pivot_Col : Col_Index; --------------------------------------- -- Rotate_to_Kill_Element_Lo_of_pCol -- --------------------------------------- -- Zero out A(Lo_Row, pCol) procedure Rotate_to_Kill_Element_Lo_of_pCol (pCol : in Col_Index; Hi_Row : in Row_Index; Lo_Row : in Row_Index) is Pivot_Col : Col_Index renames pCol; Pivot_Row : Row_Index renames Hi_Row; Low_Row : Row_Index renames Lo_Row; pragma Assert(Row_Index (Pivot_Col) = Pivot_Row); sn, cs, cs_minus_1, sn_minus_1 : Real; hypot : Real; P_bigger_than_L : Boolean; Skip_Rotation : Boolean; P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot L : constant Real := A(Low_Row, Pivot_Col); A_pvt, A_low, U_pvt, U_low : Real; begin Get_Rotation_That_Zeros_Out_Low (P, L, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_L, Skip_Rotation); if Skip_Rotation then return; end if; -- Rotate rows. -- -- Want U B V' = A (B = bi-diagonal.) -- -- So generally, I A I = A becomes, -- (I * G' * G) * A * (F * F' * I) = A -- U * B * V' = A -- -- So the desired U will be the product of the G' matrices -- which we obtain by repeatedly multiplying I on the RHS by G'. -- -- Start by multiplying A on LHS by givens rotation G. if P_bigger_than_L then -- |s| < |c| for c in Pivot_Col .. Pivot_Col+1 loop A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_pvt + ( cs_minus_1*A_pvt + sn*A_low); A(Low_Row, c) := A_low + (-sn*A_pvt + cs_minus_1*A_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for c in Pivot_Col .. Pivot_Col+1 loop A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_low + ( cs*A_pvt + sn_minus_1*A_low); A(Low_Row, c) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_low); end loop; end if; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Pivot_Row, Pivot_Col)); -- Rotate corresponding columns of U. (Multiply on RHS by G', the -- transpose of above givens matrix to accumulate full U.) -- -- U is (Row_Index x Row_Index). if Matrix_U_Desired then if P_bigger_than_L then -- |s| < |c| for r in Starting_Row .. Final_Row loop U_pvt := U(r, Pivot_Row); U_low := U(r, Low_Row); U(r, Pivot_Row) := U_pvt + ( cs_minus_1*U_pvt + sn*U_low); U(r, Low_Row) := U_low + (-sn*U_pvt + cs_minus_1*U_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for r in Starting_Row .. Final_Row loop U_pvt := U(r, Pivot_Row); U_low := U(r, Low_Row); U(r, Pivot_Row) := U_low + ( cs*U_pvt + sn_minus_1*U_low); U(r, Low_Row) :=-U_pvt + (-sn_minus_1*U_pvt + cs*U_low); end loop; end if; end if; end Rotate_to_Kill_Element_Lo_of_pCol; --------------------------------------- -- Rotate_to_Kill_Element_Hi_of_pRow -- --------------------------------------- -- Zero out A(pRow, Hi_Col) procedure Rotate_to_Kill_Element_Hi_of_pRow (pRow : in Row_Index; Lo_Col : in Col_Index; Hi_Col : in Col_Index) is sn, cs, cs_minus_1, sn_minus_1 : Real; hypot : Real; P_bigger_than_H : Boolean; Skip_Rotation : Boolean; Pivot_Row : Row_Index renames pRow; Pivot_Col : Col_Index renames Lo_Col; A_pvt, A_hi , V_pvt, V_hi : Real; P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot H : constant Real := A(Pivot_Row, Hi_Col); pragma Assert(Row_Index (Pivot_Col) = Pivot_Row); begin Get_Rotation_That_Zeros_Out_Low (P, H, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_H, Skip_Rotation); if Skip_Rotation then return; end if; -- Rotate columns. Multiply on RHS by the above Givens matrix. (Hi_Col -- is to the rt. visually, and its index is higher than Pivot's.) if P_bigger_than_H then -- |s| < |c| for r in Pivot_Row .. Pivot_Row+1 loop A_pvt := A(r, Pivot_Col); A_hi := A(r, Hi_Col); A(r, Pivot_Col) := A_pvt + ( cs_minus_1*A_pvt + sn*A_hi); A(r, Hi_Col) := A_hi + (-sn*A_pvt + cs_minus_1*A_hi); end loop; else -- Abs_P <= Abs_H, so abs t := abs (P / H) <= 1 for r in Pivot_Row .. Pivot_Row+1 loop A_pvt := A(r, Pivot_Col); A_hi := A(r, Hi_Col); A(r, Pivot_Col) := A_hi + ( cs*A_pvt + sn_minus_1*A_hi); A(r, Hi_Col) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_hi); end loop; end if; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Pivot_Row, Pivot_Col)); -- Rotate corresponding rows of V', hence the columns of V. -- (Multiply on LHS of V' by transpose of above givens matrix to -- accumulate full V.) -- -- V is (Col_Index x Col_Index). -- -- We are calculating U * B * V' by inserting pairs of givens -- rotation matrices between the B and the V'. When we rotate rows -- of V', we are rotating the 2 columns (Pivot_Col, Hi_Col) of V: if Matrix_V_Desired then if P_bigger_than_H then -- |s| < |c| for r in Starting_Col .. Final_Col loop V_pvt := V(r, Pivot_Col); V_hi := V(r, Hi_Col); V(r, Pivot_Col) := V_pvt + ( cs_minus_1*V_pvt + sn*V_hi); V(r, Hi_Col) := V_hi + (-sn*V_pvt + cs_minus_1*V_hi); end loop; else -- Abs_P <= Abs_H, so abs t := abs (P / H) <= 1 for r in Starting_Col .. Final_Col loop V_pvt := V(r, Pivot_Col); V_hi := V(r, Hi_Col); V(r, Pivot_Col) := V_hi + ( cs*V_pvt + sn_minus_1*V_hi); V(r, Hi_Col) :=-V_pvt + (-sn_minus_1*V_pvt + cs*V_hi); end loop; end if; end if; end Rotate_to_Kill_Element_Hi_of_pRow; begin if No_of_Cols < 2 then return; end if; -- can do a 2x2 if Row_Index (Final_Col) < Final_Row then Final_Pivot_Col := Final_Col; else Final_Pivot_Col := Final_Col - 1; -- A is square end if; -- Rotate away the superdiagonal by rotating Pivot_Col and Pivot_Col+1 for Pivot_Col in Starting_Col .. Final_Col-1 loop -- Rotate columns. -- Take hi element in (row, col) = (Pivot_Col, Pivot_Col+1) and -- Zero it out by rotating to diagonal (column Pivot_Col). Pivot_Row := Row_Index (Pivot_Col); Rotate_to_Kill_Element_Hi_of_pRow -- zero out A(pRow, Hi_Col) (pRow => Pivot_Row, Lo_Col => Pivot_Col, Hi_Col => Pivot_Col + 1); A(Pivot_Row, Pivot_Col + 1) := Zero; end loop; -- over Pivot_Col -- Rotate away the subdiagonal by rotating Pivot_Row and Pivot_Row+1 for Pivot_Col in Starting_Col .. Final_Pivot_Col loop -- Rotate rows. -- take lo element in col = Pivot_Col, and rotate it to diagonal. Pivot_Row := Row_Index (Pivot_Col); Rotate_to_Kill_Element_Lo_of_pCol -- zero out A(Lo_Row, pCol) (pCol => Pivot_Col, Hi_Row => Pivot_Row, -- Hi = high to eye; its id is lower than Lo_Row. Lo_Row => Pivot_Row + 1); A(Pivot_Row + 1, Pivot_Col) := Zero; end loop; end Zero_Shift_Bidiagonal_QR; end Bidiagonal;
true
----------------------------------------------------------------------- -- package body Bidiagonal; bidiagonalizes real valued matrices. -- Copyright (C) 2015-2018 PI:NAME:<NAME>END_PI -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ----------------------------------------------------------------------- with Ada.Numerics; with Ada.Numerics.Generic_Elementary_Functions; with Givens_Rotation; package body Bidiagonal is package math is new Ada.Numerics.Generic_Elementary_Functions (Real); use math; package Rotate is new Givens_Rotation (Real); use Rotate; Zero : constant Real := +0.0; One : constant Real := +1.0; Two : constant Real := +2.0; ---------------- -- U_Identity -- ---------------- function U_Identity return U_Matrix is U : U_Matrix := (others => (others => Zero)); begin for r in Row_Index loop U(r, r) := One; end loop; return U; end U_Identity; ---------------- -- V_Identity -- ---------------- function V_Identity return V_Matrix is V : V_Matrix := (others => (others => Zero)); begin for c in Col_Index loop V(c, c) := One; end loop; return V; end V_Identity; -------------------- -- Bi_Diagonalize -- -------------------- -- Operates only on square real blocks. -- -- Want to use orthogonal transforms to make A into B, -- a bi-diagonal matrix with the 1st sub-diagonal non-zero. -- Let Uj be a 2x2 givens rotation matrix, -- and let Uj' be its transpose (and inverse). Then form -- -- A = non-zero -- -- (U1*...*Un) * (Un'*...*U1') * A * (V1*...*Vn) * (Vn'*...*V1') = -- -- U * B * V, -- -- where B = U' * A * V'. -- and A = U * B * V. -- -- A = U * B * V where B is bi-diagonal, with the 1st lower off-diagonal -- non-zero, and all upper off-diagonals zero. (So B is lower triangular.) -- procedure Bi_Diagonalize (A : in out A_Matrix; -- A becomes the B in A = U * B * V' V : out V_Matrix; -- U : out U_Matrix; -- Initialized with Identity Initial_V_Matrix : in V_Matrix; -- Normally just use function V_Identity. Initial_U_Matrix : in U_Matrix; -- Normally just use function U_Identity. Starting_Col : in Col_Index := Col_Index'First; Final_Col : in Col_Index := Col_Index'Last; Final_Row : in Row_Index := Row_Index'Last; Matrix_U_Desired : in Boolean := True; Matrix_V_Desired : in Boolean := True) is Starting_Row : constant Row_Index := Row_Index (Starting_Col); type Integer64 is range -2**63+1 .. 2**63-1; No_of_Rows : constant Integer64 := Integer64(Final_Row)-Integer64(Starting_Row)+1; No_of_Cols : constant Integer64 := Integer64(Final_Col)-Integer64(Starting_Col)+1; pragma Assert (No_of_Rows >= No_of_Cols); Pivot_Row : Row_Index; Final_Pivot_Col, Lo_Col : Col_Index; --------------------------------------- -- Rotate_to_Kill_Element_Lo_of_pCol -- --------------------------------------- -- Zero out A(Lo_Row, pCol) procedure Rotate_to_Kill_Element_Lo_of_pCol (pCol : in Col_Index; Hi_Row : in Row_Index; Lo_Row : in Row_Index) is Pivot_Col : Col_Index renames pCol; Pivot_Row : Row_Index renames Hi_Row; Low_Row : Row_Index renames Lo_Row; pragma Assert(Row_Index (Pivot_Col) = Pivot_Row); -- R_index contains Col_Index sn, cs, cs_minus_1, sn_minus_1 : Real; hypot : Real; P_bigger_than_L : Boolean; Skip_Rotation : Boolean; P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot L : constant Real := A(Low_Row, Pivot_Col); A_pvt, A_low, U_pvt, U_low : Real; begin Get_Rotation_That_Zeros_Out_Low (P, L, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_L, Skip_Rotation); if Skip_Rotation then return; end if; -- Rotate rows. -- -- Want U B V' = A (B = bi-diagonal.) -- -- So generally, I A I = A becomes, -- (I * G' * G) * A * (F * F' * I) = A -- U * B * V' = A -- -- So the desired U will be the product of the G' matrices -- which we obtain by repeatedly multiplying I on the RHS by G'. -- -- Start by multiplying A on LHS by givens rotation G. if P_bigger_than_L then -- |s| < |c| for c in Pivot_Col .. Final_Col loop A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_pvt + ( cs_minus_1*A_pvt + sn*A_low); A(Low_Row, c) := A_low + (-sn*A_pvt + cs_minus_1*A_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for c in Pivot_Col .. Final_Col loop A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_low + ( cs*A_pvt + sn_minus_1*A_low); A(Low_Row, c) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_low); end loop; end if; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Pivot_Row, Pivot_Col)); -- Rotate corresponding columns of U. (Multiply on RHS by G', the -- transpose of above givens matrix to accumulate full U.) -- -- U is (Row_Index x Row_Index). if Matrix_U_Desired then if P_bigger_than_L then -- |s| < |c| for r in Starting_Row .. Final_Row loop U_pvt := U(r, Pivot_Row); U_low := U(r, Low_Row); U(r, Pivot_Row) := U_pvt + ( cs_minus_1*U_pvt + sn*U_low); U(r, Low_Row) := U_low + (-sn*U_pvt + cs_minus_1*U_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for r in Starting_Row .. Final_Row loop U_pvt := U(r, Pivot_Row); U_low := U(r, Low_Row); U(r, Pivot_Row) := U_low + ( cs*U_pvt + sn_minus_1*U_low); U(r, Low_Row) :=-U_pvt + (-sn_minus_1*U_pvt + cs*U_low); end loop; end if; end if; end Rotate_to_Kill_Element_Lo_of_pCol; --------------------------------------- -- Rotate_to_Kill_Element_Hi_of_pRow -- --------------------------------------- -- Zero out A(pRow, Hi_Col) procedure Rotate_to_Kill_Element_Hi_of_pRow (pRow : in Row_Index; Lo_Col : in Col_Index; Hi_Col : in Col_Index) is sn, cs, cs_minus_1, sn_minus_1 : Real; hypot : Real; P_bigger_than_H : Boolean; Skip_Rotation : Boolean; Pivot_Row : Row_Index renames pRow; Pivot_Col : Col_Index renames Lo_Col; A_pvt, A_hi , V_pvt, V_hi : Real; P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot H : constant Real := A(Pivot_Row, Hi_Col); pragma Assert(Row_Index (Pivot_Col) = Pivot_Row+1); begin Get_Rotation_That_Zeros_Out_Low (P, H, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_H, Skip_Rotation); if Skip_Rotation then return; end if; -- Rotate columns. Multiply on RHS by the above Givens matrix. (Hi_Col -- is to the rt. visually, and its index is higher than Pivot's.) if P_bigger_than_H then -- |s| < |c| for r in Pivot_Row .. Final_Row loop A_pvt := A(r, Pivot_Col); A_hi := A(r, Hi_Col); A(r, Pivot_Col) := A_pvt + ( cs_minus_1*A_pvt + sn*A_hi); A(r, Hi_Col) := A_hi + (-sn*A_pvt + cs_minus_1*A_hi); end loop; else -- Abs_P <= Abs_H, so abs t := abs (P / H) <= 1 for r in Pivot_Row .. Final_Row loop A_pvt := A(r, Pivot_Col); A_hi := A(r, Hi_Col); A(r, Pivot_Col) := A_hi + ( cs*A_pvt + sn_minus_1*A_hi); A(r, Hi_Col) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_hi); end loop; end if; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Pivot_Row, Pivot_Col)); -- Rotate corresponding rows of V', hence the columns of V. -- (Multiply on LHS of V' by transpose of above givens matrix to -- accumulate full V.) -- -- V is (Col_Index x Col_Index). -- -- We are calculating U * B * V' by inserting pairs of givens -- rotation matrices between the B and the V'. When we rotate rows -- of V', we are rotating the 2 columns (Pivot_Col, Hi_Col) of V: if Matrix_V_Desired then if P_bigger_than_H then -- |s| < |c| for r in Starting_Col .. Final_Col loop V_pvt := V(r, Pivot_Col); V_hi := V(r, Hi_Col); V(r, Pivot_Col) := V_pvt + ( cs_minus_1*V_pvt + sn*V_hi); V(r, Hi_Col) := V_hi + (-sn*V_pvt + cs_minus_1*V_hi); end loop; else -- Abs_P <= Abs_H, so abs t := abs (P / H) <= 1 for r in Starting_Col .. Final_Col loop V_pvt := V(r, Pivot_Col); V_hi := V(r, Hi_Col); V(r, Pivot_Col) := V_hi + ( cs*V_pvt + sn_minus_1*V_hi); V(r, Hi_Col) :=-V_pvt + (-sn_minus_1*V_pvt + cs*V_hi); end loop; end if; end if; end Rotate_to_Kill_Element_Hi_of_pRow; type Column is array(Row_Index) of Real; procedure Get_Sqrt_of_Sum_of_Sqrs_of_Col (Col_Id : in Col_Index; Starting_Row : in Row_Index; Ending_Row : in Row_Index; Col_Sums : out Column) is Max : Real := Zero; Un_Scale, Scale : Real := Zero; Emin : constant Integer := Real'Machine_Emin; Emax : constant Integer := Real'Machine_Emax; Abs_A : Real := Zero; M_exp : Integer := 0; begin Max := Abs A(Starting_Row, Col_Id); if Ending_Row > Starting_Row then for i in Starting_Row+1 .. Ending_Row loop Abs_A := Abs A(i, Col_Id); if Abs_A > Max then Max := Abs_A; end if; end loop; end if; if Max < Two**Emin then Col_Sums := (others => Zero); return; end if; if Max < Two**(Emin / 2) or else Max > Two**(Emax / 4) then M_Exp := Real'Exponent (Max); Scale := Two ** (-M_Exp); Un_Scale := Two ** ( M_Exp); else Scale := One; Un_Scale := One; end if; Col_Sums(Starting_Row) := Abs A(Starting_Row, Col_Id); if Ending_Row > Starting_Row then Compensated_Sum: declare val, Sum_tmp, Err, Sum : Real := Zero; begin for r in Starting_Row .. Ending_Row loop Val := (Scale * A(r, Col_Id)) ** 2; Val := Val - Err; -- correction to Val, next term in sum. Sum_tmp := Sum + Val; -- now increment Sum Err := (Sum_tmp - Sum) - Val; Sum := Sum_tmp; Col_Sums(r) := Un_Scale * Sqrt (Sum); end loop; end Compensated_Sum; end if; end Get_Sqrt_of_Sum_of_Sqrs_of_Col; type Row is array(Col_Index) of Real; procedure Get_Sqrt_of_Sum_of_Sqrs_of_Row (Row_Id : in Row_Index; Starting_Col : in Col_Index; Ending_Col : in Col_Index; Row_Sums : out Row) is Emin : constant Integer := Real'Machine_Emin; Emax : constant Integer := Real'Machine_Emax; Max : Real := Zero; Un_Scale, Scale : Real := Zero; Abs_A : Real := Zero; M_exp : Integer := 0; begin Max := Abs A(Row_Id, Starting_Col); if Ending_Col > Starting_Col then for c in Starting_Col+1 .. Ending_Col loop Abs_A := Abs A(Row_Id, c); if Abs_A > Max then Max := Abs_A; end if; end loop; end if; if Max < Two**Emin then Row_Sums := (others => Zero); return; end if; if Max < Two**(Emin / 2) or else Max > Two**(Emax / 4) then M_Exp := Real'Exponent (Max); Scale := Two ** (-M_Exp); Un_Scale := Two ** ( M_Exp); else Scale := One; Un_Scale := One; end if; Row_Sums(Starting_Col) := Abs A(Row_Id, Starting_Col); if Ending_Col > Starting_Col then Compensated_Sum: declare Term, Sum_tmp, Err, Sum : Real := Zero; begin for c in Starting_Col .. Ending_Col loop Term := (Scale * A(Row_Id, c)) ** 2; Term := Term - Err; -- correction to Term, next term in sum. Sum_tmp := Sum + Term; -- now increment Sum Err := (Sum_tmp - Sum) - Term; Sum := Sum_tmp; Row_Sums(c) := Un_Scale * Sqrt (Sum); end loop; end Compensated_Sum; end if; end Get_Sqrt_of_Sum_of_Sqrs_of_Row; Row_Sums : Row := (others => Zero); Col_Sums : Column := (others => Zero); begin V := Initial_V_Matrix; U := Initial_U_Matrix; -- Always identity unless you preprocessed A with an L*Q transform etc. if No_of_Cols < 2 then return; end if; -- can do a 2x2 if Row_Index (Final_Col) < Final_Row then Final_Pivot_Col := Final_Col; else Final_Pivot_Col := Final_Col - 1; -- A is square end if; for Pivot_Col in Starting_Col .. Final_Pivot_Col loop -- take lo elements in col = Pivot_Col, and rotate them to diagonal. Pivot_Row := Row_Index (Pivot_Col); -- rotate element from Low_Row to Pivot_Row Get_Sqrt_of_Sum_of_Sqrs_of_Col -- gd (Col_id => Pivot_Col, Starting_Row => Pivot_Row, Ending_Row => Final_Row, Col_Sums => Col_Sums); for Low_Row in Pivot_Row+1 .. Final_Row loop -- order important. -- 50% slower because of M(r,c) c stuff Rotate_to_Kill_Element_Lo_of_pCol -- zero out A(Lo_Row, pCol) (pCol => Pivot_Col, Hi_Row => Pivot_Row, -- Hi = high to eye; its id is lower than Lo_Row. Lo_Row => Low_Row); A(Low_Row, Pivot_Col) := Zero; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign (Col_Sums(Low_Row), A(Pivot_Row, Pivot_Col)); end loop; -- A(Pivot_Row, Pivot_Col) := -- Real'Copy_Sign (Col_Sums(Final_Row), A(Pivot_Row, Pivot_Col)); -- Rotate columns. -- Take hi elements in row = Pivot_Col, and Zero them out by -- rotating them to 1st superdiagonal (column Pivot_Col + 1). if Pivot_Col < Final_Col-1 then -- Lo_Col+1 below is Pivot_Col+2 Pivot_Row := Row_Index (Pivot_Col); Lo_Col := Pivot_Col + 1; -- low to the eye Get_Sqrt_of_Sum_of_Sqrs_of_Row (Row_Id => Pivot_Row, Starting_Col => Lo_Col, Ending_Col => Final_Col, Row_Sums => Row_Sums); for Hi_Col in Lo_Col+1 .. Final_Col loop Rotate_to_Kill_Element_Hi_of_pRow -- zero out A(pRow, Hi_Col) (pRow => Pivot_Row, Lo_Col => Lo_Col, Hi_Col => Hi_Col); A(Pivot_Row, Hi_Col) := Zero; A(Pivot_Row, Lo_Col) := Real'Copy_Sign (Row_Sums(Hi_Col), A(Pivot_Row, Lo_Col)); end loop; -- over Hi_Col -- A(Pivot_Row, Lo_Col) := -- Real'Copy_Sign (Row_Sums(Final_Col), A(Pivot_Row, Lo_Col)); end if; end loop; -- over Pivot_Col end Bi_Diagonalize; -- Must input matrices V and U. A must be bidiagonal - zero everywhere, -- except the diagonal and the superdiagonal. This isn't checked. -- Not optimized for speed. procedure Zero_Shift_Bidiagonal_QR (A : in out A_Matrix; -- A becomes the B in A = U * B * V' V : in out V_Matrix; -- U : in out U_Matrix; -- Initialized with Identity Starting_Col : in Col_Index := Col_Index'First; Final_Col : in Col_Index := Col_Index'Last; Final_Row : in Row_Index := Row_Index'Last; Matrix_U_Desired : in Boolean := True; Matrix_V_Desired : in Boolean := True) is Starting_Row : constant Row_Index := Row_Index (Starting_Col); type Integer64 is range -2**63+1 .. 2**63-1; No_of_Rows : constant Integer64 := Integer64(Final_Row)-Integer64(Starting_Row)+1; No_of_Cols : constant Integer64 := Integer64(Final_Col)-Integer64(Starting_Col)+1; pragma Assert (No_of_Rows >= No_of_Cols); Pivot_Row : Row_Index; Final_Pivot_Col : Col_Index; --------------------------------------- -- Rotate_to_Kill_Element_Lo_of_pCol -- --------------------------------------- -- Zero out A(Lo_Row, pCol) procedure Rotate_to_Kill_Element_Lo_of_pCol (pCol : in Col_Index; Hi_Row : in Row_Index; Lo_Row : in Row_Index) is Pivot_Col : Col_Index renames pCol; Pivot_Row : Row_Index renames Hi_Row; Low_Row : Row_Index renames Lo_Row; pragma Assert(Row_Index (Pivot_Col) = Pivot_Row); sn, cs, cs_minus_1, sn_minus_1 : Real; hypot : Real; P_bigger_than_L : Boolean; Skip_Rotation : Boolean; P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot L : constant Real := A(Low_Row, Pivot_Col); A_pvt, A_low, U_pvt, U_low : Real; begin Get_Rotation_That_Zeros_Out_Low (P, L, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_L, Skip_Rotation); if Skip_Rotation then return; end if; -- Rotate rows. -- -- Want U B V' = A (B = bi-diagonal.) -- -- So generally, I A I = A becomes, -- (I * G' * G) * A * (F * F' * I) = A -- U * B * V' = A -- -- So the desired U will be the product of the G' matrices -- which we obtain by repeatedly multiplying I on the RHS by G'. -- -- Start by multiplying A on LHS by givens rotation G. if P_bigger_than_L then -- |s| < |c| for c in Pivot_Col .. Pivot_Col+1 loop A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_pvt + ( cs_minus_1*A_pvt + sn*A_low); A(Low_Row, c) := A_low + (-sn*A_pvt + cs_minus_1*A_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for c in Pivot_Col .. Pivot_Col+1 loop A_pvt := A(Pivot_Row, c); A_low := A(Low_Row, c); A(Pivot_Row, c) := A_low + ( cs*A_pvt + sn_minus_1*A_low); A(Low_Row, c) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_low); end loop; end if; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Pivot_Row, Pivot_Col)); -- Rotate corresponding columns of U. (Multiply on RHS by G', the -- transpose of above givens matrix to accumulate full U.) -- -- U is (Row_Index x Row_Index). if Matrix_U_Desired then if P_bigger_than_L then -- |s| < |c| for r in Starting_Row .. Final_Row loop U_pvt := U(r, Pivot_Row); U_low := U(r, Low_Row); U(r, Pivot_Row) := U_pvt + ( cs_minus_1*U_pvt + sn*U_low); U(r, Low_Row) := U_low + (-sn*U_pvt + cs_minus_1*U_low); end loop; else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1 for r in Starting_Row .. Final_Row loop U_pvt := U(r, Pivot_Row); U_low := U(r, Low_Row); U(r, Pivot_Row) := U_low + ( cs*U_pvt + sn_minus_1*U_low); U(r, Low_Row) :=-U_pvt + (-sn_minus_1*U_pvt + cs*U_low); end loop; end if; end if; end Rotate_to_Kill_Element_Lo_of_pCol; --------------------------------------- -- Rotate_to_Kill_Element_Hi_of_pRow -- --------------------------------------- -- Zero out A(pRow, Hi_Col) procedure Rotate_to_Kill_Element_Hi_of_pRow (pRow : in Row_Index; Lo_Col : in Col_Index; Hi_Col : in Col_Index) is sn, cs, cs_minus_1, sn_minus_1 : Real; hypot : Real; P_bigger_than_H : Boolean; Skip_Rotation : Boolean; Pivot_Row : Row_Index renames pRow; Pivot_Col : Col_Index renames Lo_Col; A_pvt, A_hi , V_pvt, V_hi : Real; P : constant Real := A(Pivot_Row, Pivot_Col); -- P is for Pivot H : constant Real := A(Pivot_Row, Hi_Col); pragma Assert(Row_Index (Pivot_Col) = Pivot_Row); begin Get_Rotation_That_Zeros_Out_Low (P, H, sn, cs, cs_minus_1, sn_minus_1, hypot, P_bigger_than_H, Skip_Rotation); if Skip_Rotation then return; end if; -- Rotate columns. Multiply on RHS by the above Givens matrix. (Hi_Col -- is to the rt. visually, and its index is higher than Pivot's.) if P_bigger_than_H then -- |s| < |c| for r in Pivot_Row .. Pivot_Row+1 loop A_pvt := A(r, Pivot_Col); A_hi := A(r, Hi_Col); A(r, Pivot_Col) := A_pvt + ( cs_minus_1*A_pvt + sn*A_hi); A(r, Hi_Col) := A_hi + (-sn*A_pvt + cs_minus_1*A_hi); end loop; else -- Abs_P <= Abs_H, so abs t := abs (P / H) <= 1 for r in Pivot_Row .. Pivot_Row+1 loop A_pvt := A(r, Pivot_Col); A_hi := A(r, Hi_Col); A(r, Pivot_Col) := A_hi + ( cs*A_pvt + sn_minus_1*A_hi); A(r, Hi_Col) :=-A_pvt + (-sn_minus_1*A_pvt + cs*A_hi); end loop; end if; A(Pivot_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Pivot_Row, Pivot_Col)); -- Rotate corresponding rows of V', hence the columns of V. -- (Multiply on LHS of V' by transpose of above givens matrix to -- accumulate full V.) -- -- V is (Col_Index x Col_Index). -- -- We are calculating U * B * V' by inserting pairs of givens -- rotation matrices between the B and the V'. When we rotate rows -- of V', we are rotating the 2 columns (Pivot_Col, Hi_Col) of V: if Matrix_V_Desired then if P_bigger_than_H then -- |s| < |c| for r in Starting_Col .. Final_Col loop V_pvt := V(r, Pivot_Col); V_hi := V(r, Hi_Col); V(r, Pivot_Col) := V_pvt + ( cs_minus_1*V_pvt + sn*V_hi); V(r, Hi_Col) := V_hi + (-sn*V_pvt + cs_minus_1*V_hi); end loop; else -- Abs_P <= Abs_H, so abs t := abs (P / H) <= 1 for r in Starting_Col .. Final_Col loop V_pvt := V(r, Pivot_Col); V_hi := V(r, Hi_Col); V(r, Pivot_Col) := V_hi + ( cs*V_pvt + sn_minus_1*V_hi); V(r, Hi_Col) :=-V_pvt + (-sn_minus_1*V_pvt + cs*V_hi); end loop; end if; end if; end Rotate_to_Kill_Element_Hi_of_pRow; begin if No_of_Cols < 2 then return; end if; -- can do a 2x2 if Row_Index (Final_Col) < Final_Row then Final_Pivot_Col := Final_Col; else Final_Pivot_Col := Final_Col - 1; -- A is square end if; -- Rotate away the superdiagonal by rotating Pivot_Col and Pivot_Col+1 for Pivot_Col in Starting_Col .. Final_Col-1 loop -- Rotate columns. -- Take hi element in (row, col) = (Pivot_Col, Pivot_Col+1) and -- Zero it out by rotating to diagonal (column Pivot_Col). Pivot_Row := Row_Index (Pivot_Col); Rotate_to_Kill_Element_Hi_of_pRow -- zero out A(pRow, Hi_Col) (pRow => Pivot_Row, Lo_Col => Pivot_Col, Hi_Col => Pivot_Col + 1); A(Pivot_Row, Pivot_Col + 1) := Zero; end loop; -- over Pivot_Col -- Rotate away the subdiagonal by rotating Pivot_Row and Pivot_Row+1 for Pivot_Col in Starting_Col .. Final_Pivot_Col loop -- Rotate rows. -- take lo element in col = Pivot_Col, and rotate it to diagonal. Pivot_Row := Row_Index (Pivot_Col); Rotate_to_Kill_Element_Lo_of_pCol -- zero out A(Lo_Row, pCol) (pCol => Pivot_Col, Hi_Row => Pivot_Row, -- Hi = high to eye; its id is lower than Lo_Row. Lo_Row => Pivot_Row + 1); A(Pivot_Row + 1, Pivot_Col) := Zero; end loop; end Zero_Shift_Bidiagonal_QR; end Bidiagonal;
[ { "context": "-- MIT License\n\n-- Copyright (c) 2021 Stephen Merrony\n\n-- Permission is hereby granted, free of charge,", "end": 53, "score": 0.9998742341995239, "start": 38, "tag": "NAME", "value": "Stephen Merrony" } ]
virtual_memory/memory.ads
SMerrony/dgemua
2
-- MIT License -- Copyright (c) 2021 Stephen Merrony -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. with Ada.Containers; use Ada.Containers; with Ada.Containers.Hashed_Maps; with Interfaces; use Interfaces; with DG_Types; use DG_Types; package Memory is Words_Per_Page : constant Natural := 1024; Ring_7_Page_0 : constant Natural := 16#001c_0000#; -- Physical stuff that has to exist... Mem_Size_Words : constant Integer := 8_388_608; -- MemSizeLCPID is the code returned by the LCPID to indicate the size of RAM in half megabytes Mem_Size_LCPID : constant Dword_T := 63; -- MemSizeNCLID is the code returned by NCLID to indicate size of RAM in 32Kb increments Mem_Size_NCLID : constant Word_T := Word_T(((Mem_Size_Words * 2) / (32 * 1024)) - 1); type Memory_Region is array (Natural range <>) of Word_T; type Page_T is array (0 .. Words_Per_Page - 1) of Word_T; type Page_Arr_T is array (Natural range <>) of Page_T; -- Page 0 special locations for stacks WSFH_Loc : constant Phys_Addr_T := 8#14#; WFP_Loc : constant Phys_Addr_T := 8#20#; WSP_Loc : constant Phys_Addr_T := 8#22#; WSL_Loc : constant Phys_Addr_T := 8#24#; WSB_Loc : constant Phys_Addr_T := 8#26#; NSP_Loc : constant Phys_Addr_T := 8#40#; NFP_Loc : constant Phys_Addr_T := 8#41#; NSL_Loc : constant Phys_Addr_T := 8#42#; NSF_Loc : constant Phys_Addr_T := 8#43#; -- Wide Stack Fault codes WSF_Overflow : constant Dword_T := 0; WSF_Pending : constant Dword_T := 1; WSF_Too_Many_Args : constant Dword_T := 2; WSF_Underflow : constant Dword_T := 3; WSF_Return_Overflow : constant Dword_T := 4; function NaturalHash (K : Natural) return Hash_Type is (Hash_Type (K)); package VRAM_Map is new Ada.Containers.Hashed_Maps ( Key_Type => Natural, Hash => NaturalHash, Equivalent_Keys => "=", Element_Type => Page_T ); protected RAM is procedure Init (Debug_Logging : in Boolean); procedure Map_Page (Page : in Natural; Is_Shared : in Boolean); function Page_Mapped (Page : in Natural) return Boolean; function Get_Last_Unshared_Page return Dword_T; function Get_First_Shared_Page return Dword_T; function Get_Num_Shared_Pages return Dword_T; function Get_Num_Unshared_Pages return Dword_T; procedure Map_Range (Start_Addr : in Phys_Addr_T; Region : in Memory_Region; Is_Shared : in Boolean); procedure Map_Shared_Pages (Start_Addr : in Phys_Addr_T; Pages : in Page_Arr_T); -- function Address_Mapped (Addr : in Phys_Addr_T) return Boolean; function Read_Word (Word_Addr : in Phys_Addr_T) return Word_T with Inline; function Read_Dword (Word_Addr : in Phys_Addr_T) return Dword_T; function Read_Qword (Word_Addr : in Phys_Addr_T) return Qword_T; procedure Write_Word (Word_Addr : in Phys_Addr_T; Datum : Word_T); procedure Write_Dword (Word_Addr : in Phys_Addr_T; Datum : Dword_T); procedure Write_Qword (Word_Addr : in Phys_Addr_T; Datum : Qword_T); function Read_Byte (Word_Addr : in Phys_Addr_T; Low_Byte : in Boolean) return Byte_T; function Read_Byte_BA (BA : in Dword_T) return Byte_T; procedure Write_Byte (Word_Addr : in Phys_Addr_T; Low_Byte : in Boolean; Byt : in Byte_T); procedure Write_Byte_BA (BA : in Dword_T; Datum : in Byte_T); procedure Copy_Byte_BA (Src, Dest : in Dword_T); function Read_Byte_Eclipse_BA (Segment : in Phys_Addr_T; BA_16 : in Word_T) return Byte_T; procedure Write_Byte_Eclipse_BA (Segment : in Phys_Addr_T; BA_16 : in Word_T; Datum : in Byte_T); function Read_Bytes_BA (BA : in Dword_T; Num : in Natural) return Byte_Arr_T; -- specific support for VS/Emua... function Read_String_BA (BA : in Dword_T; Keep_NUL : in Boolean) return String; procedure Write_String_BA (BA : in Dword_T; Str : in String); private VRAM : VRAM_Map.Map; Logging : Boolean; First_Shared_Page, Last_Unshared_Page, Num_Unshared_Pages, Num_Shared_Pages : Natural; end RAM; protected Narrow_Stack is procedure Push (Segment : in Phys_Addr_T; Datum : in Word_T); function Pop (Segment : in Phys_Addr_T) return Word_T; end Narrow_Stack; Page_Already_Mapped, Read_From_Unmapped_Page, Write_To_Unmapped_Page : exception; end Memory;
41
-- MIT License -- Copyright (c) 2021 <NAME> -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. with Ada.Containers; use Ada.Containers; with Ada.Containers.Hashed_Maps; with Interfaces; use Interfaces; with DG_Types; use DG_Types; package Memory is Words_Per_Page : constant Natural := 1024; Ring_7_Page_0 : constant Natural := 16#001c_0000#; -- Physical stuff that has to exist... Mem_Size_Words : constant Integer := 8_388_608; -- MemSizeLCPID is the code returned by the LCPID to indicate the size of RAM in half megabytes Mem_Size_LCPID : constant Dword_T := 63; -- MemSizeNCLID is the code returned by NCLID to indicate size of RAM in 32Kb increments Mem_Size_NCLID : constant Word_T := Word_T(((Mem_Size_Words * 2) / (32 * 1024)) - 1); type Memory_Region is array (Natural range <>) of Word_T; type Page_T is array (0 .. Words_Per_Page - 1) of Word_T; type Page_Arr_T is array (Natural range <>) of Page_T; -- Page 0 special locations for stacks WSFH_Loc : constant Phys_Addr_T := 8#14#; WFP_Loc : constant Phys_Addr_T := 8#20#; WSP_Loc : constant Phys_Addr_T := 8#22#; WSL_Loc : constant Phys_Addr_T := 8#24#; WSB_Loc : constant Phys_Addr_T := 8#26#; NSP_Loc : constant Phys_Addr_T := 8#40#; NFP_Loc : constant Phys_Addr_T := 8#41#; NSL_Loc : constant Phys_Addr_T := 8#42#; NSF_Loc : constant Phys_Addr_T := 8#43#; -- Wide Stack Fault codes WSF_Overflow : constant Dword_T := 0; WSF_Pending : constant Dword_T := 1; WSF_Too_Many_Args : constant Dword_T := 2; WSF_Underflow : constant Dword_T := 3; WSF_Return_Overflow : constant Dword_T := 4; function NaturalHash (K : Natural) return Hash_Type is (Hash_Type (K)); package VRAM_Map is new Ada.Containers.Hashed_Maps ( Key_Type => Natural, Hash => NaturalHash, Equivalent_Keys => "=", Element_Type => Page_T ); protected RAM is procedure Init (Debug_Logging : in Boolean); procedure Map_Page (Page : in Natural; Is_Shared : in Boolean); function Page_Mapped (Page : in Natural) return Boolean; function Get_Last_Unshared_Page return Dword_T; function Get_First_Shared_Page return Dword_T; function Get_Num_Shared_Pages return Dword_T; function Get_Num_Unshared_Pages return Dword_T; procedure Map_Range (Start_Addr : in Phys_Addr_T; Region : in Memory_Region; Is_Shared : in Boolean); procedure Map_Shared_Pages (Start_Addr : in Phys_Addr_T; Pages : in Page_Arr_T); -- function Address_Mapped (Addr : in Phys_Addr_T) return Boolean; function Read_Word (Word_Addr : in Phys_Addr_T) return Word_T with Inline; function Read_Dword (Word_Addr : in Phys_Addr_T) return Dword_T; function Read_Qword (Word_Addr : in Phys_Addr_T) return Qword_T; procedure Write_Word (Word_Addr : in Phys_Addr_T; Datum : Word_T); procedure Write_Dword (Word_Addr : in Phys_Addr_T; Datum : Dword_T); procedure Write_Qword (Word_Addr : in Phys_Addr_T; Datum : Qword_T); function Read_Byte (Word_Addr : in Phys_Addr_T; Low_Byte : in Boolean) return Byte_T; function Read_Byte_BA (BA : in Dword_T) return Byte_T; procedure Write_Byte (Word_Addr : in Phys_Addr_T; Low_Byte : in Boolean; Byt : in Byte_T); procedure Write_Byte_BA (BA : in Dword_T; Datum : in Byte_T); procedure Copy_Byte_BA (Src, Dest : in Dword_T); function Read_Byte_Eclipse_BA (Segment : in Phys_Addr_T; BA_16 : in Word_T) return Byte_T; procedure Write_Byte_Eclipse_BA (Segment : in Phys_Addr_T; BA_16 : in Word_T; Datum : in Byte_T); function Read_Bytes_BA (BA : in Dword_T; Num : in Natural) return Byte_Arr_T; -- specific support for VS/Emua... function Read_String_BA (BA : in Dword_T; Keep_NUL : in Boolean) return String; procedure Write_String_BA (BA : in Dword_T; Str : in String); private VRAM : VRAM_Map.Map; Logging : Boolean; First_Shared_Page, Last_Unshared_Page, Num_Unshared_Pages, Num_Shared_Pages : Natural; end RAM; protected Narrow_Stack is procedure Push (Segment : in Phys_Addr_T; Datum : in Word_T); function Pop (Segment : in Phys_Addr_T) return Word_T; end Narrow_Stack; Page_Already_Mapped, Read_From_Unmapped_Page, Write_To_Unmapped_Page : exception; end Memory;
true
-- MIT License -- Copyright (c) 2021 PI:NAME:<NAME>END_PI -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. with Ada.Containers; use Ada.Containers; with Ada.Containers.Hashed_Maps; with Interfaces; use Interfaces; with DG_Types; use DG_Types; package Memory is Words_Per_Page : constant Natural := 1024; Ring_7_Page_0 : constant Natural := 16#001c_0000#; -- Physical stuff that has to exist... Mem_Size_Words : constant Integer := 8_388_608; -- MemSizeLCPID is the code returned by the LCPID to indicate the size of RAM in half megabytes Mem_Size_LCPID : constant Dword_T := 63; -- MemSizeNCLID is the code returned by NCLID to indicate size of RAM in 32Kb increments Mem_Size_NCLID : constant Word_T := Word_T(((Mem_Size_Words * 2) / (32 * 1024)) - 1); type Memory_Region is array (Natural range <>) of Word_T; type Page_T is array (0 .. Words_Per_Page - 1) of Word_T; type Page_Arr_T is array (Natural range <>) of Page_T; -- Page 0 special locations for stacks WSFH_Loc : constant Phys_Addr_T := 8#14#; WFP_Loc : constant Phys_Addr_T := 8#20#; WSP_Loc : constant Phys_Addr_T := 8#22#; WSL_Loc : constant Phys_Addr_T := 8#24#; WSB_Loc : constant Phys_Addr_T := 8#26#; NSP_Loc : constant Phys_Addr_T := 8#40#; NFP_Loc : constant Phys_Addr_T := 8#41#; NSL_Loc : constant Phys_Addr_T := 8#42#; NSF_Loc : constant Phys_Addr_T := 8#43#; -- Wide Stack Fault codes WSF_Overflow : constant Dword_T := 0; WSF_Pending : constant Dword_T := 1; WSF_Too_Many_Args : constant Dword_T := 2; WSF_Underflow : constant Dword_T := 3; WSF_Return_Overflow : constant Dword_T := 4; function NaturalHash (K : Natural) return Hash_Type is (Hash_Type (K)); package VRAM_Map is new Ada.Containers.Hashed_Maps ( Key_Type => Natural, Hash => NaturalHash, Equivalent_Keys => "=", Element_Type => Page_T ); protected RAM is procedure Init (Debug_Logging : in Boolean); procedure Map_Page (Page : in Natural; Is_Shared : in Boolean); function Page_Mapped (Page : in Natural) return Boolean; function Get_Last_Unshared_Page return Dword_T; function Get_First_Shared_Page return Dword_T; function Get_Num_Shared_Pages return Dword_T; function Get_Num_Unshared_Pages return Dword_T; procedure Map_Range (Start_Addr : in Phys_Addr_T; Region : in Memory_Region; Is_Shared : in Boolean); procedure Map_Shared_Pages (Start_Addr : in Phys_Addr_T; Pages : in Page_Arr_T); -- function Address_Mapped (Addr : in Phys_Addr_T) return Boolean; function Read_Word (Word_Addr : in Phys_Addr_T) return Word_T with Inline; function Read_Dword (Word_Addr : in Phys_Addr_T) return Dword_T; function Read_Qword (Word_Addr : in Phys_Addr_T) return Qword_T; procedure Write_Word (Word_Addr : in Phys_Addr_T; Datum : Word_T); procedure Write_Dword (Word_Addr : in Phys_Addr_T; Datum : Dword_T); procedure Write_Qword (Word_Addr : in Phys_Addr_T; Datum : Qword_T); function Read_Byte (Word_Addr : in Phys_Addr_T; Low_Byte : in Boolean) return Byte_T; function Read_Byte_BA (BA : in Dword_T) return Byte_T; procedure Write_Byte (Word_Addr : in Phys_Addr_T; Low_Byte : in Boolean; Byt : in Byte_T); procedure Write_Byte_BA (BA : in Dword_T; Datum : in Byte_T); procedure Copy_Byte_BA (Src, Dest : in Dword_T); function Read_Byte_Eclipse_BA (Segment : in Phys_Addr_T; BA_16 : in Word_T) return Byte_T; procedure Write_Byte_Eclipse_BA (Segment : in Phys_Addr_T; BA_16 : in Word_T; Datum : in Byte_T); function Read_Bytes_BA (BA : in Dword_T; Num : in Natural) return Byte_Arr_T; -- specific support for VS/Emua... function Read_String_BA (BA : in Dword_T; Keep_NUL : in Boolean) return String; procedure Write_String_BA (BA : in Dword_T; Str : in String); private VRAM : VRAM_Map.Map; Logging : Boolean; First_Shared_Page, Last_Unshared_Page, Num_Unshared_Pages, Num_Shared_Pages : Natural; end RAM; protected Narrow_Stack is procedure Push (Segment : in Phys_Addr_T; Datum : in Word_T); function Pop (Segment : in Phys_Addr_T) return Word_T; end Narrow_Stack; Page_Already_Mapped, Read_From_Unmapped_Page, Write_To_Unmapped_Page : exception; end Memory;
[ { "context": " --\n-- * Richard Wai (ANNEXI-STRAYLINE) ", "end": 1044, "score": 0.999678373336792, "start": 1033, "tag": "NAME", "value": "Richard Wai" } ]
scheduling.ads
annexi-strayline/AURA
13
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Command Line Interface -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020-2021, 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 is driven by the aura cli main program (aura.adb) specifically, -- and is designed to be executed sequentially, in an apprpriate order -- (determined by the main program). As such, it maintains a state via the -- public "Command" object (below), as well as an internal Parameters object -- (of type Parameters_Set) with Build; with Registrar.Library_Units; package Scheduling is Process_Failed: exception; -- Raised during "normal", but ugly failures that are reported via work -- reports, or involve explicit checks. -- -- Generally speaking, if this exception occurs, it is not safe to save the -- Registry or Configuration. Build_Failed: exception; -- Raised specifically when any unit fails to compile, bind, or link. Unlike -- Process_Failed, this error implies that the Registry and Configuration -- can (and should) be safely saved so that subsequent invokcations do not -- need to recompile everything. ---------------- -- Parameters -- ---------------- type Selected_Command is (Build_Command, Checkout_Command, Clean_Command, Compile_Command, Help_Command, Library_Command, Run_Command, Systemize_Command); Command: Selected_Command := Checkout_Command; -- Set by Initialize_Parameters; procedure Initialize_Parameters; -- Loads the previous set of parameters (if any), and then applies and -- validates the parameters passed in. -- -- Additionally checks the correctness of the specified -- options/configuration for relevent commands. -- -- If the parameters are not valid, a message explaining why is output, -- and Process_Failed is raised, otherwise Command is set to the selected -- command -- -- Initialize_Parameters sets a variety of global variables in the -- Scheduling and UI_Primitives packages, and must be invoked before -- executing any other subprograms in this package --------------- -- Processes -- --------------- procedure Clean; -- Removes all state from the project. -- 1. Removes the .aura subdirectory, containing all saved state (config and -- last-run -- 2. Removes the aura-build subdirectory procedure Enter_Root; -- Enters all units in the root directory procedure Initialize_Repositories; procedure Add_Explicit_Checkouts; -- Enters "Requested" subsystems into the Registrar if they are not already -- registered -- -- This should be called after Enter_Root to ensure that root subsystems are -- not checked-out by this process. -- -- If there are no explicit checkouts to add, no action is taken. procedure Checkout_Cycle; -- Goes through successful cycles of Checkout -> Hash -> Configure -> Cache -- until no Subsystems are in a state of "Requested". -- -- If three cycles pass where the number of requested subsystems does not -- change, a list of all requested subsystems is output and Process_Failed -- is raised. -- -- After a successful Checkout_Cycle process (all Requested subsystems -- aquired and configured), the Root Configuration is processed (if any) and -- then all Configuration Manifests are excluded from the Registrar. procedure Consolidate_Dependencies; -- Consolidates and builds all dependency maps procedure Check_Completion; -- Check for any subsystems that are Unavailable (checkout failed for -- "common" reasons), and report diagnostic information to the user -- before aborting. -- -- If all Subsystems are Available, Check for any units with a state of -- Requested (there should be none), and report any found to the user before -- aborting -- -- If -v is not given as a parameter, specific dependency relationships are -- not output, and a simiplified description of incomplete or unavailable -- subsystems is output. -- -- If there are checkout failures and Verbose will be False, -- Consolidate_Dependencies does not need to be invoked first, otherwise -- it must be invoked first. procedure Hash_Registry; -- Hash all units in the registry, including compilation products procedure Compile; -- Executes: -- 1. Build.Compute_Recomplations -- 2. Build.Compilation.Compile -- -- If Quiet is True, compiler output is not copied to the output procedure Bind; -- Creates a binder file, waits for the registration, and then executes a -- compilation run to compile the binder unit procedure Expand_Dependencies; -- If a main unit is specified, all dependencies are added to the link set, -- otherwise the link-set already contains all units. This must be invoked -- before Scan_Linker_Options or Link_Or_Archive procedure Scan_Linker_Options; -- Invokes and tracks the Scan_Linker_Options phase when linking an image -- or library procedure Link_Or_Archive with Pre => Command in Build_Command | Run_Command | Library_Command; -- Depending on the command (build/run/library), and the output image name -- (for library command only), either links an executable, a dynamic library, -- or creates a regular object archive (".a" extension) procedure Execute_Image; -- Executes the compiled and linked image, passing no parameters, but -- preserving the environment values. -- -- On systems (such as Unix) that support replacing the image of the running -- process, Execute_Image will not return. However, on systems that only -- support explict process creation (such as Windows), a new process is -- created, and Execute_Image returns normally. procedure Save_Registry; -- Saves Last_Run procedure Save_Config; -- Saves the build configuration (parameters) end Scheduling;
28456
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Command Line Interface -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020-2021, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (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 is driven by the aura cli main program (aura.adb) specifically, -- and is designed to be executed sequentially, in an apprpriate order -- (determined by the main program). As such, it maintains a state via the -- public "Command" object (below), as well as an internal Parameters object -- (of type Parameters_Set) with Build; with Registrar.Library_Units; package Scheduling is Process_Failed: exception; -- Raised during "normal", but ugly failures that are reported via work -- reports, or involve explicit checks. -- -- Generally speaking, if this exception occurs, it is not safe to save the -- Registry or Configuration. Build_Failed: exception; -- Raised specifically when any unit fails to compile, bind, or link. Unlike -- Process_Failed, this error implies that the Registry and Configuration -- can (and should) be safely saved so that subsequent invokcations do not -- need to recompile everything. ---------------- -- Parameters -- ---------------- type Selected_Command is (Build_Command, Checkout_Command, Clean_Command, Compile_Command, Help_Command, Library_Command, Run_Command, Systemize_Command); Command: Selected_Command := Checkout_Command; -- Set by Initialize_Parameters; procedure Initialize_Parameters; -- Loads the previous set of parameters (if any), and then applies and -- validates the parameters passed in. -- -- Additionally checks the correctness of the specified -- options/configuration for relevent commands. -- -- If the parameters are not valid, a message explaining why is output, -- and Process_Failed is raised, otherwise Command is set to the selected -- command -- -- Initialize_Parameters sets a variety of global variables in the -- Scheduling and UI_Primitives packages, and must be invoked before -- executing any other subprograms in this package --------------- -- Processes -- --------------- procedure Clean; -- Removes all state from the project. -- 1. Removes the .aura subdirectory, containing all saved state (config and -- last-run -- 2. Removes the aura-build subdirectory procedure Enter_Root; -- Enters all units in the root directory procedure Initialize_Repositories; procedure Add_Explicit_Checkouts; -- Enters "Requested" subsystems into the Registrar if they are not already -- registered -- -- This should be called after Enter_Root to ensure that root subsystems are -- not checked-out by this process. -- -- If there are no explicit checkouts to add, no action is taken. procedure Checkout_Cycle; -- Goes through successful cycles of Checkout -> Hash -> Configure -> Cache -- until no Subsystems are in a state of "Requested". -- -- If three cycles pass where the number of requested subsystems does not -- change, a list of all requested subsystems is output and Process_Failed -- is raised. -- -- After a successful Checkout_Cycle process (all Requested subsystems -- aquired and configured), the Root Configuration is processed (if any) and -- then all Configuration Manifests are excluded from the Registrar. procedure Consolidate_Dependencies; -- Consolidates and builds all dependency maps procedure Check_Completion; -- Check for any subsystems that are Unavailable (checkout failed for -- "common" reasons), and report diagnostic information to the user -- before aborting. -- -- If all Subsystems are Available, Check for any units with a state of -- Requested (there should be none), and report any found to the user before -- aborting -- -- If -v is not given as a parameter, specific dependency relationships are -- not output, and a simiplified description of incomplete or unavailable -- subsystems is output. -- -- If there are checkout failures and Verbose will be False, -- Consolidate_Dependencies does not need to be invoked first, otherwise -- it must be invoked first. procedure Hash_Registry; -- Hash all units in the registry, including compilation products procedure Compile; -- Executes: -- 1. Build.Compute_Recomplations -- 2. Build.Compilation.Compile -- -- If Quiet is True, compiler output is not copied to the output procedure Bind; -- Creates a binder file, waits for the registration, and then executes a -- compilation run to compile the binder unit procedure Expand_Dependencies; -- If a main unit is specified, all dependencies are added to the link set, -- otherwise the link-set already contains all units. This must be invoked -- before Scan_Linker_Options or Link_Or_Archive procedure Scan_Linker_Options; -- Invokes and tracks the Scan_Linker_Options phase when linking an image -- or library procedure Link_Or_Archive with Pre => Command in Build_Command | Run_Command | Library_Command; -- Depending on the command (build/run/library), and the output image name -- (for library command only), either links an executable, a dynamic library, -- or creates a regular object archive (".a" extension) procedure Execute_Image; -- Executes the compiled and linked image, passing no parameters, but -- preserving the environment values. -- -- On systems (such as Unix) that support replacing the image of the running -- process, Execute_Image will not return. However, on systems that only -- support explict process creation (such as Windows), a new process is -- created, and Execute_Image returns normally. procedure Save_Registry; -- Saves Last_Run procedure Save_Config; -- Saves the build configuration (parameters) end Scheduling;
true
------------------------------------------------------------------------------ -- -- -- Ada User Repository Annex (AURA) -- -- ANNEXI-STRAYLINE Reference Implementation -- -- -- -- Command Line Interface -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2020-2021, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * PI:NAME:<NAME>END_PI (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 is driven by the aura cli main program (aura.adb) specifically, -- and is designed to be executed sequentially, in an apprpriate order -- (determined by the main program). As such, it maintains a state via the -- public "Command" object (below), as well as an internal Parameters object -- (of type Parameters_Set) with Build; with Registrar.Library_Units; package Scheduling is Process_Failed: exception; -- Raised during "normal", but ugly failures that are reported via work -- reports, or involve explicit checks. -- -- Generally speaking, if this exception occurs, it is not safe to save the -- Registry or Configuration. Build_Failed: exception; -- Raised specifically when any unit fails to compile, bind, or link. Unlike -- Process_Failed, this error implies that the Registry and Configuration -- can (and should) be safely saved so that subsequent invokcations do not -- need to recompile everything. ---------------- -- Parameters -- ---------------- type Selected_Command is (Build_Command, Checkout_Command, Clean_Command, Compile_Command, Help_Command, Library_Command, Run_Command, Systemize_Command); Command: Selected_Command := Checkout_Command; -- Set by Initialize_Parameters; procedure Initialize_Parameters; -- Loads the previous set of parameters (if any), and then applies and -- validates the parameters passed in. -- -- Additionally checks the correctness of the specified -- options/configuration for relevent commands. -- -- If the parameters are not valid, a message explaining why is output, -- and Process_Failed is raised, otherwise Command is set to the selected -- command -- -- Initialize_Parameters sets a variety of global variables in the -- Scheduling and UI_Primitives packages, and must be invoked before -- executing any other subprograms in this package --------------- -- Processes -- --------------- procedure Clean; -- Removes all state from the project. -- 1. Removes the .aura subdirectory, containing all saved state (config and -- last-run -- 2. Removes the aura-build subdirectory procedure Enter_Root; -- Enters all units in the root directory procedure Initialize_Repositories; procedure Add_Explicit_Checkouts; -- Enters "Requested" subsystems into the Registrar if they are not already -- registered -- -- This should be called after Enter_Root to ensure that root subsystems are -- not checked-out by this process. -- -- If there are no explicit checkouts to add, no action is taken. procedure Checkout_Cycle; -- Goes through successful cycles of Checkout -> Hash -> Configure -> Cache -- until no Subsystems are in a state of "Requested". -- -- If three cycles pass where the number of requested subsystems does not -- change, a list of all requested subsystems is output and Process_Failed -- is raised. -- -- After a successful Checkout_Cycle process (all Requested subsystems -- aquired and configured), the Root Configuration is processed (if any) and -- then all Configuration Manifests are excluded from the Registrar. procedure Consolidate_Dependencies; -- Consolidates and builds all dependency maps procedure Check_Completion; -- Check for any subsystems that are Unavailable (checkout failed for -- "common" reasons), and report diagnostic information to the user -- before aborting. -- -- If all Subsystems are Available, Check for any units with a state of -- Requested (there should be none), and report any found to the user before -- aborting -- -- If -v is not given as a parameter, specific dependency relationships are -- not output, and a simiplified description of incomplete or unavailable -- subsystems is output. -- -- If there are checkout failures and Verbose will be False, -- Consolidate_Dependencies does not need to be invoked first, otherwise -- it must be invoked first. procedure Hash_Registry; -- Hash all units in the registry, including compilation products procedure Compile; -- Executes: -- 1. Build.Compute_Recomplations -- 2. Build.Compilation.Compile -- -- If Quiet is True, compiler output is not copied to the output procedure Bind; -- Creates a binder file, waits for the registration, and then executes a -- compilation run to compile the binder unit procedure Expand_Dependencies; -- If a main unit is specified, all dependencies are added to the link set, -- otherwise the link-set already contains all units. This must be invoked -- before Scan_Linker_Options or Link_Or_Archive procedure Scan_Linker_Options; -- Invokes and tracks the Scan_Linker_Options phase when linking an image -- or library procedure Link_Or_Archive with Pre => Command in Build_Command | Run_Command | Library_Command; -- Depending on the command (build/run/library), and the output image name -- (for library command only), either links an executable, a dynamic library, -- or creates a regular object archive (".a" extension) procedure Execute_Image; -- Executes the compiled and linked image, passing no parameters, but -- preserving the environment values. -- -- On systems (such as Unix) that support replacing the image of the running -- process, Execute_Image will not return. However, on systems that only -- support explict process creation (such as Windows), a new process is -- created, and Execute_Image returns normally. procedure Save_Registry; -- Saves Last_Run procedure Save_Config; -- Saves the build configuration (parameters) end Scheduling;
[ { "context": " --\n-- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> --\n-- Al", "end": 824, "score": 0.999888002872467, "start": 811, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> --\n-- All rights reserved. ", "end": 844, "score": 0.9999308586120605, "start": 826, "tag": "EMAIL", "value": "vgodunko@gmail.com" } ]
source/amf/mof/cmof/amf-internals-tables-cmof_metamodel-links.ads
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ package AMF.Internals.Tables.CMOF_Metamodel.Links is procedure Initialize; private procedure Initialize_1; procedure Initialize_2; procedure Initialize_3; procedure Initialize_4; procedure Initialize_5; procedure Initialize_6; procedure Initialize_7; procedure Initialize_8; procedure Initialize_9; procedure Initialize_10; procedure Initialize_11; procedure Initialize_12; procedure Initialize_13; procedure Initialize_14; procedure Initialize_15; procedure Initialize_16; procedure Initialize_17; procedure Initialize_18; procedure Initialize_19; procedure Initialize_20; procedure Initialize_21; procedure Initialize_22; procedure Initialize_23; procedure Initialize_24; procedure Initialize_25; procedure Initialize_26; procedure Initialize_27; procedure Initialize_28; procedure Initialize_29; procedure Initialize_30; procedure Initialize_31; procedure Initialize_32; procedure Initialize_33; procedure Initialize_34; procedure Initialize_35; procedure Initialize_36; procedure Initialize_37; procedure Initialize_38; procedure Initialize_39; procedure Initialize_40; procedure Initialize_41; procedure Initialize_42; procedure Initialize_43; procedure Initialize_44; procedure Initialize_45; procedure Initialize_46; procedure Initialize_47; procedure Initialize_48; procedure Initialize_49; procedure Initialize_50; procedure Initialize_51; procedure Initialize_52; procedure Initialize_53; procedure Initialize_54; procedure Initialize_55; procedure Initialize_56; procedure Initialize_57; procedure Initialize_58; procedure Initialize_59; procedure Initialize_60; procedure Initialize_61; procedure Initialize_62; procedure Initialize_63; procedure Initialize_64; procedure Initialize_65; procedure Initialize_66; procedure Initialize_67; procedure Initialize_68; procedure Initialize_69; procedure Initialize_70; procedure Initialize_71; procedure Initialize_72; procedure Initialize_73; procedure Initialize_74; procedure Initialize_75; procedure Initialize_76; procedure Initialize_77; procedure Initialize_78; procedure Initialize_79; procedure Initialize_80; procedure Initialize_81; procedure Initialize_82; procedure Initialize_83; procedure Initialize_84; procedure Initialize_85; procedure Initialize_86; procedure Initialize_87; procedure Initialize_88; procedure Initialize_89; procedure Initialize_90; procedure Initialize_91; procedure Initialize_92; procedure Initialize_93; procedure Initialize_94; procedure Initialize_95; procedure Initialize_96; procedure Initialize_97; procedure Initialize_98; procedure Initialize_99; procedure Initialize_100; procedure Initialize_101; procedure Initialize_102; procedure Initialize_103; procedure Initialize_104; procedure Initialize_105; procedure Initialize_106; procedure Initialize_107; procedure Initialize_108; procedure Initialize_109; procedure Initialize_110; procedure Initialize_111; procedure Initialize_112; procedure Initialize_113; procedure Initialize_114; procedure Initialize_115; procedure Initialize_116; procedure Initialize_117; procedure Initialize_118; procedure Initialize_119; procedure Initialize_120; procedure Initialize_121; procedure Initialize_122; procedure Initialize_123; procedure Initialize_124; procedure Initialize_125; procedure Initialize_126; procedure Initialize_127; procedure Initialize_128; procedure Initialize_129; procedure Initialize_130; procedure Initialize_131; procedure Initialize_132; procedure Initialize_133; procedure Initialize_134; procedure Initialize_135; procedure Initialize_136; procedure Initialize_137; procedure Initialize_138; procedure Initialize_139; procedure Initialize_140; procedure Initialize_141; procedure Initialize_142; procedure Initialize_143; procedure Initialize_144; procedure Initialize_145; procedure Initialize_146; procedure Initialize_147; procedure Initialize_148; procedure Initialize_149; procedure Initialize_150; procedure Initialize_151; procedure Initialize_152; procedure Initialize_153; procedure Initialize_154; procedure Initialize_155; procedure Initialize_156; procedure Initialize_157; procedure Initialize_158; procedure Initialize_159; procedure Initialize_160; procedure Initialize_161; procedure Initialize_162; procedure Initialize_163; procedure Initialize_164; procedure Initialize_165; procedure Initialize_166; procedure Initialize_167; procedure Initialize_168; procedure Initialize_169; procedure Initialize_170; procedure Initialize_171; procedure Initialize_172; procedure Initialize_173; procedure Initialize_174; procedure Initialize_175; procedure Initialize_176; procedure Initialize_177; procedure Initialize_178; procedure Initialize_179; procedure Initialize_180; procedure Initialize_181; procedure Initialize_182; procedure Initialize_183; procedure Initialize_184; procedure Initialize_185; procedure Initialize_186; procedure Initialize_187; procedure Initialize_188; procedure Initialize_189; procedure Initialize_190; procedure Initialize_191; procedure Initialize_192; procedure Initialize_193; procedure Initialize_194; procedure Initialize_195; procedure Initialize_196; procedure Initialize_197; procedure Initialize_198; procedure Initialize_199; procedure Initialize_200; procedure Initialize_201; procedure Initialize_202; procedure Initialize_203; procedure Initialize_204; procedure Initialize_205; procedure Initialize_206; procedure Initialize_207; procedure Initialize_208; procedure Initialize_209; procedure Initialize_210; procedure Initialize_211; procedure Initialize_212; procedure Initialize_213; procedure Initialize_214; procedure Initialize_215; procedure Initialize_216; procedure Initialize_217; procedure Initialize_218; procedure Initialize_219; procedure Initialize_220; procedure Initialize_221; procedure Initialize_222; procedure Initialize_223; procedure Initialize_224; procedure Initialize_225; procedure Initialize_226; procedure Initialize_227; procedure Initialize_228; procedure Initialize_229; procedure Initialize_230; procedure Initialize_231; procedure Initialize_232; procedure Initialize_233; procedure Initialize_234; procedure Initialize_235; procedure Initialize_236; procedure Initialize_237; procedure Initialize_238; procedure Initialize_239; procedure Initialize_240; procedure Initialize_241; procedure Initialize_242; procedure Initialize_243; procedure Initialize_244; procedure Initialize_245; procedure Initialize_246; procedure Initialize_247; procedure Initialize_248; procedure Initialize_249; procedure Initialize_250; procedure Initialize_251; procedure Initialize_252; procedure Initialize_253; procedure Initialize_254; procedure Initialize_255; procedure Initialize_256; procedure Initialize_257; procedure Initialize_258; procedure Initialize_259; procedure Initialize_260; procedure Initialize_261; procedure Initialize_262; procedure Initialize_263; procedure Initialize_264; procedure Initialize_265; procedure Initialize_266; procedure Initialize_267; procedure Initialize_268; procedure Initialize_269; procedure Initialize_270; procedure Initialize_271; procedure Initialize_272; procedure Initialize_273; procedure Initialize_274; procedure Initialize_275; procedure Initialize_276; procedure Initialize_277; procedure Initialize_278; procedure Initialize_279; procedure Initialize_280; procedure Initialize_281; procedure Initialize_282; procedure Initialize_283; procedure Initialize_284; procedure Initialize_285; procedure Initialize_286; procedure Initialize_287; procedure Initialize_288; procedure Initialize_289; procedure Initialize_290; procedure Initialize_291; procedure Initialize_292; procedure Initialize_293; procedure Initialize_294; procedure Initialize_295; procedure Initialize_296; procedure Initialize_297; procedure Initialize_298; procedure Initialize_299; procedure Initialize_300; procedure Initialize_301; procedure Initialize_302; procedure Initialize_303; procedure Initialize_304; procedure Initialize_305; procedure Initialize_306; procedure Initialize_307; procedure Initialize_308; procedure Initialize_309; procedure Initialize_310; procedure Initialize_311; procedure Initialize_312; procedure Initialize_313; procedure Initialize_314; procedure Initialize_315; procedure Initialize_316; procedure Initialize_317; procedure Initialize_318; procedure Initialize_319; procedure Initialize_320; procedure Initialize_321; procedure Initialize_322; procedure Initialize_323; procedure Initialize_324; procedure Initialize_325; procedure Initialize_326; procedure Initialize_327; procedure Initialize_328; procedure Initialize_329; procedure Initialize_330; procedure Initialize_331; procedure Initialize_332; procedure Initialize_333; procedure Initialize_334; procedure Initialize_335; procedure Initialize_336; procedure Initialize_337; procedure Initialize_338; procedure Initialize_339; procedure Initialize_340; procedure Initialize_341; procedure Initialize_342; procedure Initialize_343; procedure Initialize_344; procedure Initialize_345; procedure Initialize_346; procedure Initialize_347; procedure Initialize_348; procedure Initialize_349; procedure Initialize_350; procedure Initialize_351; procedure Initialize_352; procedure Initialize_353; procedure Initialize_354; procedure Initialize_355; procedure Initialize_356; procedure Initialize_357; procedure Initialize_358; procedure Initialize_359; procedure Initialize_360; procedure Initialize_361; procedure Initialize_362; procedure Initialize_363; procedure Initialize_364; procedure Initialize_365; procedure Initialize_366; procedure Initialize_367; procedure Initialize_368; procedure Initialize_369; procedure Initialize_370; procedure Initialize_371; procedure Initialize_372; procedure Initialize_373; procedure Initialize_374; procedure Initialize_375; procedure Initialize_376; procedure Initialize_377; procedure Initialize_378; procedure Initialize_379; procedure Initialize_380; procedure Initialize_381; procedure Initialize_382; procedure Initialize_383; procedure Initialize_384; procedure Initialize_385; procedure Initialize_386; procedure Initialize_387; procedure Initialize_388; procedure Initialize_389; procedure Initialize_390; procedure Initialize_391; procedure Initialize_392; procedure Initialize_393; procedure Initialize_394; procedure Initialize_395; procedure Initialize_396; procedure Initialize_397; procedure Initialize_398; procedure Initialize_399; procedure Initialize_400; procedure Initialize_401; procedure Initialize_402; procedure Initialize_403; procedure Initialize_404; procedure Initialize_405; procedure Initialize_406; procedure Initialize_407; procedure Initialize_408; procedure Initialize_409; procedure Initialize_410; procedure Initialize_411; procedure Initialize_412; procedure Initialize_413; procedure Initialize_414; procedure Initialize_415; procedure Initialize_416; procedure Initialize_417; procedure Initialize_418; procedure Initialize_419; procedure Initialize_420; procedure Initialize_421; procedure Initialize_422; procedure Initialize_423; procedure Initialize_424; procedure Initialize_425; procedure Initialize_426; procedure Initialize_427; procedure Initialize_428; procedure Initialize_429; procedure Initialize_430; procedure Initialize_431; procedure Initialize_432; procedure Initialize_433; procedure Initialize_434; procedure Initialize_435; procedure Initialize_436; procedure Initialize_437; procedure Initialize_438; procedure Initialize_439; procedure Initialize_440; procedure Initialize_441; procedure Initialize_442; procedure Initialize_443; procedure Initialize_444; procedure Initialize_445; procedure Initialize_446; procedure Initialize_447; procedure Initialize_448; procedure Initialize_449; procedure Initialize_450; procedure Initialize_451; procedure Initialize_452; procedure Initialize_453; procedure Initialize_454; procedure Initialize_455; procedure Initialize_456; procedure Initialize_457; procedure Initialize_458; procedure Initialize_459; procedure Initialize_460; procedure Initialize_461; procedure Initialize_462; procedure Initialize_463; procedure Initialize_464; procedure Initialize_465; procedure Initialize_466; procedure Initialize_467; procedure Initialize_468; procedure Initialize_469; procedure Initialize_470; procedure Initialize_471; procedure Initialize_472; procedure Initialize_473; procedure Initialize_474; procedure Initialize_475; procedure Initialize_476; procedure Initialize_477; procedure Initialize_478; procedure Initialize_479; procedure Initialize_480; procedure Initialize_481; procedure Initialize_482; procedure Initialize_483; procedure Initialize_484; procedure Initialize_485; procedure Initialize_486; procedure Initialize_487; procedure Initialize_488; procedure Initialize_489; procedure Initialize_490; procedure Initialize_491; procedure Initialize_492; procedure Initialize_493; procedure Initialize_494; procedure Initialize_495; procedure Initialize_496; procedure Initialize_497; procedure Initialize_498; procedure Initialize_499; procedure Initialize_500; procedure Initialize_501; procedure Initialize_502; procedure Initialize_503; procedure Initialize_504; procedure Initialize_505; procedure Initialize_506; procedure Initialize_507; procedure Initialize_508; procedure Initialize_509; procedure Initialize_510; procedure Initialize_511; procedure Initialize_512; procedure Initialize_513; procedure Initialize_514; procedure Initialize_515; procedure Initialize_516; procedure Initialize_517; procedure Initialize_518; procedure Initialize_519; procedure Initialize_520; procedure Initialize_521; procedure Initialize_522; procedure Initialize_523; procedure Initialize_524; procedure Initialize_525; procedure Initialize_526; procedure Initialize_527; procedure Initialize_528; procedure Initialize_529; procedure Initialize_530; procedure Initialize_531; procedure Initialize_532; procedure Initialize_533; procedure Initialize_534; procedure Initialize_535; procedure Initialize_536; procedure Initialize_537; procedure Initialize_538; procedure Initialize_539; procedure Initialize_540; procedure Initialize_541; procedure Initialize_542; procedure Initialize_543; procedure Initialize_544; procedure Initialize_545; procedure Initialize_546; procedure Initialize_547; procedure Initialize_548; procedure Initialize_549; procedure Initialize_550; procedure Initialize_551; procedure Initialize_552; procedure Initialize_553; procedure Initialize_554; procedure Initialize_555; procedure Initialize_556; procedure Initialize_557; procedure Initialize_558; procedure Initialize_559; procedure Initialize_560; procedure Initialize_561; procedure Initialize_562; procedure Initialize_563; procedure Initialize_564; procedure Initialize_565; procedure Initialize_566; procedure Initialize_567; procedure Initialize_568; procedure Initialize_569; procedure Initialize_570; procedure Initialize_571; procedure Initialize_572; procedure Initialize_573; procedure Initialize_574; procedure Initialize_575; procedure Initialize_576; procedure Initialize_577; procedure Initialize_578; procedure Initialize_579; procedure Initialize_580; procedure Initialize_581; procedure Initialize_582; procedure Initialize_583; procedure Initialize_584; procedure Initialize_585; procedure Initialize_586; procedure Initialize_587; procedure Initialize_588; procedure Initialize_589; procedure Initialize_590; procedure Initialize_591; procedure Initialize_592; procedure Initialize_593; procedure Initialize_594; procedure Initialize_595; procedure Initialize_596; procedure Initialize_597; procedure Initialize_598; procedure Initialize_599; procedure Initialize_600; procedure Initialize_601; procedure Initialize_602; procedure Initialize_603; procedure Initialize_604; procedure Initialize_605; procedure Initialize_606; procedure Initialize_607; procedure Initialize_608; procedure Initialize_609; procedure Initialize_610; procedure Initialize_611; procedure Initialize_612; procedure Initialize_613; procedure Initialize_614; procedure Initialize_615; procedure Initialize_616; procedure Initialize_617; procedure Initialize_618; procedure Initialize_619; procedure Initialize_620; procedure Initialize_621; procedure Initialize_622; procedure Initialize_623; procedure Initialize_624; procedure Initialize_625; procedure Initialize_626; procedure Initialize_627; procedure Initialize_628; procedure Initialize_629; procedure Initialize_630; procedure Initialize_631; procedure Initialize_632; procedure Initialize_633; procedure Initialize_634; procedure Initialize_635; procedure Initialize_636; procedure Initialize_637; procedure Initialize_638; procedure Initialize_639; procedure Initialize_640; procedure Initialize_641; procedure Initialize_642; procedure Initialize_643; procedure Initialize_644; procedure Initialize_645; procedure Initialize_646; procedure Initialize_647; procedure Initialize_648; procedure Initialize_649; procedure Initialize_650; procedure Initialize_651; procedure Initialize_652; procedure Initialize_653; procedure Initialize_654; procedure Initialize_655; procedure Initialize_656; procedure Initialize_657; procedure Initialize_658; procedure Initialize_659; procedure Initialize_660; procedure Initialize_661; procedure Initialize_662; procedure Initialize_663; procedure Initialize_664; procedure Initialize_665; procedure Initialize_666; procedure Initialize_667; procedure Initialize_668; procedure Initialize_669; procedure Initialize_670; procedure Initialize_671; procedure Initialize_672; procedure Initialize_673; procedure Initialize_674; procedure Initialize_675; procedure Initialize_676; procedure Initialize_677; procedure Initialize_678; procedure Initialize_679; procedure Initialize_680; procedure Initialize_681; procedure Initialize_682; procedure Initialize_683; procedure Initialize_684; procedure Initialize_685; procedure Initialize_686; procedure Initialize_687; procedure Initialize_688; procedure Initialize_689; procedure Initialize_690; procedure Initialize_691; procedure Initialize_692; procedure Initialize_693; procedure Initialize_694; procedure Initialize_695; procedure Initialize_696; procedure Initialize_697; procedure Initialize_698; procedure Initialize_699; procedure Initialize_700; procedure Initialize_701; procedure Initialize_702; procedure Initialize_703; procedure Initialize_704; procedure Initialize_705; procedure Initialize_706; procedure Initialize_707; procedure Initialize_708; procedure Initialize_709; procedure Initialize_710; procedure Initialize_711; procedure Initialize_712; procedure Initialize_713; procedure Initialize_714; procedure Initialize_715; procedure Initialize_716; procedure Initialize_717; procedure Initialize_718; procedure Initialize_719; procedure Initialize_720; procedure Initialize_721; procedure Initialize_722; procedure Initialize_723; procedure Initialize_724; procedure Initialize_725; procedure Initialize_726; procedure Initialize_727; procedure Initialize_728; procedure Initialize_729; procedure Initialize_730; procedure Initialize_731; procedure Initialize_732; procedure Initialize_733; procedure Initialize_734; procedure Initialize_735; procedure Initialize_736; procedure Initialize_737; procedure Initialize_738; procedure Initialize_739; procedure Initialize_740; procedure Initialize_741; procedure Initialize_742; procedure Initialize_743; procedure Initialize_744; procedure Initialize_745; procedure Initialize_746; procedure Initialize_747; procedure Initialize_748; procedure Initialize_749; procedure Initialize_750; procedure Initialize_751; procedure Initialize_752; procedure Initialize_753; procedure Initialize_754; procedure Initialize_755; procedure Initialize_756; procedure Initialize_757; procedure Initialize_758; procedure Initialize_759; procedure Initialize_760; procedure Initialize_761; procedure Initialize_762; procedure Initialize_763; procedure Initialize_764; procedure Initialize_765; procedure Initialize_766; procedure Initialize_767; procedure Initialize_768; procedure Initialize_769; procedure Initialize_770; procedure Initialize_771; procedure Initialize_772; procedure Initialize_773; procedure Initialize_774; procedure Initialize_775; procedure Initialize_776; procedure Initialize_777; procedure Initialize_778; procedure Initialize_779; procedure Initialize_780; procedure Initialize_781; procedure Initialize_782; procedure Initialize_783; procedure Initialize_784; procedure Initialize_785; procedure Initialize_786; procedure Initialize_787; procedure Initialize_788; procedure Initialize_789; procedure Initialize_790; procedure Initialize_791; procedure Initialize_792; procedure Initialize_793; procedure Initialize_794; procedure Initialize_795; procedure Initialize_796; procedure Initialize_797; procedure Initialize_798; procedure Initialize_799; procedure Initialize_800; end AMF.Internals.Tables.CMOF_Metamodel.Links;
22928
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ package AMF.Internals.Tables.CMOF_Metamodel.Links is procedure Initialize; private procedure Initialize_1; procedure Initialize_2; procedure Initialize_3; procedure Initialize_4; procedure Initialize_5; procedure Initialize_6; procedure Initialize_7; procedure Initialize_8; procedure Initialize_9; procedure Initialize_10; procedure Initialize_11; procedure Initialize_12; procedure Initialize_13; procedure Initialize_14; procedure Initialize_15; procedure Initialize_16; procedure Initialize_17; procedure Initialize_18; procedure Initialize_19; procedure Initialize_20; procedure Initialize_21; procedure Initialize_22; procedure Initialize_23; procedure Initialize_24; procedure Initialize_25; procedure Initialize_26; procedure Initialize_27; procedure Initialize_28; procedure Initialize_29; procedure Initialize_30; procedure Initialize_31; procedure Initialize_32; procedure Initialize_33; procedure Initialize_34; procedure Initialize_35; procedure Initialize_36; procedure Initialize_37; procedure Initialize_38; procedure Initialize_39; procedure Initialize_40; procedure Initialize_41; procedure Initialize_42; procedure Initialize_43; procedure Initialize_44; procedure Initialize_45; procedure Initialize_46; procedure Initialize_47; procedure Initialize_48; procedure Initialize_49; procedure Initialize_50; procedure Initialize_51; procedure Initialize_52; procedure Initialize_53; procedure Initialize_54; procedure Initialize_55; procedure Initialize_56; procedure Initialize_57; procedure Initialize_58; procedure Initialize_59; procedure Initialize_60; procedure Initialize_61; procedure Initialize_62; procedure Initialize_63; procedure Initialize_64; procedure Initialize_65; procedure Initialize_66; procedure Initialize_67; procedure Initialize_68; procedure Initialize_69; procedure Initialize_70; procedure Initialize_71; procedure Initialize_72; procedure Initialize_73; procedure Initialize_74; procedure Initialize_75; procedure Initialize_76; procedure Initialize_77; procedure Initialize_78; procedure Initialize_79; procedure Initialize_80; procedure Initialize_81; procedure Initialize_82; procedure Initialize_83; procedure Initialize_84; procedure Initialize_85; procedure Initialize_86; procedure Initialize_87; procedure Initialize_88; procedure Initialize_89; procedure Initialize_90; procedure Initialize_91; procedure Initialize_92; procedure Initialize_93; procedure Initialize_94; procedure Initialize_95; procedure Initialize_96; procedure Initialize_97; procedure Initialize_98; procedure Initialize_99; procedure Initialize_100; procedure Initialize_101; procedure Initialize_102; procedure Initialize_103; procedure Initialize_104; procedure Initialize_105; procedure Initialize_106; procedure Initialize_107; procedure Initialize_108; procedure Initialize_109; procedure Initialize_110; procedure Initialize_111; procedure Initialize_112; procedure Initialize_113; procedure Initialize_114; procedure Initialize_115; procedure Initialize_116; procedure Initialize_117; procedure Initialize_118; procedure Initialize_119; procedure Initialize_120; procedure Initialize_121; procedure Initialize_122; procedure Initialize_123; procedure Initialize_124; procedure Initialize_125; procedure Initialize_126; procedure Initialize_127; procedure Initialize_128; procedure Initialize_129; procedure Initialize_130; procedure Initialize_131; procedure Initialize_132; procedure Initialize_133; procedure Initialize_134; procedure Initialize_135; procedure Initialize_136; procedure Initialize_137; procedure Initialize_138; procedure Initialize_139; procedure Initialize_140; procedure Initialize_141; procedure Initialize_142; procedure Initialize_143; procedure Initialize_144; procedure Initialize_145; procedure Initialize_146; procedure Initialize_147; procedure Initialize_148; procedure Initialize_149; procedure Initialize_150; procedure Initialize_151; procedure Initialize_152; procedure Initialize_153; procedure Initialize_154; procedure Initialize_155; procedure Initialize_156; procedure Initialize_157; procedure Initialize_158; procedure Initialize_159; procedure Initialize_160; procedure Initialize_161; procedure Initialize_162; procedure Initialize_163; procedure Initialize_164; procedure Initialize_165; procedure Initialize_166; procedure Initialize_167; procedure Initialize_168; procedure Initialize_169; procedure Initialize_170; procedure Initialize_171; procedure Initialize_172; procedure Initialize_173; procedure Initialize_174; procedure Initialize_175; procedure Initialize_176; procedure Initialize_177; procedure Initialize_178; procedure Initialize_179; procedure Initialize_180; procedure Initialize_181; procedure Initialize_182; procedure Initialize_183; procedure Initialize_184; procedure Initialize_185; procedure Initialize_186; procedure Initialize_187; procedure Initialize_188; procedure Initialize_189; procedure Initialize_190; procedure Initialize_191; procedure Initialize_192; procedure Initialize_193; procedure Initialize_194; procedure Initialize_195; procedure Initialize_196; procedure Initialize_197; procedure Initialize_198; procedure Initialize_199; procedure Initialize_200; procedure Initialize_201; procedure Initialize_202; procedure Initialize_203; procedure Initialize_204; procedure Initialize_205; procedure Initialize_206; procedure Initialize_207; procedure Initialize_208; procedure Initialize_209; procedure Initialize_210; procedure Initialize_211; procedure Initialize_212; procedure Initialize_213; procedure Initialize_214; procedure Initialize_215; procedure Initialize_216; procedure Initialize_217; procedure Initialize_218; procedure Initialize_219; procedure Initialize_220; procedure Initialize_221; procedure Initialize_222; procedure Initialize_223; procedure Initialize_224; procedure Initialize_225; procedure Initialize_226; procedure Initialize_227; procedure Initialize_228; procedure Initialize_229; procedure Initialize_230; procedure Initialize_231; procedure Initialize_232; procedure Initialize_233; procedure Initialize_234; procedure Initialize_235; procedure Initialize_236; procedure Initialize_237; procedure Initialize_238; procedure Initialize_239; procedure Initialize_240; procedure Initialize_241; procedure Initialize_242; procedure Initialize_243; procedure Initialize_244; procedure Initialize_245; procedure Initialize_246; procedure Initialize_247; procedure Initialize_248; procedure Initialize_249; procedure Initialize_250; procedure Initialize_251; procedure Initialize_252; procedure Initialize_253; procedure Initialize_254; procedure Initialize_255; procedure Initialize_256; procedure Initialize_257; procedure Initialize_258; procedure Initialize_259; procedure Initialize_260; procedure Initialize_261; procedure Initialize_262; procedure Initialize_263; procedure Initialize_264; procedure Initialize_265; procedure Initialize_266; procedure Initialize_267; procedure Initialize_268; procedure Initialize_269; procedure Initialize_270; procedure Initialize_271; procedure Initialize_272; procedure Initialize_273; procedure Initialize_274; procedure Initialize_275; procedure Initialize_276; procedure Initialize_277; procedure Initialize_278; procedure Initialize_279; procedure Initialize_280; procedure Initialize_281; procedure Initialize_282; procedure Initialize_283; procedure Initialize_284; procedure Initialize_285; procedure Initialize_286; procedure Initialize_287; procedure Initialize_288; procedure Initialize_289; procedure Initialize_290; procedure Initialize_291; procedure Initialize_292; procedure Initialize_293; procedure Initialize_294; procedure Initialize_295; procedure Initialize_296; procedure Initialize_297; procedure Initialize_298; procedure Initialize_299; procedure Initialize_300; procedure Initialize_301; procedure Initialize_302; procedure Initialize_303; procedure Initialize_304; procedure Initialize_305; procedure Initialize_306; procedure Initialize_307; procedure Initialize_308; procedure Initialize_309; procedure Initialize_310; procedure Initialize_311; procedure Initialize_312; procedure Initialize_313; procedure Initialize_314; procedure Initialize_315; procedure Initialize_316; procedure Initialize_317; procedure Initialize_318; procedure Initialize_319; procedure Initialize_320; procedure Initialize_321; procedure Initialize_322; procedure Initialize_323; procedure Initialize_324; procedure Initialize_325; procedure Initialize_326; procedure Initialize_327; procedure Initialize_328; procedure Initialize_329; procedure Initialize_330; procedure Initialize_331; procedure Initialize_332; procedure Initialize_333; procedure Initialize_334; procedure Initialize_335; procedure Initialize_336; procedure Initialize_337; procedure Initialize_338; procedure Initialize_339; procedure Initialize_340; procedure Initialize_341; procedure Initialize_342; procedure Initialize_343; procedure Initialize_344; procedure Initialize_345; procedure Initialize_346; procedure Initialize_347; procedure Initialize_348; procedure Initialize_349; procedure Initialize_350; procedure Initialize_351; procedure Initialize_352; procedure Initialize_353; procedure Initialize_354; procedure Initialize_355; procedure Initialize_356; procedure Initialize_357; procedure Initialize_358; procedure Initialize_359; procedure Initialize_360; procedure Initialize_361; procedure Initialize_362; procedure Initialize_363; procedure Initialize_364; procedure Initialize_365; procedure Initialize_366; procedure Initialize_367; procedure Initialize_368; procedure Initialize_369; procedure Initialize_370; procedure Initialize_371; procedure Initialize_372; procedure Initialize_373; procedure Initialize_374; procedure Initialize_375; procedure Initialize_376; procedure Initialize_377; procedure Initialize_378; procedure Initialize_379; procedure Initialize_380; procedure Initialize_381; procedure Initialize_382; procedure Initialize_383; procedure Initialize_384; procedure Initialize_385; procedure Initialize_386; procedure Initialize_387; procedure Initialize_388; procedure Initialize_389; procedure Initialize_390; procedure Initialize_391; procedure Initialize_392; procedure Initialize_393; procedure Initialize_394; procedure Initialize_395; procedure Initialize_396; procedure Initialize_397; procedure Initialize_398; procedure Initialize_399; procedure Initialize_400; procedure Initialize_401; procedure Initialize_402; procedure Initialize_403; procedure Initialize_404; procedure Initialize_405; procedure Initialize_406; procedure Initialize_407; procedure Initialize_408; procedure Initialize_409; procedure Initialize_410; procedure Initialize_411; procedure Initialize_412; procedure Initialize_413; procedure Initialize_414; procedure Initialize_415; procedure Initialize_416; procedure Initialize_417; procedure Initialize_418; procedure Initialize_419; procedure Initialize_420; procedure Initialize_421; procedure Initialize_422; procedure Initialize_423; procedure Initialize_424; procedure Initialize_425; procedure Initialize_426; procedure Initialize_427; procedure Initialize_428; procedure Initialize_429; procedure Initialize_430; procedure Initialize_431; procedure Initialize_432; procedure Initialize_433; procedure Initialize_434; procedure Initialize_435; procedure Initialize_436; procedure Initialize_437; procedure Initialize_438; procedure Initialize_439; procedure Initialize_440; procedure Initialize_441; procedure Initialize_442; procedure Initialize_443; procedure Initialize_444; procedure Initialize_445; procedure Initialize_446; procedure Initialize_447; procedure Initialize_448; procedure Initialize_449; procedure Initialize_450; procedure Initialize_451; procedure Initialize_452; procedure Initialize_453; procedure Initialize_454; procedure Initialize_455; procedure Initialize_456; procedure Initialize_457; procedure Initialize_458; procedure Initialize_459; procedure Initialize_460; procedure Initialize_461; procedure Initialize_462; procedure Initialize_463; procedure Initialize_464; procedure Initialize_465; procedure Initialize_466; procedure Initialize_467; procedure Initialize_468; procedure Initialize_469; procedure Initialize_470; procedure Initialize_471; procedure Initialize_472; procedure Initialize_473; procedure Initialize_474; procedure Initialize_475; procedure Initialize_476; procedure Initialize_477; procedure Initialize_478; procedure Initialize_479; procedure Initialize_480; procedure Initialize_481; procedure Initialize_482; procedure Initialize_483; procedure Initialize_484; procedure Initialize_485; procedure Initialize_486; procedure Initialize_487; procedure Initialize_488; procedure Initialize_489; procedure Initialize_490; procedure Initialize_491; procedure Initialize_492; procedure Initialize_493; procedure Initialize_494; procedure Initialize_495; procedure Initialize_496; procedure Initialize_497; procedure Initialize_498; procedure Initialize_499; procedure Initialize_500; procedure Initialize_501; procedure Initialize_502; procedure Initialize_503; procedure Initialize_504; procedure Initialize_505; procedure Initialize_506; procedure Initialize_507; procedure Initialize_508; procedure Initialize_509; procedure Initialize_510; procedure Initialize_511; procedure Initialize_512; procedure Initialize_513; procedure Initialize_514; procedure Initialize_515; procedure Initialize_516; procedure Initialize_517; procedure Initialize_518; procedure Initialize_519; procedure Initialize_520; procedure Initialize_521; procedure Initialize_522; procedure Initialize_523; procedure Initialize_524; procedure Initialize_525; procedure Initialize_526; procedure Initialize_527; procedure Initialize_528; procedure Initialize_529; procedure Initialize_530; procedure Initialize_531; procedure Initialize_532; procedure Initialize_533; procedure Initialize_534; procedure Initialize_535; procedure Initialize_536; procedure Initialize_537; procedure Initialize_538; procedure Initialize_539; procedure Initialize_540; procedure Initialize_541; procedure Initialize_542; procedure Initialize_543; procedure Initialize_544; procedure Initialize_545; procedure Initialize_546; procedure Initialize_547; procedure Initialize_548; procedure Initialize_549; procedure Initialize_550; procedure Initialize_551; procedure Initialize_552; procedure Initialize_553; procedure Initialize_554; procedure Initialize_555; procedure Initialize_556; procedure Initialize_557; procedure Initialize_558; procedure Initialize_559; procedure Initialize_560; procedure Initialize_561; procedure Initialize_562; procedure Initialize_563; procedure Initialize_564; procedure Initialize_565; procedure Initialize_566; procedure Initialize_567; procedure Initialize_568; procedure Initialize_569; procedure Initialize_570; procedure Initialize_571; procedure Initialize_572; procedure Initialize_573; procedure Initialize_574; procedure Initialize_575; procedure Initialize_576; procedure Initialize_577; procedure Initialize_578; procedure Initialize_579; procedure Initialize_580; procedure Initialize_581; procedure Initialize_582; procedure Initialize_583; procedure Initialize_584; procedure Initialize_585; procedure Initialize_586; procedure Initialize_587; procedure Initialize_588; procedure Initialize_589; procedure Initialize_590; procedure Initialize_591; procedure Initialize_592; procedure Initialize_593; procedure Initialize_594; procedure Initialize_595; procedure Initialize_596; procedure Initialize_597; procedure Initialize_598; procedure Initialize_599; procedure Initialize_600; procedure Initialize_601; procedure Initialize_602; procedure Initialize_603; procedure Initialize_604; procedure Initialize_605; procedure Initialize_606; procedure Initialize_607; procedure Initialize_608; procedure Initialize_609; procedure Initialize_610; procedure Initialize_611; procedure Initialize_612; procedure Initialize_613; procedure Initialize_614; procedure Initialize_615; procedure Initialize_616; procedure Initialize_617; procedure Initialize_618; procedure Initialize_619; procedure Initialize_620; procedure Initialize_621; procedure Initialize_622; procedure Initialize_623; procedure Initialize_624; procedure Initialize_625; procedure Initialize_626; procedure Initialize_627; procedure Initialize_628; procedure Initialize_629; procedure Initialize_630; procedure Initialize_631; procedure Initialize_632; procedure Initialize_633; procedure Initialize_634; procedure Initialize_635; procedure Initialize_636; procedure Initialize_637; procedure Initialize_638; procedure Initialize_639; procedure Initialize_640; procedure Initialize_641; procedure Initialize_642; procedure Initialize_643; procedure Initialize_644; procedure Initialize_645; procedure Initialize_646; procedure Initialize_647; procedure Initialize_648; procedure Initialize_649; procedure Initialize_650; procedure Initialize_651; procedure Initialize_652; procedure Initialize_653; procedure Initialize_654; procedure Initialize_655; procedure Initialize_656; procedure Initialize_657; procedure Initialize_658; procedure Initialize_659; procedure Initialize_660; procedure Initialize_661; procedure Initialize_662; procedure Initialize_663; procedure Initialize_664; procedure Initialize_665; procedure Initialize_666; procedure Initialize_667; procedure Initialize_668; procedure Initialize_669; procedure Initialize_670; procedure Initialize_671; procedure Initialize_672; procedure Initialize_673; procedure Initialize_674; procedure Initialize_675; procedure Initialize_676; procedure Initialize_677; procedure Initialize_678; procedure Initialize_679; procedure Initialize_680; procedure Initialize_681; procedure Initialize_682; procedure Initialize_683; procedure Initialize_684; procedure Initialize_685; procedure Initialize_686; procedure Initialize_687; procedure Initialize_688; procedure Initialize_689; procedure Initialize_690; procedure Initialize_691; procedure Initialize_692; procedure Initialize_693; procedure Initialize_694; procedure Initialize_695; procedure Initialize_696; procedure Initialize_697; procedure Initialize_698; procedure Initialize_699; procedure Initialize_700; procedure Initialize_701; procedure Initialize_702; procedure Initialize_703; procedure Initialize_704; procedure Initialize_705; procedure Initialize_706; procedure Initialize_707; procedure Initialize_708; procedure Initialize_709; procedure Initialize_710; procedure Initialize_711; procedure Initialize_712; procedure Initialize_713; procedure Initialize_714; procedure Initialize_715; procedure Initialize_716; procedure Initialize_717; procedure Initialize_718; procedure Initialize_719; procedure Initialize_720; procedure Initialize_721; procedure Initialize_722; procedure Initialize_723; procedure Initialize_724; procedure Initialize_725; procedure Initialize_726; procedure Initialize_727; procedure Initialize_728; procedure Initialize_729; procedure Initialize_730; procedure Initialize_731; procedure Initialize_732; procedure Initialize_733; procedure Initialize_734; procedure Initialize_735; procedure Initialize_736; procedure Initialize_737; procedure Initialize_738; procedure Initialize_739; procedure Initialize_740; procedure Initialize_741; procedure Initialize_742; procedure Initialize_743; procedure Initialize_744; procedure Initialize_745; procedure Initialize_746; procedure Initialize_747; procedure Initialize_748; procedure Initialize_749; procedure Initialize_750; procedure Initialize_751; procedure Initialize_752; procedure Initialize_753; procedure Initialize_754; procedure Initialize_755; procedure Initialize_756; procedure Initialize_757; procedure Initialize_758; procedure Initialize_759; procedure Initialize_760; procedure Initialize_761; procedure Initialize_762; procedure Initialize_763; procedure Initialize_764; procedure Initialize_765; procedure Initialize_766; procedure Initialize_767; procedure Initialize_768; procedure Initialize_769; procedure Initialize_770; procedure Initialize_771; procedure Initialize_772; procedure Initialize_773; procedure Initialize_774; procedure Initialize_775; procedure Initialize_776; procedure Initialize_777; procedure Initialize_778; procedure Initialize_779; procedure Initialize_780; procedure Initialize_781; procedure Initialize_782; procedure Initialize_783; procedure Initialize_784; procedure Initialize_785; procedure Initialize_786; procedure Initialize_787; procedure Initialize_788; procedure Initialize_789; procedure Initialize_790; procedure Initialize_791; procedure Initialize_792; procedure Initialize_793; procedure Initialize_794; procedure Initialize_795; procedure Initialize_796; procedure Initialize_797; procedure Initialize_798; procedure Initialize_799; procedure Initialize_800; end AMF.Internals.Tables.CMOF_Metamodel.Links;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ package AMF.Internals.Tables.CMOF_Metamodel.Links is procedure Initialize; private procedure Initialize_1; procedure Initialize_2; procedure Initialize_3; procedure Initialize_4; procedure Initialize_5; procedure Initialize_6; procedure Initialize_7; procedure Initialize_8; procedure Initialize_9; procedure Initialize_10; procedure Initialize_11; procedure Initialize_12; procedure Initialize_13; procedure Initialize_14; procedure Initialize_15; procedure Initialize_16; procedure Initialize_17; procedure Initialize_18; procedure Initialize_19; procedure Initialize_20; procedure Initialize_21; procedure Initialize_22; procedure Initialize_23; procedure Initialize_24; procedure Initialize_25; procedure Initialize_26; procedure Initialize_27; procedure Initialize_28; procedure Initialize_29; procedure Initialize_30; procedure Initialize_31; procedure Initialize_32; procedure Initialize_33; procedure Initialize_34; procedure Initialize_35; procedure Initialize_36; procedure Initialize_37; procedure Initialize_38; procedure Initialize_39; procedure Initialize_40; procedure Initialize_41; procedure Initialize_42; procedure Initialize_43; procedure Initialize_44; procedure Initialize_45; procedure Initialize_46; procedure Initialize_47; procedure Initialize_48; procedure Initialize_49; procedure Initialize_50; procedure Initialize_51; procedure Initialize_52; procedure Initialize_53; procedure Initialize_54; procedure Initialize_55; procedure Initialize_56; procedure Initialize_57; procedure Initialize_58; procedure Initialize_59; procedure Initialize_60; procedure Initialize_61; procedure Initialize_62; procedure Initialize_63; procedure Initialize_64; procedure Initialize_65; procedure Initialize_66; procedure Initialize_67; procedure Initialize_68; procedure Initialize_69; procedure Initialize_70; procedure Initialize_71; procedure Initialize_72; procedure Initialize_73; procedure Initialize_74; procedure Initialize_75; procedure Initialize_76; procedure Initialize_77; procedure Initialize_78; procedure Initialize_79; procedure Initialize_80; procedure Initialize_81; procedure Initialize_82; procedure Initialize_83; procedure Initialize_84; procedure Initialize_85; procedure Initialize_86; procedure Initialize_87; procedure Initialize_88; procedure Initialize_89; procedure Initialize_90; procedure Initialize_91; procedure Initialize_92; procedure Initialize_93; procedure Initialize_94; procedure Initialize_95; procedure Initialize_96; procedure Initialize_97; procedure Initialize_98; procedure Initialize_99; procedure Initialize_100; procedure Initialize_101; procedure Initialize_102; procedure Initialize_103; procedure Initialize_104; procedure Initialize_105; procedure Initialize_106; procedure Initialize_107; procedure Initialize_108; procedure Initialize_109; procedure Initialize_110; procedure Initialize_111; procedure Initialize_112; procedure Initialize_113; procedure Initialize_114; procedure Initialize_115; procedure Initialize_116; procedure Initialize_117; procedure Initialize_118; procedure Initialize_119; procedure Initialize_120; procedure Initialize_121; procedure Initialize_122; procedure Initialize_123; procedure Initialize_124; procedure Initialize_125; procedure Initialize_126; procedure Initialize_127; procedure Initialize_128; procedure Initialize_129; procedure Initialize_130; procedure Initialize_131; procedure Initialize_132; procedure Initialize_133; procedure Initialize_134; procedure Initialize_135; procedure Initialize_136; procedure Initialize_137; procedure Initialize_138; procedure Initialize_139; procedure Initialize_140; procedure Initialize_141; procedure Initialize_142; procedure Initialize_143; procedure Initialize_144; procedure Initialize_145; procedure Initialize_146; procedure Initialize_147; procedure Initialize_148; procedure Initialize_149; procedure Initialize_150; procedure Initialize_151; procedure Initialize_152; procedure Initialize_153; procedure Initialize_154; procedure Initialize_155; procedure Initialize_156; procedure Initialize_157; procedure Initialize_158; procedure Initialize_159; procedure Initialize_160; procedure Initialize_161; procedure Initialize_162; procedure Initialize_163; procedure Initialize_164; procedure Initialize_165; procedure Initialize_166; procedure Initialize_167; procedure Initialize_168; procedure Initialize_169; procedure Initialize_170; procedure Initialize_171; procedure Initialize_172; procedure Initialize_173; procedure Initialize_174; procedure Initialize_175; procedure Initialize_176; procedure Initialize_177; procedure Initialize_178; procedure Initialize_179; procedure Initialize_180; procedure Initialize_181; procedure Initialize_182; procedure Initialize_183; procedure Initialize_184; procedure Initialize_185; procedure Initialize_186; procedure Initialize_187; procedure Initialize_188; procedure Initialize_189; procedure Initialize_190; procedure Initialize_191; procedure Initialize_192; procedure Initialize_193; procedure Initialize_194; procedure Initialize_195; procedure Initialize_196; procedure Initialize_197; procedure Initialize_198; procedure Initialize_199; procedure Initialize_200; procedure Initialize_201; procedure Initialize_202; procedure Initialize_203; procedure Initialize_204; procedure Initialize_205; procedure Initialize_206; procedure Initialize_207; procedure Initialize_208; procedure Initialize_209; procedure Initialize_210; procedure Initialize_211; procedure Initialize_212; procedure Initialize_213; procedure Initialize_214; procedure Initialize_215; procedure Initialize_216; procedure Initialize_217; procedure Initialize_218; procedure Initialize_219; procedure Initialize_220; procedure Initialize_221; procedure Initialize_222; procedure Initialize_223; procedure Initialize_224; procedure Initialize_225; procedure Initialize_226; procedure Initialize_227; procedure Initialize_228; procedure Initialize_229; procedure Initialize_230; procedure Initialize_231; procedure Initialize_232; procedure Initialize_233; procedure Initialize_234; procedure Initialize_235; procedure Initialize_236; procedure Initialize_237; procedure Initialize_238; procedure Initialize_239; procedure Initialize_240; procedure Initialize_241; procedure Initialize_242; procedure Initialize_243; procedure Initialize_244; procedure Initialize_245; procedure Initialize_246; procedure Initialize_247; procedure Initialize_248; procedure Initialize_249; procedure Initialize_250; procedure Initialize_251; procedure Initialize_252; procedure Initialize_253; procedure Initialize_254; procedure Initialize_255; procedure Initialize_256; procedure Initialize_257; procedure Initialize_258; procedure Initialize_259; procedure Initialize_260; procedure Initialize_261; procedure Initialize_262; procedure Initialize_263; procedure Initialize_264; procedure Initialize_265; procedure Initialize_266; procedure Initialize_267; procedure Initialize_268; procedure Initialize_269; procedure Initialize_270; procedure Initialize_271; procedure Initialize_272; procedure Initialize_273; procedure Initialize_274; procedure Initialize_275; procedure Initialize_276; procedure Initialize_277; procedure Initialize_278; procedure Initialize_279; procedure Initialize_280; procedure Initialize_281; procedure Initialize_282; procedure Initialize_283; procedure Initialize_284; procedure Initialize_285; procedure Initialize_286; procedure Initialize_287; procedure Initialize_288; procedure Initialize_289; procedure Initialize_290; procedure Initialize_291; procedure Initialize_292; procedure Initialize_293; procedure Initialize_294; procedure Initialize_295; procedure Initialize_296; procedure Initialize_297; procedure Initialize_298; procedure Initialize_299; procedure Initialize_300; procedure Initialize_301; procedure Initialize_302; procedure Initialize_303; procedure Initialize_304; procedure Initialize_305; procedure Initialize_306; procedure Initialize_307; procedure Initialize_308; procedure Initialize_309; procedure Initialize_310; procedure Initialize_311; procedure Initialize_312; procedure Initialize_313; procedure Initialize_314; procedure Initialize_315; procedure Initialize_316; procedure Initialize_317; procedure Initialize_318; procedure Initialize_319; procedure Initialize_320; procedure Initialize_321; procedure Initialize_322; procedure Initialize_323; procedure Initialize_324; procedure Initialize_325; procedure Initialize_326; procedure Initialize_327; procedure Initialize_328; procedure Initialize_329; procedure Initialize_330; procedure Initialize_331; procedure Initialize_332; procedure Initialize_333; procedure Initialize_334; procedure Initialize_335; procedure Initialize_336; procedure Initialize_337; procedure Initialize_338; procedure Initialize_339; procedure Initialize_340; procedure Initialize_341; procedure Initialize_342; procedure Initialize_343; procedure Initialize_344; procedure Initialize_345; procedure Initialize_346; procedure Initialize_347; procedure Initialize_348; procedure Initialize_349; procedure Initialize_350; procedure Initialize_351; procedure Initialize_352; procedure Initialize_353; procedure Initialize_354; procedure Initialize_355; procedure Initialize_356; procedure Initialize_357; procedure Initialize_358; procedure Initialize_359; procedure Initialize_360; procedure Initialize_361; procedure Initialize_362; procedure Initialize_363; procedure Initialize_364; procedure Initialize_365; procedure Initialize_366; procedure Initialize_367; procedure Initialize_368; procedure Initialize_369; procedure Initialize_370; procedure Initialize_371; procedure Initialize_372; procedure Initialize_373; procedure Initialize_374; procedure Initialize_375; procedure Initialize_376; procedure Initialize_377; procedure Initialize_378; procedure Initialize_379; procedure Initialize_380; procedure Initialize_381; procedure Initialize_382; procedure Initialize_383; procedure Initialize_384; procedure Initialize_385; procedure Initialize_386; procedure Initialize_387; procedure Initialize_388; procedure Initialize_389; procedure Initialize_390; procedure Initialize_391; procedure Initialize_392; procedure Initialize_393; procedure Initialize_394; procedure Initialize_395; procedure Initialize_396; procedure Initialize_397; procedure Initialize_398; procedure Initialize_399; procedure Initialize_400; procedure Initialize_401; procedure Initialize_402; procedure Initialize_403; procedure Initialize_404; procedure Initialize_405; procedure Initialize_406; procedure Initialize_407; procedure Initialize_408; procedure Initialize_409; procedure Initialize_410; procedure Initialize_411; procedure Initialize_412; procedure Initialize_413; procedure Initialize_414; procedure Initialize_415; procedure Initialize_416; procedure Initialize_417; procedure Initialize_418; procedure Initialize_419; procedure Initialize_420; procedure Initialize_421; procedure Initialize_422; procedure Initialize_423; procedure Initialize_424; procedure Initialize_425; procedure Initialize_426; procedure Initialize_427; procedure Initialize_428; procedure Initialize_429; procedure Initialize_430; procedure Initialize_431; procedure Initialize_432; procedure Initialize_433; procedure Initialize_434; procedure Initialize_435; procedure Initialize_436; procedure Initialize_437; procedure Initialize_438; procedure Initialize_439; procedure Initialize_440; procedure Initialize_441; procedure Initialize_442; procedure Initialize_443; procedure Initialize_444; procedure Initialize_445; procedure Initialize_446; procedure Initialize_447; procedure Initialize_448; procedure Initialize_449; procedure Initialize_450; procedure Initialize_451; procedure Initialize_452; procedure Initialize_453; procedure Initialize_454; procedure Initialize_455; procedure Initialize_456; procedure Initialize_457; procedure Initialize_458; procedure Initialize_459; procedure Initialize_460; procedure Initialize_461; procedure Initialize_462; procedure Initialize_463; procedure Initialize_464; procedure Initialize_465; procedure Initialize_466; procedure Initialize_467; procedure Initialize_468; procedure Initialize_469; procedure Initialize_470; procedure Initialize_471; procedure Initialize_472; procedure Initialize_473; procedure Initialize_474; procedure Initialize_475; procedure Initialize_476; procedure Initialize_477; procedure Initialize_478; procedure Initialize_479; procedure Initialize_480; procedure Initialize_481; procedure Initialize_482; procedure Initialize_483; procedure Initialize_484; procedure Initialize_485; procedure Initialize_486; procedure Initialize_487; procedure Initialize_488; procedure Initialize_489; procedure Initialize_490; procedure Initialize_491; procedure Initialize_492; procedure Initialize_493; procedure Initialize_494; procedure Initialize_495; procedure Initialize_496; procedure Initialize_497; procedure Initialize_498; procedure Initialize_499; procedure Initialize_500; procedure Initialize_501; procedure Initialize_502; procedure Initialize_503; procedure Initialize_504; procedure Initialize_505; procedure Initialize_506; procedure Initialize_507; procedure Initialize_508; procedure Initialize_509; procedure Initialize_510; procedure Initialize_511; procedure Initialize_512; procedure Initialize_513; procedure Initialize_514; procedure Initialize_515; procedure Initialize_516; procedure Initialize_517; procedure Initialize_518; procedure Initialize_519; procedure Initialize_520; procedure Initialize_521; procedure Initialize_522; procedure Initialize_523; procedure Initialize_524; procedure Initialize_525; procedure Initialize_526; procedure Initialize_527; procedure Initialize_528; procedure Initialize_529; procedure Initialize_530; procedure Initialize_531; procedure Initialize_532; procedure Initialize_533; procedure Initialize_534; procedure Initialize_535; procedure Initialize_536; procedure Initialize_537; procedure Initialize_538; procedure Initialize_539; procedure Initialize_540; procedure Initialize_541; procedure Initialize_542; procedure Initialize_543; procedure Initialize_544; procedure Initialize_545; procedure Initialize_546; procedure Initialize_547; procedure Initialize_548; procedure Initialize_549; procedure Initialize_550; procedure Initialize_551; procedure Initialize_552; procedure Initialize_553; procedure Initialize_554; procedure Initialize_555; procedure Initialize_556; procedure Initialize_557; procedure Initialize_558; procedure Initialize_559; procedure Initialize_560; procedure Initialize_561; procedure Initialize_562; procedure Initialize_563; procedure Initialize_564; procedure Initialize_565; procedure Initialize_566; procedure Initialize_567; procedure Initialize_568; procedure Initialize_569; procedure Initialize_570; procedure Initialize_571; procedure Initialize_572; procedure Initialize_573; procedure Initialize_574; procedure Initialize_575; procedure Initialize_576; procedure Initialize_577; procedure Initialize_578; procedure Initialize_579; procedure Initialize_580; procedure Initialize_581; procedure Initialize_582; procedure Initialize_583; procedure Initialize_584; procedure Initialize_585; procedure Initialize_586; procedure Initialize_587; procedure Initialize_588; procedure Initialize_589; procedure Initialize_590; procedure Initialize_591; procedure Initialize_592; procedure Initialize_593; procedure Initialize_594; procedure Initialize_595; procedure Initialize_596; procedure Initialize_597; procedure Initialize_598; procedure Initialize_599; procedure Initialize_600; procedure Initialize_601; procedure Initialize_602; procedure Initialize_603; procedure Initialize_604; procedure Initialize_605; procedure Initialize_606; procedure Initialize_607; procedure Initialize_608; procedure Initialize_609; procedure Initialize_610; procedure Initialize_611; procedure Initialize_612; procedure Initialize_613; procedure Initialize_614; procedure Initialize_615; procedure Initialize_616; procedure Initialize_617; procedure Initialize_618; procedure Initialize_619; procedure Initialize_620; procedure Initialize_621; procedure Initialize_622; procedure Initialize_623; procedure Initialize_624; procedure Initialize_625; procedure Initialize_626; procedure Initialize_627; procedure Initialize_628; procedure Initialize_629; procedure Initialize_630; procedure Initialize_631; procedure Initialize_632; procedure Initialize_633; procedure Initialize_634; procedure Initialize_635; procedure Initialize_636; procedure Initialize_637; procedure Initialize_638; procedure Initialize_639; procedure Initialize_640; procedure Initialize_641; procedure Initialize_642; procedure Initialize_643; procedure Initialize_644; procedure Initialize_645; procedure Initialize_646; procedure Initialize_647; procedure Initialize_648; procedure Initialize_649; procedure Initialize_650; procedure Initialize_651; procedure Initialize_652; procedure Initialize_653; procedure Initialize_654; procedure Initialize_655; procedure Initialize_656; procedure Initialize_657; procedure Initialize_658; procedure Initialize_659; procedure Initialize_660; procedure Initialize_661; procedure Initialize_662; procedure Initialize_663; procedure Initialize_664; procedure Initialize_665; procedure Initialize_666; procedure Initialize_667; procedure Initialize_668; procedure Initialize_669; procedure Initialize_670; procedure Initialize_671; procedure Initialize_672; procedure Initialize_673; procedure Initialize_674; procedure Initialize_675; procedure Initialize_676; procedure Initialize_677; procedure Initialize_678; procedure Initialize_679; procedure Initialize_680; procedure Initialize_681; procedure Initialize_682; procedure Initialize_683; procedure Initialize_684; procedure Initialize_685; procedure Initialize_686; procedure Initialize_687; procedure Initialize_688; procedure Initialize_689; procedure Initialize_690; procedure Initialize_691; procedure Initialize_692; procedure Initialize_693; procedure Initialize_694; procedure Initialize_695; procedure Initialize_696; procedure Initialize_697; procedure Initialize_698; procedure Initialize_699; procedure Initialize_700; procedure Initialize_701; procedure Initialize_702; procedure Initialize_703; procedure Initialize_704; procedure Initialize_705; procedure Initialize_706; procedure Initialize_707; procedure Initialize_708; procedure Initialize_709; procedure Initialize_710; procedure Initialize_711; procedure Initialize_712; procedure Initialize_713; procedure Initialize_714; procedure Initialize_715; procedure Initialize_716; procedure Initialize_717; procedure Initialize_718; procedure Initialize_719; procedure Initialize_720; procedure Initialize_721; procedure Initialize_722; procedure Initialize_723; procedure Initialize_724; procedure Initialize_725; procedure Initialize_726; procedure Initialize_727; procedure Initialize_728; procedure Initialize_729; procedure Initialize_730; procedure Initialize_731; procedure Initialize_732; procedure Initialize_733; procedure Initialize_734; procedure Initialize_735; procedure Initialize_736; procedure Initialize_737; procedure Initialize_738; procedure Initialize_739; procedure Initialize_740; procedure Initialize_741; procedure Initialize_742; procedure Initialize_743; procedure Initialize_744; procedure Initialize_745; procedure Initialize_746; procedure Initialize_747; procedure Initialize_748; procedure Initialize_749; procedure Initialize_750; procedure Initialize_751; procedure Initialize_752; procedure Initialize_753; procedure Initialize_754; procedure Initialize_755; procedure Initialize_756; procedure Initialize_757; procedure Initialize_758; procedure Initialize_759; procedure Initialize_760; procedure Initialize_761; procedure Initialize_762; procedure Initialize_763; procedure Initialize_764; procedure Initialize_765; procedure Initialize_766; procedure Initialize_767; procedure Initialize_768; procedure Initialize_769; procedure Initialize_770; procedure Initialize_771; procedure Initialize_772; procedure Initialize_773; procedure Initialize_774; procedure Initialize_775; procedure Initialize_776; procedure Initialize_777; procedure Initialize_778; procedure Initialize_779; procedure Initialize_780; procedure Initialize_781; procedure Initialize_782; procedure Initialize_783; procedure Initialize_784; procedure Initialize_785; procedure Initialize_786; procedure Initialize_787; procedure Initialize_788; procedure Initialize_789; procedure Initialize_790; procedure Initialize_791; procedure Initialize_792; procedure Initialize_793; procedure Initialize_794; procedure Initialize_795; procedure Initialize_796; procedure Initialize_797; procedure Initialize_798; procedure Initialize_799; procedure Initialize_800; end AMF.Internals.Tables.CMOF_Metamodel.Links;
[ { "context": "e-Identifier: Apache-2.0\n--\n-- Copyright (c) 2014 Felix Krause <contact@flyx.org>\n-- Copyright (c) 2016 onox <d", "end": 78, "score": 0.9998365640640259, "start": 66, "tag": "NAME", "value": "Felix Krause" }, { "context": "pache-2.0\n--\n-- Copyright (c) 2014 Felix Krause <contact@flyx.org>\n-- Copyright (c) 2016 onox <denkpadje@gmail.com", "end": 96, "score": 0.9999329447746277, "start": 80, "tag": "EMAIL", "value": "contact@flyx.org" }, { "context": "x Krause <contact@flyx.org>\n-- Copyright (c) 2016 onox <denkpadje@gmail.com>\n--\n-- Licensed under the A", "end": 125, "score": 0.9325897097587585, "start": 121, "tag": "USERNAME", "value": "onox" }, { "context": "e <contact@flyx.org>\n-- Copyright (c) 2016 onox <denkpadje@gmail.com>\n--\n-- Licensed under the Apache License, Versio", "end": 146, "score": 0.9999342560768127, "start": 127, "tag": "EMAIL", "value": "denkpadje@gmail.com" } ]
orka/src/gl/interface/gl-types-pointers.ads
onox/orka
52
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2014 Felix Krause <contact@flyx.org> -- Copyright (c) 2016 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Interfaces.C.Pointers; package GL.Types.Pointers is pragma Preelaborate; -- Pointer types (for use with data transfer functions) package Byte_Pointers is new Interfaces.C.Pointers (Size, Byte, Byte_Array, Byte'Last); package Short_Pointers is new Interfaces.C.Pointers (Size, Short, Short_Array, Short'Last); package Int_Pointers is new Interfaces.C.Pointers (Size, Int, Int_Array, Int'Last); package UByte_Pointers is new Interfaces.C.Pointers (Size, UByte, UByte_Array, UByte'Last); package UShort_Pointers is new Interfaces.C.Pointers (Size, UShort, UShort_Array, UShort'Last); package UInt_Pointers is new Interfaces.C.Pointers (Size, UInt, UInt_Array, UInt'Last); package Half_Pointers is new Interfaces.C.Pointers (Size, Half, Half_Array, 0); package Single_Pointers is new Interfaces.C.Pointers (Size, Single, Single_Array, 0.0); package Double_Pointers is new Interfaces.C.Pointers (Size, Double, Double_Array, 0.0); type String_Access is not null access constant String; type String_Array is array (Positive range <>) of String_Access; type UByte_Array_Access is access UByte_Array; end GL.Types.Pointers;
15434
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2014 <NAME> <<EMAIL>> -- Copyright (c) 2016 onox <<EMAIL>> -- -- 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.Pointers; package GL.Types.Pointers is pragma Preelaborate; -- Pointer types (for use with data transfer functions) package Byte_Pointers is new Interfaces.C.Pointers (Size, Byte, Byte_Array, Byte'Last); package Short_Pointers is new Interfaces.C.Pointers (Size, Short, Short_Array, Short'Last); package Int_Pointers is new Interfaces.C.Pointers (Size, Int, Int_Array, Int'Last); package UByte_Pointers is new Interfaces.C.Pointers (Size, UByte, UByte_Array, UByte'Last); package UShort_Pointers is new Interfaces.C.Pointers (Size, UShort, UShort_Array, UShort'Last); package UInt_Pointers is new Interfaces.C.Pointers (Size, UInt, UInt_Array, UInt'Last); package Half_Pointers is new Interfaces.C.Pointers (Size, Half, Half_Array, 0); package Single_Pointers is new Interfaces.C.Pointers (Size, Single, Single_Array, 0.0); package Double_Pointers is new Interfaces.C.Pointers (Size, Double, Double_Array, 0.0); type String_Access is not null access constant String; type String_Array is array (Positive range <>) of String_Access; type UByte_Array_Access is access UByte_Array; end GL.Types.Pointers;
true
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2014 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- Copyright (c) 2016 onox <PI:EMAIL:<EMAIL>END_PI> -- -- 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.Pointers; package GL.Types.Pointers is pragma Preelaborate; -- Pointer types (for use with data transfer functions) package Byte_Pointers is new Interfaces.C.Pointers (Size, Byte, Byte_Array, Byte'Last); package Short_Pointers is new Interfaces.C.Pointers (Size, Short, Short_Array, Short'Last); package Int_Pointers is new Interfaces.C.Pointers (Size, Int, Int_Array, Int'Last); package UByte_Pointers is new Interfaces.C.Pointers (Size, UByte, UByte_Array, UByte'Last); package UShort_Pointers is new Interfaces.C.Pointers (Size, UShort, UShort_Array, UShort'Last); package UInt_Pointers is new Interfaces.C.Pointers (Size, UInt, UInt_Array, UInt'Last); package Half_Pointers is new Interfaces.C.Pointers (Size, Half, Half_Array, 0); package Single_Pointers is new Interfaces.C.Pointers (Size, Single, Single_Array, 0.0); package Double_Pointers is new Interfaces.C.Pointers (Size, Double, Double_Array, 0.0); type String_Access is not null access constant String; type String_Array is array (Positive range <>) of String_Access; type UByte_Array_Access is access UByte_Array; end GL.Types.Pointers;
[ { "context": " password => password,\n get_new_", "end": 4208, "score": 0.9994070529937744, "start": 4200, "tag": "PASSWORD", "value": "password" }, { "context": " get_new_password => null,\n hint ", "end": 4278, "score": 0.9854855537414551, "start": 4274, "tag": "PASSWORD", "value": "null" }, { "context": " : String := \"\"; -- Decryption password\n Case_sensitive : Boole", "end": 10112, "score": 0.5880551934242249, "start": 10104, "tag": "PASSWORD", "value": "password" } ]
Sources/Globe_3d/unzip/unzip-streams.adb
ForYouEyesOnly/Space-Convoy
1
with Zip.Headers, UnZip.Decompress; with Ada.Strings.Unbounded; with Ada.Unchecked_Deallocation; with Interfaces; use Interfaces; package body UnZip.Streams is procedure Dispose is new Ada.Unchecked_Deallocation (String, p_String); procedure Dispose is new Ada.Unchecked_Deallocation (Ada.Streams.Stream_Element_Array, p_Stream_Element_Array); procedure Dispose is new Ada.Unchecked_Deallocation (UnZip_Stream_Type, Zipped_File_Type); -------------------------------------------------- -- *The* internal 1 - file unzipping procedure. -- -- Input must be _open_ and won't be _closed_ ! -- -------------------------------------------------- procedure UnZipFile (zip_file : Zip_Streams.Zipstream_Class; header_index : in out Ada.Streams.Stream_IO.Positive_Count; mem_ptr : out p_Stream_Element_Array; password : in out Ada.Strings.Unbounded.Unbounded_String; hint_comp_size : File_size_type; -- Added 2007 for .ODS files cat_uncomp_size : File_size_type) is work_index : Ada.Streams.Stream_IO.Positive_Count := header_index; local_header : Zip.Headers.Local_File_Header; data_descriptor_present : Boolean; encrypted : Boolean; method : PKZip_method; use Ada.Streams.Stream_IO, Zip, Zip_Streams; begin begin Zip_Streams.Set_Index (zip_file, Positive (header_index)); declare TempStream : constant Zipstream_Class := zip_file; begin Zip.Headers.Read_and_check (TempStream, local_header); end; exception when Zip.Headers.bad_local_header => raise; when others => raise Read_Error; end; method := Method_from_code (local_header.zip_type); if method = unknown then raise Unsupported_method; end if; -- calculate offset of data work_index := work_index + Ada.Streams.Stream_IO.Count ( local_header.filename_length + local_header.extra_field_length + Zip.Headers.local_header_length ); data_descriptor_present := (local_header.bit_flag and 8) /= 0; if data_descriptor_present then -- Sizes and crc are after the data local_header.dd.crc_32 := 0; local_header.dd.uncompressed_size := cat_uncomp_size; local_header.dd.compressed_size := hint_comp_size; else -- Sizes and crc are before the data if cat_uncomp_size /= local_header.dd.uncompressed_size then raise Uncompressed_size_Error; end if; end if; encrypted := (local_header.bit_flag and 1) /= 0; begin Zip_Streams.Set_Index (zip_file, Positive (work_index)); -- eventually skips the file name exception when others => raise Read_Error; end; -- Unzip correct type UnZip.Decompress.Decompress_data ( zip_file => zip_file, format => method, mode => write_to_memory, output_file_name => "", output_memory_access => mem_ptr, feedback => null, explode_literal_tree => (local_header.bit_flag and 4) /= 0, explode_slide_8KB => (local_header.bit_flag and 2) /= 0, end_data_descriptor => data_descriptor_present, encrypted => encrypted, password => password, get_new_password => null, hint => local_header.dd ); -- Set the offset on the next zipped file header_index := header_index + Count ( File_size_type ( local_header.filename_length + local_header.extra_field_length + Zip.Headers.local_header_length ) + local_header.dd.compressed_size ); if data_descriptor_present then header_index := header_index + Count (Zip.Headers.data_descriptor_length); end if; end UnZipFile; use Ada.Streams.Stream_IO; procedure S_Extract (from : Zip.Zip_info; Zip_Stream : Zip_Streams.Zipstream_Class; what : String; mem_ptr : out p_Stream_Element_Array; Password : String; Case_sensitive : Boolean) is header_index : Positive_Count; comp_size : File_size_type; uncomp_size : File_size_type; work_password : Ada.Strings.Unbounded.Unbounded_String := Ada.Strings.Unbounded.To_Unbounded_String (Password); begin Zip.Find_offset (from, what, Case_sensitive, header_index, comp_size, uncomp_size); UnZipFile (Zip_Stream, header_index, mem_ptr, work_password, comp_size, uncomp_size); pragma Unreferenced (header_index, work_password); end S_Extract; -------------------- for exportation: procedure Close (File : in out Zipped_File_Type) is begin if File = null or else File.all.state = uninitialized then raise Use_Error; end if; if File.all.delete_info_on_closing then Zip.Delete (File.all.archive_info); end if; Dispose (File.all.file_name); Dispose (File.all.Uncompressed); Dispose (File); File := null; end Close; function Is_Open (File : Zipped_File_Type) return Boolean is (File /= null and then File.all.state /= uninitialized); function End_Of_File (File : Zipped_File_Type) return Boolean is begin if File = null or else File.all.state = uninitialized then raise Use_Error; end if; return File.all.state = end_of_zip; end End_Of_File; procedure Open (File : in out Zipped_File_Type; -- File - in - archive handle Archive_Info : Zip.Zip_info; -- loaded by Load_zip_info Name : String; -- Name of zipped entry Password : String := ""; -- Decryption password Case_sensitive : Boolean := False) is use Zip_Streams, Ada.Streams; MyStream : aliased File_Zipstream; input_stream : Zipstream_Class; use_a_file : constant Boolean := Zip.Zip_Stream (Archive_Info) = null; begin if File = null then File := new UnZip_Stream_Type; elsif File.all.state /= uninitialized then -- forgot to close last time! raise Use_Error; end if; if use_a_file then input_stream := MyStream'Unchecked_Access; Set_Name (input_stream, Zip.Zip_name (Archive_Info)); Open (MyStream, Ada.Streams.Stream_IO.In_File); else -- use the given stream input_stream := Zip.Zip_Stream (Archive_Info); end if; -- File.all.archive_info := Archive_Info; File.all.file_name := new String'(Name); begin S_Extract ( File.all.archive_info, input_stream, Name, File.all.Uncompressed, Password, Case_sensitive ); if use_a_file then Close (MyStream); end if; exception when others => if use_a_file then Close (MyStream); end if; raise; end; File.all.index := File.all.Uncompressed'First; File.all.state := data_uncompressed; -- Bug fix for data of size 0 - 29 - Nov - 2002 if File.all.Uncompressed'Last < File.all.index then -- (1 .. 0) array File.all.state := end_of_zip; end if; File.all.delete_info_on_closing := False; -- Close won't delete dir tree -- Bug fix 1 - Mar - 2007 : False was set only at initialization end Open; procedure Open (File : in out Zipped_File_Type; -- File - in - archive handle Archive_Name : String; -- Name of archive file Name : String; -- Name of zipped entry Password : String := ""; -- Decryption password Case_sensitive : Boolean := False) is temp_info : Zip.Zip_info; -- this local record (but not the full tree) is copied by Open ( .. ) begin Zip.Load (temp_info, Archive_Name, Case_sensitive); Open (File, temp_info, Name, Password, Case_sensitive); File.all.delete_info_on_closing := True; -- Close will delete temp. dir tree end Open; procedure Open (File : in out Zipped_File_Type; -- File - in - archive handle Archive_Stream : Zip_Streams.Zipstream_Class; -- Archive's stream Name : String; -- Name of zipped entry Password : String := ""; -- Decryption password Case_sensitive : Boolean := False) is temp_info : Zip.Zip_info; -- this local record (but not the full tree) is copied by Open ( .. ) begin Zip.Load (temp_info, Archive_Stream, Case_sensitive); Open (File, temp_info, Name, Password, Case_sensitive); File.all.delete_info_on_closing := True; -- Close will delete temp. dir tree end Open; ------------------------------------------ -- Read procedure for Unzip_Stream_Type -- ------------------------------------------ overriding procedure Read (UnZip_Stream : in out UnZip_Stream_Type; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is use Ada.Streams; begin if UnZip_Stream.state = uninitialized then raise Use_Error; end if; if UnZip_Stream.state = end_of_zip then -- Zero transfer - > Last := Item'First - 1, see RM 13.13.1 (8) -- No End_Error here, T'Read will raise it : RM 13.13.2 (37) if Item'First > Stream_Element_Offset'First then Last := Item'First - 1; return; else -- Well, we cannot return Item'First - 1 .. . raise Constraint_Error; -- RM 13.13.1 (11) requires this. end if; end if; if Item'Length = 0 then -- Nothing to be read actually. Last := Item'Last; -- this is < Item'First return; end if; -- From now on, we can assume Item'Length > 0. if UnZip_Stream.index + Item'Length <= UnZip_Stream.Uncompressed'Last then -- * Normal case : even after reading, the index will be in the range Last := Item'Last; Item := UnZip_Stream.Uncompressed.all (UnZip_Stream.index .. UnZip_Stream.index + Item'Length - 1); UnZip_Stream.index := UnZip_Stream.index + Item'Length; -- Now : Stream.index <= Stream.uncompressed'Last, -- then at least one element is left to be read, end_of_zip not possible else -- * Special case : we exhaust the buffer Last := Item'First + (UnZip_Stream.Uncompressed'Last - UnZip_Stream.index); Item (Item'First .. Last) := UnZip_Stream.Uncompressed.all (UnZip_Stream.index .. UnZip_Stream.Uncompressed'Last); UnZip_Stream.state := end_of_zip; -- If Last < Item'Last, the T'Read attribute raises End_Error -- because of the incomplete reading. end if; end Read; function Stream (File : Zipped_File_Type) return Stream_Access is (Stream_Access (File)); overriding procedure Write (UnZip_Stream : in out UnZip_Stream_Type; Item : Ada.Streams.Stream_Element_Array) is write_not_supported : exception; begin raise write_not_supported; end Write; end UnZip.Streams;
11413
with Zip.Headers, UnZip.Decompress; with Ada.Strings.Unbounded; with Ada.Unchecked_Deallocation; with Interfaces; use Interfaces; package body UnZip.Streams is procedure Dispose is new Ada.Unchecked_Deallocation (String, p_String); procedure Dispose is new Ada.Unchecked_Deallocation (Ada.Streams.Stream_Element_Array, p_Stream_Element_Array); procedure Dispose is new Ada.Unchecked_Deallocation (UnZip_Stream_Type, Zipped_File_Type); -------------------------------------------------- -- *The* internal 1 - file unzipping procedure. -- -- Input must be _open_ and won't be _closed_ ! -- -------------------------------------------------- procedure UnZipFile (zip_file : Zip_Streams.Zipstream_Class; header_index : in out Ada.Streams.Stream_IO.Positive_Count; mem_ptr : out p_Stream_Element_Array; password : in out Ada.Strings.Unbounded.Unbounded_String; hint_comp_size : File_size_type; -- Added 2007 for .ODS files cat_uncomp_size : File_size_type) is work_index : Ada.Streams.Stream_IO.Positive_Count := header_index; local_header : Zip.Headers.Local_File_Header; data_descriptor_present : Boolean; encrypted : Boolean; method : PKZip_method; use Ada.Streams.Stream_IO, Zip, Zip_Streams; begin begin Zip_Streams.Set_Index (zip_file, Positive (header_index)); declare TempStream : constant Zipstream_Class := zip_file; begin Zip.Headers.Read_and_check (TempStream, local_header); end; exception when Zip.Headers.bad_local_header => raise; when others => raise Read_Error; end; method := Method_from_code (local_header.zip_type); if method = unknown then raise Unsupported_method; end if; -- calculate offset of data work_index := work_index + Ada.Streams.Stream_IO.Count ( local_header.filename_length + local_header.extra_field_length + Zip.Headers.local_header_length ); data_descriptor_present := (local_header.bit_flag and 8) /= 0; if data_descriptor_present then -- Sizes and crc are after the data local_header.dd.crc_32 := 0; local_header.dd.uncompressed_size := cat_uncomp_size; local_header.dd.compressed_size := hint_comp_size; else -- Sizes and crc are before the data if cat_uncomp_size /= local_header.dd.uncompressed_size then raise Uncompressed_size_Error; end if; end if; encrypted := (local_header.bit_flag and 1) /= 0; begin Zip_Streams.Set_Index (zip_file, Positive (work_index)); -- eventually skips the file name exception when others => raise Read_Error; end; -- Unzip correct type UnZip.Decompress.Decompress_data ( zip_file => zip_file, format => method, mode => write_to_memory, output_file_name => "", output_memory_access => mem_ptr, feedback => null, explode_literal_tree => (local_header.bit_flag and 4) /= 0, explode_slide_8KB => (local_header.bit_flag and 2) /= 0, end_data_descriptor => data_descriptor_present, encrypted => encrypted, password => <PASSWORD>, get_new_password => <PASSWORD>, hint => local_header.dd ); -- Set the offset on the next zipped file header_index := header_index + Count ( File_size_type ( local_header.filename_length + local_header.extra_field_length + Zip.Headers.local_header_length ) + local_header.dd.compressed_size ); if data_descriptor_present then header_index := header_index + Count (Zip.Headers.data_descriptor_length); end if; end UnZipFile; use Ada.Streams.Stream_IO; procedure S_Extract (from : Zip.Zip_info; Zip_Stream : Zip_Streams.Zipstream_Class; what : String; mem_ptr : out p_Stream_Element_Array; Password : String; Case_sensitive : Boolean) is header_index : Positive_Count; comp_size : File_size_type; uncomp_size : File_size_type; work_password : Ada.Strings.Unbounded.Unbounded_String := Ada.Strings.Unbounded.To_Unbounded_String (Password); begin Zip.Find_offset (from, what, Case_sensitive, header_index, comp_size, uncomp_size); UnZipFile (Zip_Stream, header_index, mem_ptr, work_password, comp_size, uncomp_size); pragma Unreferenced (header_index, work_password); end S_Extract; -------------------- for exportation: procedure Close (File : in out Zipped_File_Type) is begin if File = null or else File.all.state = uninitialized then raise Use_Error; end if; if File.all.delete_info_on_closing then Zip.Delete (File.all.archive_info); end if; Dispose (File.all.file_name); Dispose (File.all.Uncompressed); Dispose (File); File := null; end Close; function Is_Open (File : Zipped_File_Type) return Boolean is (File /= null and then File.all.state /= uninitialized); function End_Of_File (File : Zipped_File_Type) return Boolean is begin if File = null or else File.all.state = uninitialized then raise Use_Error; end if; return File.all.state = end_of_zip; end End_Of_File; procedure Open (File : in out Zipped_File_Type; -- File - in - archive handle Archive_Info : Zip.Zip_info; -- loaded by Load_zip_info Name : String; -- Name of zipped entry Password : String := ""; -- Decryption password Case_sensitive : Boolean := False) is use Zip_Streams, Ada.Streams; MyStream : aliased File_Zipstream; input_stream : Zipstream_Class; use_a_file : constant Boolean := Zip.Zip_Stream (Archive_Info) = null; begin if File = null then File := new UnZip_Stream_Type; elsif File.all.state /= uninitialized then -- forgot to close last time! raise Use_Error; end if; if use_a_file then input_stream := MyStream'Unchecked_Access; Set_Name (input_stream, Zip.Zip_name (Archive_Info)); Open (MyStream, Ada.Streams.Stream_IO.In_File); else -- use the given stream input_stream := Zip.Zip_Stream (Archive_Info); end if; -- File.all.archive_info := Archive_Info; File.all.file_name := new String'(Name); begin S_Extract ( File.all.archive_info, input_stream, Name, File.all.Uncompressed, Password, Case_sensitive ); if use_a_file then Close (MyStream); end if; exception when others => if use_a_file then Close (MyStream); end if; raise; end; File.all.index := File.all.Uncompressed'First; File.all.state := data_uncompressed; -- Bug fix for data of size 0 - 29 - Nov - 2002 if File.all.Uncompressed'Last < File.all.index then -- (1 .. 0) array File.all.state := end_of_zip; end if; File.all.delete_info_on_closing := False; -- Close won't delete dir tree -- Bug fix 1 - Mar - 2007 : False was set only at initialization end Open; procedure Open (File : in out Zipped_File_Type; -- File - in - archive handle Archive_Name : String; -- Name of archive file Name : String; -- Name of zipped entry Password : String := ""; -- Decryption password Case_sensitive : Boolean := False) is temp_info : Zip.Zip_info; -- this local record (but not the full tree) is copied by Open ( .. ) begin Zip.Load (temp_info, Archive_Name, Case_sensitive); Open (File, temp_info, Name, Password, Case_sensitive); File.all.delete_info_on_closing := True; -- Close will delete temp. dir tree end Open; procedure Open (File : in out Zipped_File_Type; -- File - in - archive handle Archive_Stream : Zip_Streams.Zipstream_Class; -- Archive's stream Name : String; -- Name of zipped entry Password : String := ""; -- Decryption <PASSWORD> Case_sensitive : Boolean := False) is temp_info : Zip.Zip_info; -- this local record (but not the full tree) is copied by Open ( .. ) begin Zip.Load (temp_info, Archive_Stream, Case_sensitive); Open (File, temp_info, Name, Password, Case_sensitive); File.all.delete_info_on_closing := True; -- Close will delete temp. dir tree end Open; ------------------------------------------ -- Read procedure for Unzip_Stream_Type -- ------------------------------------------ overriding procedure Read (UnZip_Stream : in out UnZip_Stream_Type; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is use Ada.Streams; begin if UnZip_Stream.state = uninitialized then raise Use_Error; end if; if UnZip_Stream.state = end_of_zip then -- Zero transfer - > Last := Item'First - 1, see RM 13.13.1 (8) -- No End_Error here, T'Read will raise it : RM 13.13.2 (37) if Item'First > Stream_Element_Offset'First then Last := Item'First - 1; return; else -- Well, we cannot return Item'First - 1 .. . raise Constraint_Error; -- RM 13.13.1 (11) requires this. end if; end if; if Item'Length = 0 then -- Nothing to be read actually. Last := Item'Last; -- this is < Item'First return; end if; -- From now on, we can assume Item'Length > 0. if UnZip_Stream.index + Item'Length <= UnZip_Stream.Uncompressed'Last then -- * Normal case : even after reading, the index will be in the range Last := Item'Last; Item := UnZip_Stream.Uncompressed.all (UnZip_Stream.index .. UnZip_Stream.index + Item'Length - 1); UnZip_Stream.index := UnZip_Stream.index + Item'Length; -- Now : Stream.index <= Stream.uncompressed'Last, -- then at least one element is left to be read, end_of_zip not possible else -- * Special case : we exhaust the buffer Last := Item'First + (UnZip_Stream.Uncompressed'Last - UnZip_Stream.index); Item (Item'First .. Last) := UnZip_Stream.Uncompressed.all (UnZip_Stream.index .. UnZip_Stream.Uncompressed'Last); UnZip_Stream.state := end_of_zip; -- If Last < Item'Last, the T'Read attribute raises End_Error -- because of the incomplete reading. end if; end Read; function Stream (File : Zipped_File_Type) return Stream_Access is (Stream_Access (File)); overriding procedure Write (UnZip_Stream : in out UnZip_Stream_Type; Item : Ada.Streams.Stream_Element_Array) is write_not_supported : exception; begin raise write_not_supported; end Write; end UnZip.Streams;
true
with Zip.Headers, UnZip.Decompress; with Ada.Strings.Unbounded; with Ada.Unchecked_Deallocation; with Interfaces; use Interfaces; package body UnZip.Streams is procedure Dispose is new Ada.Unchecked_Deallocation (String, p_String); procedure Dispose is new Ada.Unchecked_Deallocation (Ada.Streams.Stream_Element_Array, p_Stream_Element_Array); procedure Dispose is new Ada.Unchecked_Deallocation (UnZip_Stream_Type, Zipped_File_Type); -------------------------------------------------- -- *The* internal 1 - file unzipping procedure. -- -- Input must be _open_ and won't be _closed_ ! -- -------------------------------------------------- procedure UnZipFile (zip_file : Zip_Streams.Zipstream_Class; header_index : in out Ada.Streams.Stream_IO.Positive_Count; mem_ptr : out p_Stream_Element_Array; password : in out Ada.Strings.Unbounded.Unbounded_String; hint_comp_size : File_size_type; -- Added 2007 for .ODS files cat_uncomp_size : File_size_type) is work_index : Ada.Streams.Stream_IO.Positive_Count := header_index; local_header : Zip.Headers.Local_File_Header; data_descriptor_present : Boolean; encrypted : Boolean; method : PKZip_method; use Ada.Streams.Stream_IO, Zip, Zip_Streams; begin begin Zip_Streams.Set_Index (zip_file, Positive (header_index)); declare TempStream : constant Zipstream_Class := zip_file; begin Zip.Headers.Read_and_check (TempStream, local_header); end; exception when Zip.Headers.bad_local_header => raise; when others => raise Read_Error; end; method := Method_from_code (local_header.zip_type); if method = unknown then raise Unsupported_method; end if; -- calculate offset of data work_index := work_index + Ada.Streams.Stream_IO.Count ( local_header.filename_length + local_header.extra_field_length + Zip.Headers.local_header_length ); data_descriptor_present := (local_header.bit_flag and 8) /= 0; if data_descriptor_present then -- Sizes and crc are after the data local_header.dd.crc_32 := 0; local_header.dd.uncompressed_size := cat_uncomp_size; local_header.dd.compressed_size := hint_comp_size; else -- Sizes and crc are before the data if cat_uncomp_size /= local_header.dd.uncompressed_size then raise Uncompressed_size_Error; end if; end if; encrypted := (local_header.bit_flag and 1) /= 0; begin Zip_Streams.Set_Index (zip_file, Positive (work_index)); -- eventually skips the file name exception when others => raise Read_Error; end; -- Unzip correct type UnZip.Decompress.Decompress_data ( zip_file => zip_file, format => method, mode => write_to_memory, output_file_name => "", output_memory_access => mem_ptr, feedback => null, explode_literal_tree => (local_header.bit_flag and 4) /= 0, explode_slide_8KB => (local_header.bit_flag and 2) /= 0, end_data_descriptor => data_descriptor_present, encrypted => encrypted, password => PI:PASSWORD:<PASSWORD>END_PI, get_new_password => PI:PASSWORD:<PASSWORD>END_PI, hint => local_header.dd ); -- Set the offset on the next zipped file header_index := header_index + Count ( File_size_type ( local_header.filename_length + local_header.extra_field_length + Zip.Headers.local_header_length ) + local_header.dd.compressed_size ); if data_descriptor_present then header_index := header_index + Count (Zip.Headers.data_descriptor_length); end if; end UnZipFile; use Ada.Streams.Stream_IO; procedure S_Extract (from : Zip.Zip_info; Zip_Stream : Zip_Streams.Zipstream_Class; what : String; mem_ptr : out p_Stream_Element_Array; Password : String; Case_sensitive : Boolean) is header_index : Positive_Count; comp_size : File_size_type; uncomp_size : File_size_type; work_password : Ada.Strings.Unbounded.Unbounded_String := Ada.Strings.Unbounded.To_Unbounded_String (Password); begin Zip.Find_offset (from, what, Case_sensitive, header_index, comp_size, uncomp_size); UnZipFile (Zip_Stream, header_index, mem_ptr, work_password, comp_size, uncomp_size); pragma Unreferenced (header_index, work_password); end S_Extract; -------------------- for exportation: procedure Close (File : in out Zipped_File_Type) is begin if File = null or else File.all.state = uninitialized then raise Use_Error; end if; if File.all.delete_info_on_closing then Zip.Delete (File.all.archive_info); end if; Dispose (File.all.file_name); Dispose (File.all.Uncompressed); Dispose (File); File := null; end Close; function Is_Open (File : Zipped_File_Type) return Boolean is (File /= null and then File.all.state /= uninitialized); function End_Of_File (File : Zipped_File_Type) return Boolean is begin if File = null or else File.all.state = uninitialized then raise Use_Error; end if; return File.all.state = end_of_zip; end End_Of_File; procedure Open (File : in out Zipped_File_Type; -- File - in - archive handle Archive_Info : Zip.Zip_info; -- loaded by Load_zip_info Name : String; -- Name of zipped entry Password : String := ""; -- Decryption password Case_sensitive : Boolean := False) is use Zip_Streams, Ada.Streams; MyStream : aliased File_Zipstream; input_stream : Zipstream_Class; use_a_file : constant Boolean := Zip.Zip_Stream (Archive_Info) = null; begin if File = null then File := new UnZip_Stream_Type; elsif File.all.state /= uninitialized then -- forgot to close last time! raise Use_Error; end if; if use_a_file then input_stream := MyStream'Unchecked_Access; Set_Name (input_stream, Zip.Zip_name (Archive_Info)); Open (MyStream, Ada.Streams.Stream_IO.In_File); else -- use the given stream input_stream := Zip.Zip_Stream (Archive_Info); end if; -- File.all.archive_info := Archive_Info; File.all.file_name := new String'(Name); begin S_Extract ( File.all.archive_info, input_stream, Name, File.all.Uncompressed, Password, Case_sensitive ); if use_a_file then Close (MyStream); end if; exception when others => if use_a_file then Close (MyStream); end if; raise; end; File.all.index := File.all.Uncompressed'First; File.all.state := data_uncompressed; -- Bug fix for data of size 0 - 29 - Nov - 2002 if File.all.Uncompressed'Last < File.all.index then -- (1 .. 0) array File.all.state := end_of_zip; end if; File.all.delete_info_on_closing := False; -- Close won't delete dir tree -- Bug fix 1 - Mar - 2007 : False was set only at initialization end Open; procedure Open (File : in out Zipped_File_Type; -- File - in - archive handle Archive_Name : String; -- Name of archive file Name : String; -- Name of zipped entry Password : String := ""; -- Decryption password Case_sensitive : Boolean := False) is temp_info : Zip.Zip_info; -- this local record (but not the full tree) is copied by Open ( .. ) begin Zip.Load (temp_info, Archive_Name, Case_sensitive); Open (File, temp_info, Name, Password, Case_sensitive); File.all.delete_info_on_closing := True; -- Close will delete temp. dir tree end Open; procedure Open (File : in out Zipped_File_Type; -- File - in - archive handle Archive_Stream : Zip_Streams.Zipstream_Class; -- Archive's stream Name : String; -- Name of zipped entry Password : String := ""; -- Decryption PI:PASSWORD:<PASSWORD>END_PI Case_sensitive : Boolean := False) is temp_info : Zip.Zip_info; -- this local record (but not the full tree) is copied by Open ( .. ) begin Zip.Load (temp_info, Archive_Stream, Case_sensitive); Open (File, temp_info, Name, Password, Case_sensitive); File.all.delete_info_on_closing := True; -- Close will delete temp. dir tree end Open; ------------------------------------------ -- Read procedure for Unzip_Stream_Type -- ------------------------------------------ overriding procedure Read (UnZip_Stream : in out UnZip_Stream_Type; Item : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is use Ada.Streams; begin if UnZip_Stream.state = uninitialized then raise Use_Error; end if; if UnZip_Stream.state = end_of_zip then -- Zero transfer - > Last := Item'First - 1, see RM 13.13.1 (8) -- No End_Error here, T'Read will raise it : RM 13.13.2 (37) if Item'First > Stream_Element_Offset'First then Last := Item'First - 1; return; else -- Well, we cannot return Item'First - 1 .. . raise Constraint_Error; -- RM 13.13.1 (11) requires this. end if; end if; if Item'Length = 0 then -- Nothing to be read actually. Last := Item'Last; -- this is < Item'First return; end if; -- From now on, we can assume Item'Length > 0. if UnZip_Stream.index + Item'Length <= UnZip_Stream.Uncompressed'Last then -- * Normal case : even after reading, the index will be in the range Last := Item'Last; Item := UnZip_Stream.Uncompressed.all (UnZip_Stream.index .. UnZip_Stream.index + Item'Length - 1); UnZip_Stream.index := UnZip_Stream.index + Item'Length; -- Now : Stream.index <= Stream.uncompressed'Last, -- then at least one element is left to be read, end_of_zip not possible else -- * Special case : we exhaust the buffer Last := Item'First + (UnZip_Stream.Uncompressed'Last - UnZip_Stream.index); Item (Item'First .. Last) := UnZip_Stream.Uncompressed.all (UnZip_Stream.index .. UnZip_Stream.Uncompressed'Last); UnZip_Stream.state := end_of_zip; -- If Last < Item'Last, the T'Read attribute raises End_Error -- because of the incomplete reading. end if; end Read; function Stream (File : Zipped_File_Type) return Stream_Access is (Stream_Access (File)); overriding procedure Write (UnZip_Stream : in out UnZip_Stream_Type; Item : Ada.Streams.Stream_Element_Array) is write_not_supported : exception; begin raise write_not_supported; end Write; end UnZip.Streams;
[ { "context": " --\n-- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com> --\n-- Al", "end": 824, "score": 0.9998922944068909, "start": 811, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com> --\n-- All rights reserved. ", "end": 844, "score": 0.9999322891235352, "start": 826, "tag": "EMAIL", "value": "vgodunko@gmail.com" }, { "context": " --\n-- * Neither the name of the Vadim Godunko, IE nor the names of its --\n-- contribu", "end": 1939, "score": 0.9913537502288818, "start": 1926, "tag": "NAME", "value": "Vadim Godunko" } ]
source/xml/sax/matreshka-internals-sax_locators.ads
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This package provides abstract root type to implement SAX Locator for the -- specific reader. XML.SAX.Locators.SAX_Locator provides capability to wrap -- reader specific locator and to access its attributes. -- -- For perforamnce reasons, internal locator provides trampoline to access -- reader's internal data structures, thus locator should not be updated -- each time when user callback is called. ------------------------------------------------------------------------------ with League.IRIs; with League.Strings; with Matreshka.Atomics.Counters; package Matreshka.Internals.SAX_Locators is pragma Preelaborate; type Shared_Abstract_Locator is abstract tagged limited record Counter : Matreshka.Atomics.Counters.Counter; end record; not overriding function Line (Self : not null access constant Shared_Abstract_Locator) return Natural is abstract; not overriding function Column (Self : not null access constant Shared_Abstract_Locator) return Natural is abstract; not overriding function Encoding (Self : not null access constant Shared_Abstract_Locator) return League.Strings.Universal_String is abstract; not overriding function Version (Self : not null access constant Shared_Abstract_Locator) return League.Strings.Universal_String is abstract; not overriding function Public_Id (Self : not null access constant Shared_Abstract_Locator) return League.Strings.Universal_String is abstract; not overriding function System_Id (Self : not null access constant Shared_Abstract_Locator) return League.Strings.Universal_String is abstract; not overriding function Base_URI (Self : not null access constant Shared_Abstract_Locator) return League.IRIs.IRI is abstract; type Shared_Locator_Access is access all Shared_Abstract_Locator'Class; procedure Reference (Self : not null Shared_Locator_Access); pragma Inline (Reference); procedure Dereference (Self : in out Shared_Locator_Access); end Matreshka.Internals.SAX_Locators;
15044
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, <NAME> <<EMAIL>> -- -- 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 <NAME>, 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 abstract root type to implement SAX Locator for the -- specific reader. XML.SAX.Locators.SAX_Locator provides capability to wrap -- reader specific locator and to access its attributes. -- -- For perforamnce reasons, internal locator provides trampoline to access -- reader's internal data structures, thus locator should not be updated -- each time when user callback is called. ------------------------------------------------------------------------------ with League.IRIs; with League.Strings; with Matreshka.Atomics.Counters; package Matreshka.Internals.SAX_Locators is pragma Preelaborate; type Shared_Abstract_Locator is abstract tagged limited record Counter : Matreshka.Atomics.Counters.Counter; end record; not overriding function Line (Self : not null access constant Shared_Abstract_Locator) return Natural is abstract; not overriding function Column (Self : not null access constant Shared_Abstract_Locator) return Natural is abstract; not overriding function Encoding (Self : not null access constant Shared_Abstract_Locator) return League.Strings.Universal_String is abstract; not overriding function Version (Self : not null access constant Shared_Abstract_Locator) return League.Strings.Universal_String is abstract; not overriding function Public_Id (Self : not null access constant Shared_Abstract_Locator) return League.Strings.Universal_String is abstract; not overriding function System_Id (Self : not null access constant Shared_Abstract_Locator) return League.Strings.Universal_String is abstract; not overriding function Base_URI (Self : not null access constant Shared_Abstract_Locator) return League.IRIs.IRI is abstract; type Shared_Locator_Access is access all Shared_Abstract_Locator'Class; procedure Reference (Self : not null Shared_Locator_Access); pragma Inline (Reference); procedure Dereference (Self : in out Shared_Locator_Access); end Matreshka.Internals.SAX_Locators;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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 PI:NAME:<NAME>END_PI, 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 abstract root type to implement SAX Locator for the -- specific reader. XML.SAX.Locators.SAX_Locator provides capability to wrap -- reader specific locator and to access its attributes. -- -- For perforamnce reasons, internal locator provides trampoline to access -- reader's internal data structures, thus locator should not be updated -- each time when user callback is called. ------------------------------------------------------------------------------ with League.IRIs; with League.Strings; with Matreshka.Atomics.Counters; package Matreshka.Internals.SAX_Locators is pragma Preelaborate; type Shared_Abstract_Locator is abstract tagged limited record Counter : Matreshka.Atomics.Counters.Counter; end record; not overriding function Line (Self : not null access constant Shared_Abstract_Locator) return Natural is abstract; not overriding function Column (Self : not null access constant Shared_Abstract_Locator) return Natural is abstract; not overriding function Encoding (Self : not null access constant Shared_Abstract_Locator) return League.Strings.Universal_String is abstract; not overriding function Version (Self : not null access constant Shared_Abstract_Locator) return League.Strings.Universal_String is abstract; not overriding function Public_Id (Self : not null access constant Shared_Abstract_Locator) return League.Strings.Universal_String is abstract; not overriding function System_Id (Self : not null access constant Shared_Abstract_Locator) return League.Strings.Universal_String is abstract; not overriding function Base_URI (Self : not null access constant Shared_Abstract_Locator) return League.IRIs.IRI is abstract; type Shared_Locator_Access is access all Shared_Abstract_Locator'Class; procedure Reference (Self : not null Shared_Locator_Access); pragma Inline (Reference); procedure Dereference (Self : in out Shared_Locator_Access); end Matreshka.Internals.SAX_Locators;
[ { "context": "--\n-- Copyright (c) 2015, John Leimon <jleimon@gmail.com>\n--\n-- Permission to use, cop", "end": 38, "score": 0.9998034834861755, "start": 27, "tag": "NAME", "value": "John Leimon" }, { "context": "--\n-- Copyright (c) 2015, John Leimon <jleimon@gmail.com>\n--\n-- Permission to use, copy, modify, and/or d", "end": 57, "score": 0.9999263882637024, "start": 40, "tag": "EMAIL", "value": "jleimon@gmail.com" } ]
pixy/src/host/pantilt_in_ada/specs/xlocale_h.ads
GambuzX/Pixy-SIW
1
-- -- Copyright (c) 2015, John Leimon <jleimon@gmail.com> -- -- 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. -- pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with System; with Interfaces.C.Strings; package xlocale_h is type uu_locale_struct_uu_locales_array is array (0 .. 12) of System.Address; type uu_locale_struct_uu_names_array is array (0 .. 12) of Interfaces.C.Strings.chars_ptr; type uu_locale_struct is record uu_locales : aliased uu_locale_struct_uu_locales_array; -- /usr/include/xlocale.h:30 uu_ctype_b : access unsigned_short; -- /usr/include/xlocale.h:33 uu_ctype_tolower : access int; -- /usr/include/xlocale.h:34 uu_ctype_toupper : access int; -- /usr/include/xlocale.h:35 uu_names : aliased uu_locale_struct_uu_names_array; -- /usr/include/xlocale.h:38 end record; pragma Convention (C_Pass_By_Copy, uu_locale_struct); -- /usr/include/xlocale.h:27 -- skipped empty struct uu_locale_data type uu_locale_t is access all uu_locale_struct; -- /usr/include/xlocale.h:39 subtype locale_t is uu_locale_t; -- /usr/include/xlocale.h:42 end xlocale_h;
2929
-- -- Copyright (c) 2015, <NAME> <<EMAIL>> -- -- 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. -- pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with System; with Interfaces.C.Strings; package xlocale_h is type uu_locale_struct_uu_locales_array is array (0 .. 12) of System.Address; type uu_locale_struct_uu_names_array is array (0 .. 12) of Interfaces.C.Strings.chars_ptr; type uu_locale_struct is record uu_locales : aliased uu_locale_struct_uu_locales_array; -- /usr/include/xlocale.h:30 uu_ctype_b : access unsigned_short; -- /usr/include/xlocale.h:33 uu_ctype_tolower : access int; -- /usr/include/xlocale.h:34 uu_ctype_toupper : access int; -- /usr/include/xlocale.h:35 uu_names : aliased uu_locale_struct_uu_names_array; -- /usr/include/xlocale.h:38 end record; pragma Convention (C_Pass_By_Copy, uu_locale_struct); -- /usr/include/xlocale.h:27 -- skipped empty struct uu_locale_data type uu_locale_t is access all uu_locale_struct; -- /usr/include/xlocale.h:39 subtype locale_t is uu_locale_t; -- /usr/include/xlocale.h:42 end xlocale_h;
true
-- -- Copyright (c) 2015, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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. -- pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with System; with Interfaces.C.Strings; package xlocale_h is type uu_locale_struct_uu_locales_array is array (0 .. 12) of System.Address; type uu_locale_struct_uu_names_array is array (0 .. 12) of Interfaces.C.Strings.chars_ptr; type uu_locale_struct is record uu_locales : aliased uu_locale_struct_uu_locales_array; -- /usr/include/xlocale.h:30 uu_ctype_b : access unsigned_short; -- /usr/include/xlocale.h:33 uu_ctype_tolower : access int; -- /usr/include/xlocale.h:34 uu_ctype_toupper : access int; -- /usr/include/xlocale.h:35 uu_names : aliased uu_locale_struct_uu_names_array; -- /usr/include/xlocale.h:38 end record; pragma Convention (C_Pass_By_Copy, uu_locale_struct); -- /usr/include/xlocale.h:27 -- skipped empty struct uu_locale_data type uu_locale_t is access all uu_locale_struct; -- /usr/include/xlocale.h:39 subtype locale_t is uu_locale_t; -- /usr/include/xlocale.h:42 end xlocale_h;
[ { "context": "--------------------------------\n-- Copyright 2020 Thomas E. Dickey --\n-- Co", "end": 745, "score": 0.9998735785484314, "start": 729, "tag": "NAME", "value": "Thomas E. Dickey" }, { "context": "--------------------------------------\n-- Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000\n-- Version Control\n", "end": 2875, "score": 0.9998849034309387, "start": 2856, "tag": "NAME", "value": "Eugene V. Melaragno" }, { "context": "----------------\n-- Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000\n-- Version Control\n-- $Revision: 1.8 $\n--", "end": 2898, "score": 0.9999329447746277, "start": 2877, "tag": "EMAIL", "value": "aldomel@ix.netcom.com" } ]
Ada95/samples/ncurses2-overlap_test.adb
ProtonAOSP-platina/android_external_libncurses
1
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- ncurses -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 Thomas E. Dickey -- -- Copyright 2000-2014,2015 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: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000 -- Version Control -- $Revision: 1.8 $ -- $Date: 2020/02/02 23:34:34 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; with Terminal_Interface.Curses; use Terminal_Interface.Curses; -- test effects of overlapping windows procedure ncurses2.overlap_test is procedure fillwin (win : Window; ch : Character); procedure crosswin (win : Window; ch : Character); procedure fillwin (win : Window; ch : Character) is y1 : Line_Position; x1 : Column_Position; begin Get_Size (win, y1, x1); for y in 0 .. y1 - 1 loop Move_Cursor (win, y, 0); for x in 0 .. x1 - 1 loop Add (win, Ch => ch); end loop; end loop; exception when Curses_Exception => null; -- write to lower right corner end fillwin; procedure crosswin (win : Window; ch : Character) is y1 : Line_Position; x1 : Column_Position; begin Get_Size (win, y1, x1); for y in 0 .. y1 - 1 loop for x in 0 .. x1 - 1 loop if ((x > (x1 - 1) / 3) and (x <= (2 * (x1 - 1)) / 3)) or (((y > (y1 - 1) / 3) and (y <= (2 * (y1 - 1)) / 3))) then Move_Cursor (win, y, x); Add (win, Ch => ch); end if; end loop; end loop; end crosswin; -- In a 24x80 screen like some xterms are, the instructions will -- be overwritten. ch : Character; win1 : Window := New_Window (9, 20, 3, 3); win2 : Window := New_Window (9, 20, 9, 16); begin Set_Raw_Mode (SwitchOn => True); Refresh; Move_Cursor (Line => 0, Column => 0); Add (Str => "This test shows the behavior of wnoutrefresh() with " & "respect to"); Add (Ch => newl); Add (Str => "the shared region of two overlapping windows A and B. " & "The cross"); Add (Ch => newl); Add (Str => "pattern in each window does not overlap the other."); Add (Ch => newl); Move_Cursor (Line => 18, Column => 0); Add (Str => "a = refresh A, then B, then doupdate. b = refresh B, " & "then A, then doupdate"); Add (Ch => newl); Add (Str => "c = fill window A with letter A. d = fill window B " & "with letter B."); Add (Ch => newl); Add (Str => "e = cross pattern in window A. f = cross pattern " & "in window B."); Add (Ch => newl); Add (Str => "g = clear window A. h = clear window B."); Add (Ch => newl); Add (Str => "i = overwrite A onto B. j = overwrite " & "B onto A."); Add (Ch => newl); Add (Str => "^Q/ESC = terminate test."); loop ch := Code_To_Char (Getchar); exit when ch = CTRL ('Q') or ch = CTRL ('['); -- QUIT or ESCAPE case ch is when 'a' => -- refresh window A first, then B Refresh_Without_Update (win1); Refresh_Without_Update (win2); Update_Screen; when 'b' => -- refresh window B first, then A Refresh_Without_Update (win2); Refresh_Without_Update (win1); Update_Screen; when 'c' => -- fill window A so it's visible fillwin (win1, 'A'); when 'd' => -- fill window B so it's visible fillwin (win2, 'B'); when 'e' => -- cross test pattern in window A crosswin (win1, 'A'); when 'f' => -- cross test pattern in window B crosswin (win2, 'B'); when 'g' => -- clear window A Clear (win1); Move_Cursor (win1, 0, 0); when 'h' => -- clear window B Clear (win2); Move_Cursor (win2, 0, 0); when 'i' => -- overwrite A onto B Overwrite (win1, win2); when 'j' => -- overwrite B onto A Overwrite (win2, win1); when others => null; end case; end loop; Delete (win2); Delete (win1); Erase; End_Windows; end ncurses2.overlap_test;
8950
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- ncurses -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 <NAME> -- -- Copyright 2000-2014,2015 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: <NAME> <<EMAIL>> 2000 -- Version Control -- $Revision: 1.8 $ -- $Date: 2020/02/02 23:34:34 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; with Terminal_Interface.Curses; use Terminal_Interface.Curses; -- test effects of overlapping windows procedure ncurses2.overlap_test is procedure fillwin (win : Window; ch : Character); procedure crosswin (win : Window; ch : Character); procedure fillwin (win : Window; ch : Character) is y1 : Line_Position; x1 : Column_Position; begin Get_Size (win, y1, x1); for y in 0 .. y1 - 1 loop Move_Cursor (win, y, 0); for x in 0 .. x1 - 1 loop Add (win, Ch => ch); end loop; end loop; exception when Curses_Exception => null; -- write to lower right corner end fillwin; procedure crosswin (win : Window; ch : Character) is y1 : Line_Position; x1 : Column_Position; begin Get_Size (win, y1, x1); for y in 0 .. y1 - 1 loop for x in 0 .. x1 - 1 loop if ((x > (x1 - 1) / 3) and (x <= (2 * (x1 - 1)) / 3)) or (((y > (y1 - 1) / 3) and (y <= (2 * (y1 - 1)) / 3))) then Move_Cursor (win, y, x); Add (win, Ch => ch); end if; end loop; end loop; end crosswin; -- In a 24x80 screen like some xterms are, the instructions will -- be overwritten. ch : Character; win1 : Window := New_Window (9, 20, 3, 3); win2 : Window := New_Window (9, 20, 9, 16); begin Set_Raw_Mode (SwitchOn => True); Refresh; Move_Cursor (Line => 0, Column => 0); Add (Str => "This test shows the behavior of wnoutrefresh() with " & "respect to"); Add (Ch => newl); Add (Str => "the shared region of two overlapping windows A and B. " & "The cross"); Add (Ch => newl); Add (Str => "pattern in each window does not overlap the other."); Add (Ch => newl); Move_Cursor (Line => 18, Column => 0); Add (Str => "a = refresh A, then B, then doupdate. b = refresh B, " & "then A, then doupdate"); Add (Ch => newl); Add (Str => "c = fill window A with letter A. d = fill window B " & "with letter B."); Add (Ch => newl); Add (Str => "e = cross pattern in window A. f = cross pattern " & "in window B."); Add (Ch => newl); Add (Str => "g = clear window A. h = clear window B."); Add (Ch => newl); Add (Str => "i = overwrite A onto B. j = overwrite " & "B onto A."); Add (Ch => newl); Add (Str => "^Q/ESC = terminate test."); loop ch := Code_To_Char (Getchar); exit when ch = CTRL ('Q') or ch = CTRL ('['); -- QUIT or ESCAPE case ch is when 'a' => -- refresh window A first, then B Refresh_Without_Update (win1); Refresh_Without_Update (win2); Update_Screen; when 'b' => -- refresh window B first, then A Refresh_Without_Update (win2); Refresh_Without_Update (win1); Update_Screen; when 'c' => -- fill window A so it's visible fillwin (win1, 'A'); when 'd' => -- fill window B so it's visible fillwin (win2, 'B'); when 'e' => -- cross test pattern in window A crosswin (win1, 'A'); when 'f' => -- cross test pattern in window B crosswin (win2, 'B'); when 'g' => -- clear window A Clear (win1); Move_Cursor (win1, 0, 0); when 'h' => -- clear window B Clear (win2); Move_Cursor (win2, 0, 0); when 'i' => -- overwrite A onto B Overwrite (win1, win2); when 'j' => -- overwrite B onto A Overwrite (win2, win1); when others => null; end case; end loop; Delete (win2); Delete (win1); Erase; End_Windows; end ncurses2.overlap_test;
true
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- ncurses -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 PI:NAME:<NAME>END_PI -- -- Copyright 2000-2014,2015 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: PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> 2000 -- Version Control -- $Revision: 1.8 $ -- $Date: 2020/02/02 23:34:34 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; with Terminal_Interface.Curses; use Terminal_Interface.Curses; -- test effects of overlapping windows procedure ncurses2.overlap_test is procedure fillwin (win : Window; ch : Character); procedure crosswin (win : Window; ch : Character); procedure fillwin (win : Window; ch : Character) is y1 : Line_Position; x1 : Column_Position; begin Get_Size (win, y1, x1); for y in 0 .. y1 - 1 loop Move_Cursor (win, y, 0); for x in 0 .. x1 - 1 loop Add (win, Ch => ch); end loop; end loop; exception when Curses_Exception => null; -- write to lower right corner end fillwin; procedure crosswin (win : Window; ch : Character) is y1 : Line_Position; x1 : Column_Position; begin Get_Size (win, y1, x1); for y in 0 .. y1 - 1 loop for x in 0 .. x1 - 1 loop if ((x > (x1 - 1) / 3) and (x <= (2 * (x1 - 1)) / 3)) or (((y > (y1 - 1) / 3) and (y <= (2 * (y1 - 1)) / 3))) then Move_Cursor (win, y, x); Add (win, Ch => ch); end if; end loop; end loop; end crosswin; -- In a 24x80 screen like some xterms are, the instructions will -- be overwritten. ch : Character; win1 : Window := New_Window (9, 20, 3, 3); win2 : Window := New_Window (9, 20, 9, 16); begin Set_Raw_Mode (SwitchOn => True); Refresh; Move_Cursor (Line => 0, Column => 0); Add (Str => "This test shows the behavior of wnoutrefresh() with " & "respect to"); Add (Ch => newl); Add (Str => "the shared region of two overlapping windows A and B. " & "The cross"); Add (Ch => newl); Add (Str => "pattern in each window does not overlap the other."); Add (Ch => newl); Move_Cursor (Line => 18, Column => 0); Add (Str => "a = refresh A, then B, then doupdate. b = refresh B, " & "then A, then doupdate"); Add (Ch => newl); Add (Str => "c = fill window A with letter A. d = fill window B " & "with letter B."); Add (Ch => newl); Add (Str => "e = cross pattern in window A. f = cross pattern " & "in window B."); Add (Ch => newl); Add (Str => "g = clear window A. h = clear window B."); Add (Ch => newl); Add (Str => "i = overwrite A onto B. j = overwrite " & "B onto A."); Add (Ch => newl); Add (Str => "^Q/ESC = terminate test."); loop ch := Code_To_Char (Getchar); exit when ch = CTRL ('Q') or ch = CTRL ('['); -- QUIT or ESCAPE case ch is when 'a' => -- refresh window A first, then B Refresh_Without_Update (win1); Refresh_Without_Update (win2); Update_Screen; when 'b' => -- refresh window B first, then A Refresh_Without_Update (win2); Refresh_Without_Update (win1); Update_Screen; when 'c' => -- fill window A so it's visible fillwin (win1, 'A'); when 'd' => -- fill window B so it's visible fillwin (win2, 'B'); when 'e' => -- cross test pattern in window A crosswin (win1, 'A'); when 'f' => -- cross test pattern in window B crosswin (win2, 'B'); when 'g' => -- clear window A Clear (win1); Move_Cursor (win1, 0, 0); when 'h' => -- clear window B Clear (win2); Move_Cursor (win2, 0, 0); when 'i' => -- overwrite A onto B Overwrite (win1, win2); when 'j' => -- overwrite B onto A Overwrite (win2, win1); when others => null; end case; end loop; Delete (win2); Delete (win1); Erase; End_Windows; end ncurses2.overlap_test;
[ { "context": "-- Copyright (c) 2015-2017 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 40, "score": 0.999841570854187, "start": 28, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2015-2017 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 60, "score": 0.9999310970306396, "start": 42, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
source/base/incr-nodes.ads
reznikmm/increment
5
-- Copyright (c) 2015-2017 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Characters.Wide_Wide_Latin_1; with Incr.Documents; limited with Incr.Nodes.Tokens; with Incr.Version_Trees; package Incr.Nodes is -- @summary -- Nodes of parse trees -- -- @description -- This package provides abstract Node type. -- Actuall nodes could be one of two kinds: -- * Tokens represent terminal symbols and contains text of the document -- * interconnecting nodes represent non-terminal symbols and have -- one or more children. -- Number of children is constant over node's life time. -- -- When node changes (by modification text of the token, assigning new -- children to mode, etc) it's marked as having local changes. -- This mark propagates up over the tree and aggregates as nested changes -- flag on ancestor nodes. This flag stored in history and allows one to -- locate the changed subtrees quickly. Nested changes flag doesn't count -- node's local changes. type Node (Document : Documents.Document_Access) is abstract tagged private; -- Node abstract type represents a node inside parse tree. type Node_Access is access all Node'Class; type Node_Array is array (Positive range <>) of Node_Access; not overriding function Is_Token (Self : Node) return Boolean is abstract; -- Check if given node is token. not overriding function Arity (Self : Node) return Natural is abstract; -- Return number of node's children. type Node_Kind is new Integer; subtype Token_Kind is Node_Kind range 0 .. Node_Kind'Last; not overriding function Kind (Self : Node) return Node_Kind is abstract; -- Return type of the node. Kind is not expected to change not overriding function Child (Self : Node; Index : Positive; Time : Version_Trees.Version) return Node_Access is abstract; -- Get node's child by its position. Result could be null if child absent. not overriding procedure Set_Child (Self : aliased in out Node; Index : Positive; Value : Node_Access) is abstract; -- Assign node's child by its position. not overriding function Nested_Changes (Self : Node; From : Version_Trees.Version; To : Version_Trees.Version) return Boolean is abstract; -- Check if any node under subtree rooted by Self (exluding Self node) -- was changed in any way between given two versions. not overriding function Local_Changes (Self : Node; From : Version_Trees.Version; To : Version_Trees.Version) return Boolean is abstract; -- Check if node itself was changed in any way between given two versions. not overriding function Nested_Errors (Self : Node; Time : Version_Trees.Version) return Boolean is abstract; -- Check if any node under subtree rooted by Self (exluding Self node) -- has errors in given version. not overriding function Local_Errors (Self : Node; Time : Version_Trees.Version) return Boolean is abstract; -- Check if node itself has errors in given version. not overriding procedure Set_Local_Errors (Self : in out Node; Value : Boolean := True) is abstract; not overriding function Parent (Self : Node; Time : Version_Trees.Version) return Node_Access is abstract; -- Return parent of the node. Could be temporary null in changing version. not overriding procedure Set_Parent (Self : in out Node; Value : Node_Access) is abstract; -- ??? should it be hidden not overriding procedure Discard (Self : in out Node) is abstract; -- Discards any uncommitted modifications to this node. not overriding function Exists (Self : Node; Time : Version_Trees.Version) return Boolean is abstract; -- Check if given node still exist at given time/version. type Transient_Flags is (Need_Analysis, Bottom_Up_Reused); -- These flags valid only at changing version and reset by commit. -- -- @value Need_Analysis mark nodes to analyse them latter -- @value Bottom_Up_Reused mark reused nodes not overriding function Get_Flag (Self : Node; Flag : Transient_Flags) return Boolean is abstract; -- Return given transient flag of the node not overriding procedure Set_Flag (Self : in out Node; Flag : Transient_Flags; Value : Boolean := True) is abstract; -- Set given transient flag on the node type Span_Kinds is (Text_Length, Token_Count, Line_Count); not overriding function Span (Self : aliased in out Node; Kind : Span_Kinds; Time : Version_Trees.Version) return Natural is abstract; -- Length of the node in term of character/line/token count LF : constant Wide_Wide_Character := Ada.Characters.Wide_Wide_Latin_1.LF; function First_Token (Self : aliased in out Node'Class; Time : Version_Trees.Version) return Tokens.Token_Access; -- Return first token in subtree rooted by given Node if any function Last_Token (Self : aliased in out Node'Class; Time : Version_Trees.Version) return Tokens.Token_Access; -- Return last token in subtree rooted by given Node if any function Next_Subtree (Self : Node'Class; Time : Version_Trees.Version) return Node_Access; -- Return next subtree: -- * return sibling node if Node is not the last child of its parent -- * return next subtree of the parent otherwise function Previous_Subtree (Self : Node'Class; Time : Version_Trees.Version) return Node_Access; -- Return previous subtree: -- * return sibling node if Node is not the first child of its parent -- * return previous subtree of the parent otherwise -- Internal subprograms: not overriding procedure On_Commit (Self : in out Node; Parent : Node_Access) is abstract; not overriding procedure On_Nested_Changes (Self : in out Node; Diff : Integer) is abstract; not overriding procedure Discard_Parent (Self : in out Node) is abstract; private type Constant_Node_Access is access constant Node'Class; type Flag_Array is array (Transient_Flags) of Boolean with Pack; No_Flags : constant Flag_Array := (others => False); Local_Changes_Mask : constant Flag_Array := (Need_Analysis => True, Bottom_Up_Reused => False); package Versioned_Booleans is new Version_Trees.Versioned_Values (Boolean); package Versioned_Nodes is new Version_Trees.Versioned_Values (Node_Access); type Node (Document : Documents.Document_Access) is abstract tagged null record; procedure Propagate_Nested_Changes (Self : in out Node'Class; Diff : Integer); type Node_With_Exist is abstract new Node with record Exist : Versioned_Booleans.Container; LC : Versioned_Booleans.Container; -- Versioned local changes LE : Versioned_Booleans.Container; -- Versioned local errors -- Transient fields valid during current version only Local_Changes : Natural := 0; Nested_Changes : Natural := 0; Flag : Flag_Array := No_Flags; end record; not overriding procedure Update_Local_Changes (Self : in out Node_With_Exist; Diff : Integer); overriding procedure On_Nested_Changes (Self : in out Node_With_Exist; Diff : Integer); overriding function Exists (Self : Node_With_Exist; Time : Version_Trees.Version) return Boolean; overriding function Get_Flag (Self : Node_With_Exist; Flag : Transient_Flags) return Boolean; overriding procedure Set_Flag (Self : in out Node_With_Exist; Flag : Transient_Flags; Value : Boolean := True); overriding procedure On_Commit (Self : in out Node_With_Exist; Parent : Node_Access); overriding function Local_Changes (Self : Node_With_Exist; From : Version_Trees.Version; To : Version_Trees.Version) return Boolean; overriding function Local_Errors (Self : Node_With_Exist; Time : Version_Trees.Version) return Boolean; overriding procedure Set_Local_Errors (Self : in out Node_With_Exist; Value : Boolean := True); type Node_With_Parent is abstract new Node_With_Exist with record Parent : Versioned_Nodes.Container; -- Parent is NOT a property of the node! Don't account it in calculation -- of local/nested change flags. end record; overriding function Parent (Self : Node_With_Parent; Time : Version_Trees.Version) return Node_Access; overriding procedure Set_Parent (Self : in out Node_With_Parent; Value : Node_Access); overriding procedure Discard_Parent (Self : in out Node_With_Parent); package Constructors is procedure Initialize (Self : aliased in out Node_With_Parent'Class); -- Initialize Self as nonexistent node. procedure Initialize_Ancient (Self : aliased in out Node_With_Parent'Class; Parent : Node_Access); -- Initialize Self as node existent in initial version of the document. end Constructors; procedure Mark_Deleted_Children (Self : in out Node'Class); -- Check each child of Self if it is not connected to the tree and mark it -- as non-existent in current version. function Child_Index (Self : Node'Class; Child : Constant_Node_Access; Time : Version_Trees.Version) return Natural; end Incr.Nodes;
26487
-- Copyright (c) 2015-2017 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Characters.Wide_Wide_Latin_1; with Incr.Documents; limited with Incr.Nodes.Tokens; with Incr.Version_Trees; package Incr.Nodes is -- @summary -- Nodes of parse trees -- -- @description -- This package provides abstract Node type. -- Actuall nodes could be one of two kinds: -- * Tokens represent terminal symbols and contains text of the document -- * interconnecting nodes represent non-terminal symbols and have -- one or more children. -- Number of children is constant over node's life time. -- -- When node changes (by modification text of the token, assigning new -- children to mode, etc) it's marked as having local changes. -- This mark propagates up over the tree and aggregates as nested changes -- flag on ancestor nodes. This flag stored in history and allows one to -- locate the changed subtrees quickly. Nested changes flag doesn't count -- node's local changes. type Node (Document : Documents.Document_Access) is abstract tagged private; -- Node abstract type represents a node inside parse tree. type Node_Access is access all Node'Class; type Node_Array is array (Positive range <>) of Node_Access; not overriding function Is_Token (Self : Node) return Boolean is abstract; -- Check if given node is token. not overriding function Arity (Self : Node) return Natural is abstract; -- Return number of node's children. type Node_Kind is new Integer; subtype Token_Kind is Node_Kind range 0 .. Node_Kind'Last; not overriding function Kind (Self : Node) return Node_Kind is abstract; -- Return type of the node. Kind is not expected to change not overriding function Child (Self : Node; Index : Positive; Time : Version_Trees.Version) return Node_Access is abstract; -- Get node's child by its position. Result could be null if child absent. not overriding procedure Set_Child (Self : aliased in out Node; Index : Positive; Value : Node_Access) is abstract; -- Assign node's child by its position. not overriding function Nested_Changes (Self : Node; From : Version_Trees.Version; To : Version_Trees.Version) return Boolean is abstract; -- Check if any node under subtree rooted by Self (exluding Self node) -- was changed in any way between given two versions. not overriding function Local_Changes (Self : Node; From : Version_Trees.Version; To : Version_Trees.Version) return Boolean is abstract; -- Check if node itself was changed in any way between given two versions. not overriding function Nested_Errors (Self : Node; Time : Version_Trees.Version) return Boolean is abstract; -- Check if any node under subtree rooted by Self (exluding Self node) -- has errors in given version. not overriding function Local_Errors (Self : Node; Time : Version_Trees.Version) return Boolean is abstract; -- Check if node itself has errors in given version. not overriding procedure Set_Local_Errors (Self : in out Node; Value : Boolean := True) is abstract; not overriding function Parent (Self : Node; Time : Version_Trees.Version) return Node_Access is abstract; -- Return parent of the node. Could be temporary null in changing version. not overriding procedure Set_Parent (Self : in out Node; Value : Node_Access) is abstract; -- ??? should it be hidden not overriding procedure Discard (Self : in out Node) is abstract; -- Discards any uncommitted modifications to this node. not overriding function Exists (Self : Node; Time : Version_Trees.Version) return Boolean is abstract; -- Check if given node still exist at given time/version. type Transient_Flags is (Need_Analysis, Bottom_Up_Reused); -- These flags valid only at changing version and reset by commit. -- -- @value Need_Analysis mark nodes to analyse them latter -- @value Bottom_Up_Reused mark reused nodes not overriding function Get_Flag (Self : Node; Flag : Transient_Flags) return Boolean is abstract; -- Return given transient flag of the node not overriding procedure Set_Flag (Self : in out Node; Flag : Transient_Flags; Value : Boolean := True) is abstract; -- Set given transient flag on the node type Span_Kinds is (Text_Length, Token_Count, Line_Count); not overriding function Span (Self : aliased in out Node; Kind : Span_Kinds; Time : Version_Trees.Version) return Natural is abstract; -- Length of the node in term of character/line/token count LF : constant Wide_Wide_Character := Ada.Characters.Wide_Wide_Latin_1.LF; function First_Token (Self : aliased in out Node'Class; Time : Version_Trees.Version) return Tokens.Token_Access; -- Return first token in subtree rooted by given Node if any function Last_Token (Self : aliased in out Node'Class; Time : Version_Trees.Version) return Tokens.Token_Access; -- Return last token in subtree rooted by given Node if any function Next_Subtree (Self : Node'Class; Time : Version_Trees.Version) return Node_Access; -- Return next subtree: -- * return sibling node if Node is not the last child of its parent -- * return next subtree of the parent otherwise function Previous_Subtree (Self : Node'Class; Time : Version_Trees.Version) return Node_Access; -- Return previous subtree: -- * return sibling node if Node is not the first child of its parent -- * return previous subtree of the parent otherwise -- Internal subprograms: not overriding procedure On_Commit (Self : in out Node; Parent : Node_Access) is abstract; not overriding procedure On_Nested_Changes (Self : in out Node; Diff : Integer) is abstract; not overriding procedure Discard_Parent (Self : in out Node) is abstract; private type Constant_Node_Access is access constant Node'Class; type Flag_Array is array (Transient_Flags) of Boolean with Pack; No_Flags : constant Flag_Array := (others => False); Local_Changes_Mask : constant Flag_Array := (Need_Analysis => True, Bottom_Up_Reused => False); package Versioned_Booleans is new Version_Trees.Versioned_Values (Boolean); package Versioned_Nodes is new Version_Trees.Versioned_Values (Node_Access); type Node (Document : Documents.Document_Access) is abstract tagged null record; procedure Propagate_Nested_Changes (Self : in out Node'Class; Diff : Integer); type Node_With_Exist is abstract new Node with record Exist : Versioned_Booleans.Container; LC : Versioned_Booleans.Container; -- Versioned local changes LE : Versioned_Booleans.Container; -- Versioned local errors -- Transient fields valid during current version only Local_Changes : Natural := 0; Nested_Changes : Natural := 0; Flag : Flag_Array := No_Flags; end record; not overriding procedure Update_Local_Changes (Self : in out Node_With_Exist; Diff : Integer); overriding procedure On_Nested_Changes (Self : in out Node_With_Exist; Diff : Integer); overriding function Exists (Self : Node_With_Exist; Time : Version_Trees.Version) return Boolean; overriding function Get_Flag (Self : Node_With_Exist; Flag : Transient_Flags) return Boolean; overriding procedure Set_Flag (Self : in out Node_With_Exist; Flag : Transient_Flags; Value : Boolean := True); overriding procedure On_Commit (Self : in out Node_With_Exist; Parent : Node_Access); overriding function Local_Changes (Self : Node_With_Exist; From : Version_Trees.Version; To : Version_Trees.Version) return Boolean; overriding function Local_Errors (Self : Node_With_Exist; Time : Version_Trees.Version) return Boolean; overriding procedure Set_Local_Errors (Self : in out Node_With_Exist; Value : Boolean := True); type Node_With_Parent is abstract new Node_With_Exist with record Parent : Versioned_Nodes.Container; -- Parent is NOT a property of the node! Don't account it in calculation -- of local/nested change flags. end record; overriding function Parent (Self : Node_With_Parent; Time : Version_Trees.Version) return Node_Access; overriding procedure Set_Parent (Self : in out Node_With_Parent; Value : Node_Access); overriding procedure Discard_Parent (Self : in out Node_With_Parent); package Constructors is procedure Initialize (Self : aliased in out Node_With_Parent'Class); -- Initialize Self as nonexistent node. procedure Initialize_Ancient (Self : aliased in out Node_With_Parent'Class; Parent : Node_Access); -- Initialize Self as node existent in initial version of the document. end Constructors; procedure Mark_Deleted_Children (Self : in out Node'Class); -- Check each child of Self if it is not connected to the tree and mark it -- as non-existent in current version. function Child_Index (Self : Node'Class; Child : Constant_Node_Access; Time : Version_Trees.Version) return Natural; end Incr.Nodes;
true
-- Copyright (c) 2015-2017 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Characters.Wide_Wide_Latin_1; with Incr.Documents; limited with Incr.Nodes.Tokens; with Incr.Version_Trees; package Incr.Nodes is -- @summary -- Nodes of parse trees -- -- @description -- This package provides abstract Node type. -- Actuall nodes could be one of two kinds: -- * Tokens represent terminal symbols and contains text of the document -- * interconnecting nodes represent non-terminal symbols and have -- one or more children. -- Number of children is constant over node's life time. -- -- When node changes (by modification text of the token, assigning new -- children to mode, etc) it's marked as having local changes. -- This mark propagates up over the tree and aggregates as nested changes -- flag on ancestor nodes. This flag stored in history and allows one to -- locate the changed subtrees quickly. Nested changes flag doesn't count -- node's local changes. type Node (Document : Documents.Document_Access) is abstract tagged private; -- Node abstract type represents a node inside parse tree. type Node_Access is access all Node'Class; type Node_Array is array (Positive range <>) of Node_Access; not overriding function Is_Token (Self : Node) return Boolean is abstract; -- Check if given node is token. not overriding function Arity (Self : Node) return Natural is abstract; -- Return number of node's children. type Node_Kind is new Integer; subtype Token_Kind is Node_Kind range 0 .. Node_Kind'Last; not overriding function Kind (Self : Node) return Node_Kind is abstract; -- Return type of the node. Kind is not expected to change not overriding function Child (Self : Node; Index : Positive; Time : Version_Trees.Version) return Node_Access is abstract; -- Get node's child by its position. Result could be null if child absent. not overriding procedure Set_Child (Self : aliased in out Node; Index : Positive; Value : Node_Access) is abstract; -- Assign node's child by its position. not overriding function Nested_Changes (Self : Node; From : Version_Trees.Version; To : Version_Trees.Version) return Boolean is abstract; -- Check if any node under subtree rooted by Self (exluding Self node) -- was changed in any way between given two versions. not overriding function Local_Changes (Self : Node; From : Version_Trees.Version; To : Version_Trees.Version) return Boolean is abstract; -- Check if node itself was changed in any way between given two versions. not overriding function Nested_Errors (Self : Node; Time : Version_Trees.Version) return Boolean is abstract; -- Check if any node under subtree rooted by Self (exluding Self node) -- has errors in given version. not overriding function Local_Errors (Self : Node; Time : Version_Trees.Version) return Boolean is abstract; -- Check if node itself has errors in given version. not overriding procedure Set_Local_Errors (Self : in out Node; Value : Boolean := True) is abstract; not overriding function Parent (Self : Node; Time : Version_Trees.Version) return Node_Access is abstract; -- Return parent of the node. Could be temporary null in changing version. not overriding procedure Set_Parent (Self : in out Node; Value : Node_Access) is abstract; -- ??? should it be hidden not overriding procedure Discard (Self : in out Node) is abstract; -- Discards any uncommitted modifications to this node. not overriding function Exists (Self : Node; Time : Version_Trees.Version) return Boolean is abstract; -- Check if given node still exist at given time/version. type Transient_Flags is (Need_Analysis, Bottom_Up_Reused); -- These flags valid only at changing version and reset by commit. -- -- @value Need_Analysis mark nodes to analyse them latter -- @value Bottom_Up_Reused mark reused nodes not overriding function Get_Flag (Self : Node; Flag : Transient_Flags) return Boolean is abstract; -- Return given transient flag of the node not overriding procedure Set_Flag (Self : in out Node; Flag : Transient_Flags; Value : Boolean := True) is abstract; -- Set given transient flag on the node type Span_Kinds is (Text_Length, Token_Count, Line_Count); not overriding function Span (Self : aliased in out Node; Kind : Span_Kinds; Time : Version_Trees.Version) return Natural is abstract; -- Length of the node in term of character/line/token count LF : constant Wide_Wide_Character := Ada.Characters.Wide_Wide_Latin_1.LF; function First_Token (Self : aliased in out Node'Class; Time : Version_Trees.Version) return Tokens.Token_Access; -- Return first token in subtree rooted by given Node if any function Last_Token (Self : aliased in out Node'Class; Time : Version_Trees.Version) return Tokens.Token_Access; -- Return last token in subtree rooted by given Node if any function Next_Subtree (Self : Node'Class; Time : Version_Trees.Version) return Node_Access; -- Return next subtree: -- * return sibling node if Node is not the last child of its parent -- * return next subtree of the parent otherwise function Previous_Subtree (Self : Node'Class; Time : Version_Trees.Version) return Node_Access; -- Return previous subtree: -- * return sibling node if Node is not the first child of its parent -- * return previous subtree of the parent otherwise -- Internal subprograms: not overriding procedure On_Commit (Self : in out Node; Parent : Node_Access) is abstract; not overriding procedure On_Nested_Changes (Self : in out Node; Diff : Integer) is abstract; not overriding procedure Discard_Parent (Self : in out Node) is abstract; private type Constant_Node_Access is access constant Node'Class; type Flag_Array is array (Transient_Flags) of Boolean with Pack; No_Flags : constant Flag_Array := (others => False); Local_Changes_Mask : constant Flag_Array := (Need_Analysis => True, Bottom_Up_Reused => False); package Versioned_Booleans is new Version_Trees.Versioned_Values (Boolean); package Versioned_Nodes is new Version_Trees.Versioned_Values (Node_Access); type Node (Document : Documents.Document_Access) is abstract tagged null record; procedure Propagate_Nested_Changes (Self : in out Node'Class; Diff : Integer); type Node_With_Exist is abstract new Node with record Exist : Versioned_Booleans.Container; LC : Versioned_Booleans.Container; -- Versioned local changes LE : Versioned_Booleans.Container; -- Versioned local errors -- Transient fields valid during current version only Local_Changes : Natural := 0; Nested_Changes : Natural := 0; Flag : Flag_Array := No_Flags; end record; not overriding procedure Update_Local_Changes (Self : in out Node_With_Exist; Diff : Integer); overriding procedure On_Nested_Changes (Self : in out Node_With_Exist; Diff : Integer); overriding function Exists (Self : Node_With_Exist; Time : Version_Trees.Version) return Boolean; overriding function Get_Flag (Self : Node_With_Exist; Flag : Transient_Flags) return Boolean; overriding procedure Set_Flag (Self : in out Node_With_Exist; Flag : Transient_Flags; Value : Boolean := True); overriding procedure On_Commit (Self : in out Node_With_Exist; Parent : Node_Access); overriding function Local_Changes (Self : Node_With_Exist; From : Version_Trees.Version; To : Version_Trees.Version) return Boolean; overriding function Local_Errors (Self : Node_With_Exist; Time : Version_Trees.Version) return Boolean; overriding procedure Set_Local_Errors (Self : in out Node_With_Exist; Value : Boolean := True); type Node_With_Parent is abstract new Node_With_Exist with record Parent : Versioned_Nodes.Container; -- Parent is NOT a property of the node! Don't account it in calculation -- of local/nested change flags. end record; overriding function Parent (Self : Node_With_Parent; Time : Version_Trees.Version) return Node_Access; overriding procedure Set_Parent (Self : in out Node_With_Parent; Value : Node_Access); overriding procedure Discard_Parent (Self : in out Node_With_Parent); package Constructors is procedure Initialize (Self : aliased in out Node_With_Parent'Class); -- Initialize Self as nonexistent node. procedure Initialize_Ancient (Self : aliased in out Node_With_Parent'Class; Parent : Node_Access); -- Initialize Self as node existent in initial version of the document. end Constructors; procedure Mark_Deleted_Children (Self : in out Node'Class); -- Check each child of Self if it is not connected to the tree and mark it -- as non-existent in current version. function Child_Index (Self : Node'Class; Child : Constant_Node_Access; Time : Version_Trees.Version) return Natural; end Incr.Nodes;
[ { "context": "th AWS implementation\n-- Copyright (C) 2011, 2012 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 182, "score": 0.9998868703842163, "start": 167, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "ight (C) 2011, 2012 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 213, "score": 0.999890923500061, "start": 198, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "2 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 240, "score": 0.9999269247055054, "start": 215, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
src/http/aws/util-http-clients-web.ads
Letractively/ada-util
0
----------------------------------------------------------------------- -- util-http-clients-web -- HTTP Clients with AWS implementation -- Copyright (C) 2011, 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- private with AWS.Headers; private with AWS.Response; package Util.Http.Clients.Web is -- Register the Http manager. procedure Register; private type AWS_Http_Manager is new Http_Manager with null record; type AWS_Http_Manager_Access is access all Http_Manager'Class; procedure Create (Manager : in AWS_Http_Manager; Http : in out Client'Class); procedure Do_Get (Manager : in AWS_Http_Manager; Http : in Client'Class; URI : in String; Reply : out Response'Class); procedure Do_Post (Manager : in AWS_Http_Manager; Http : in Client'Class; URI : in String; Data : in String; Reply : out Response'Class); type AWS_Http_Request is new Http_Request with record Headers : AWS.Headers.List; end record; type AWS_Http_Request_Access is access all AWS_Http_Request'Class; -- Returns a boolean indicating whether the named request header has already -- been set. overriding function Contains_Header (Http : in AWS_Http_Request; Name : in String) return Boolean; -- Returns the value of the specified request header as a String. If the request -- did not include a header of the specified name, this method returns null. -- If there are multiple headers with the same name, this method returns the -- first head in the request. The header name is case insensitive. You can use -- this method with any response header. overriding function Get_Header (Request : in AWS_Http_Request; Name : in String) return String; -- Sets a request header with the given name and value. If the header had already -- been set, the new value overwrites the previous one. The containsHeader -- method can be used to test for the presence of a header before setting its value. overriding procedure Set_Header (Http : in out AWS_Http_Request; Name : in String; Value : in String); -- Adds a request header with the given name and value. -- This method allows request headers to have multiple values. overriding procedure Add_Header (Http : in out AWS_Http_Request; Name : in String; Value : in String); -- Iterate over the request headers and executes the <b>Process</b> procedure. overriding procedure Iterate_Headers (Request : in AWS_Http_Request; Process : not null access procedure (Name : in String; Value : in String)); type AWS_Http_Response is new Http_Response with record Data : AWS.Response.Data; end record; type AWS_Http_Response_Access is access all AWS_Http_Response'Class; -- Returns a boolean indicating whether the named response header has already -- been set. overriding function Contains_Header (Reply : in AWS_Http_Response; Name : in String) return Boolean; -- Returns the value of the specified response header as a String. If the response -- did not include a header of the specified name, this method returns null. -- If there are multiple headers with the same name, this method returns the -- first head in the request. The header name is case insensitive. You can use -- this method with any response header. overriding function Get_Header (Reply : in AWS_Http_Response; Name : in String) return String; -- Sets a message header with the given name and value. If the header had already -- been set, the new value overwrites the previous one. The containsHeader -- method can be used to test for the presence of a header before setting its value. overriding procedure Set_Header (Reply : in out AWS_Http_Response; Name : in String; Value : in String); -- Adds a request header with the given name and value. -- This method allows request headers to have multiple values. overriding procedure Add_Header (Reply : in out AWS_Http_Response; Name : in String; Value : in String); -- Iterate over the response headers and executes the <b>Process</b> procedure. overriding procedure Iterate_Headers (Reply : in AWS_Http_Response; Process : not null access procedure (Name : in String; Value : in String)); -- Get the response body as a string. function Get_Body (Reply : in AWS_Http_Response) return String; -- Get the response status code. overriding function Get_Status (Reply : in AWS_Http_Response) return Natural; end Util.Http.Clients.Web;
10415
----------------------------------------------------------------------- -- util-http-clients-web -- HTTP Clients with AWS implementation -- Copyright (C) 2011, 2012 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- private with AWS.Headers; private with AWS.Response; package Util.Http.Clients.Web is -- Register the Http manager. procedure Register; private type AWS_Http_Manager is new Http_Manager with null record; type AWS_Http_Manager_Access is access all Http_Manager'Class; procedure Create (Manager : in AWS_Http_Manager; Http : in out Client'Class); procedure Do_Get (Manager : in AWS_Http_Manager; Http : in Client'Class; URI : in String; Reply : out Response'Class); procedure Do_Post (Manager : in AWS_Http_Manager; Http : in Client'Class; URI : in String; Data : in String; Reply : out Response'Class); type AWS_Http_Request is new Http_Request with record Headers : AWS.Headers.List; end record; type AWS_Http_Request_Access is access all AWS_Http_Request'Class; -- Returns a boolean indicating whether the named request header has already -- been set. overriding function Contains_Header (Http : in AWS_Http_Request; Name : in String) return Boolean; -- Returns the value of the specified request header as a String. If the request -- did not include a header of the specified name, this method returns null. -- If there are multiple headers with the same name, this method returns the -- first head in the request. The header name is case insensitive. You can use -- this method with any response header. overriding function Get_Header (Request : in AWS_Http_Request; Name : in String) return String; -- Sets a request header with the given name and value. If the header had already -- been set, the new value overwrites the previous one. The containsHeader -- method can be used to test for the presence of a header before setting its value. overriding procedure Set_Header (Http : in out AWS_Http_Request; Name : in String; Value : in String); -- Adds a request header with the given name and value. -- This method allows request headers to have multiple values. overriding procedure Add_Header (Http : in out AWS_Http_Request; Name : in String; Value : in String); -- Iterate over the request headers and executes the <b>Process</b> procedure. overriding procedure Iterate_Headers (Request : in AWS_Http_Request; Process : not null access procedure (Name : in String; Value : in String)); type AWS_Http_Response is new Http_Response with record Data : AWS.Response.Data; end record; type AWS_Http_Response_Access is access all AWS_Http_Response'Class; -- Returns a boolean indicating whether the named response header has already -- been set. overriding function Contains_Header (Reply : in AWS_Http_Response; Name : in String) return Boolean; -- Returns the value of the specified response header as a String. If the response -- did not include a header of the specified name, this method returns null. -- If there are multiple headers with the same name, this method returns the -- first head in the request. The header name is case insensitive. You can use -- this method with any response header. overriding function Get_Header (Reply : in AWS_Http_Response; Name : in String) return String; -- Sets a message header with the given name and value. If the header had already -- been set, the new value overwrites the previous one. The containsHeader -- method can be used to test for the presence of a header before setting its value. overriding procedure Set_Header (Reply : in out AWS_Http_Response; Name : in String; Value : in String); -- Adds a request header with the given name and value. -- This method allows request headers to have multiple values. overriding procedure Add_Header (Reply : in out AWS_Http_Response; Name : in String; Value : in String); -- Iterate over the response headers and executes the <b>Process</b> procedure. overriding procedure Iterate_Headers (Reply : in AWS_Http_Response; Process : not null access procedure (Name : in String; Value : in String)); -- Get the response body as a string. function Get_Body (Reply : in AWS_Http_Response) return String; -- Get the response status code. overriding function Get_Status (Reply : in AWS_Http_Response) return Natural; end Util.Http.Clients.Web;
true
----------------------------------------------------------------------- -- util-http-clients-web -- HTTP Clients with AWS implementation -- Copyright (C) 2011, 2012 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- private with AWS.Headers; private with AWS.Response; package Util.Http.Clients.Web is -- Register the Http manager. procedure Register; private type AWS_Http_Manager is new Http_Manager with null record; type AWS_Http_Manager_Access is access all Http_Manager'Class; procedure Create (Manager : in AWS_Http_Manager; Http : in out Client'Class); procedure Do_Get (Manager : in AWS_Http_Manager; Http : in Client'Class; URI : in String; Reply : out Response'Class); procedure Do_Post (Manager : in AWS_Http_Manager; Http : in Client'Class; URI : in String; Data : in String; Reply : out Response'Class); type AWS_Http_Request is new Http_Request with record Headers : AWS.Headers.List; end record; type AWS_Http_Request_Access is access all AWS_Http_Request'Class; -- Returns a boolean indicating whether the named request header has already -- been set. overriding function Contains_Header (Http : in AWS_Http_Request; Name : in String) return Boolean; -- Returns the value of the specified request header as a String. If the request -- did not include a header of the specified name, this method returns null. -- If there are multiple headers with the same name, this method returns the -- first head in the request. The header name is case insensitive. You can use -- this method with any response header. overriding function Get_Header (Request : in AWS_Http_Request; Name : in String) return String; -- Sets a request header with the given name and value. If the header had already -- been set, the new value overwrites the previous one. The containsHeader -- method can be used to test for the presence of a header before setting its value. overriding procedure Set_Header (Http : in out AWS_Http_Request; Name : in String; Value : in String); -- Adds a request header with the given name and value. -- This method allows request headers to have multiple values. overriding procedure Add_Header (Http : in out AWS_Http_Request; Name : in String; Value : in String); -- Iterate over the request headers and executes the <b>Process</b> procedure. overriding procedure Iterate_Headers (Request : in AWS_Http_Request; Process : not null access procedure (Name : in String; Value : in String)); type AWS_Http_Response is new Http_Response with record Data : AWS.Response.Data; end record; type AWS_Http_Response_Access is access all AWS_Http_Response'Class; -- Returns a boolean indicating whether the named response header has already -- been set. overriding function Contains_Header (Reply : in AWS_Http_Response; Name : in String) return Boolean; -- Returns the value of the specified response header as a String. If the response -- did not include a header of the specified name, this method returns null. -- If there are multiple headers with the same name, this method returns the -- first head in the request. The header name is case insensitive. You can use -- this method with any response header. overriding function Get_Header (Reply : in AWS_Http_Response; Name : in String) return String; -- Sets a message header with the given name and value. If the header had already -- been set, the new value overwrites the previous one. The containsHeader -- method can be used to test for the presence of a header before setting its value. overriding procedure Set_Header (Reply : in out AWS_Http_Response; Name : in String; Value : in String); -- Adds a request header with the given name and value. -- This method allows request headers to have multiple values. overriding procedure Add_Header (Reply : in out AWS_Http_Response; Name : in String; Value : in String); -- Iterate over the response headers and executes the <b>Process</b> procedure. overriding procedure Iterate_Headers (Reply : in AWS_Http_Response; Process : not null access procedure (Name : in String; Value : in String)); -- Get the response body as a string. function Get_Body (Reply : in AWS_Http_Response) return String; -- Get the response status code. overriding function Get_Status (Reply : in AWS_Http_Response) return Natural; end Util.Http.Clients.Web;
[ { "context": "atabase Drivers\n-- Copyright (C) 2010, 2011, 2012 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 158, "score": 0.9998764991760254, "start": 143, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "C) 2010, 2011, 2012 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 189, "score": 0.9998776316642761, "start": 174, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "2 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 216, "score": 0.9999290704727173, "start": 191, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
src/ado-drivers-connections.ads
Letractively/ada-ado
0
----------------------------------------------------------------------- -- ADO Drivers -- Database Drivers -- Copyright (C) 2010, 2011, 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Finalization; with ADO.Statements; with ADO.Schemas; with Util.Properties; with Util.Strings; -- The <b>ADO.Drivers</b> package represents the database driver that will create -- database connections and provide the database specific implementation. package ADO.Drivers.Connections is use ADO.Statements; type Driver is abstract tagged limited private; type Driver_Access is access all Driver'Class; -- ------------------------------ -- Database connection implementation -- ------------------------------ -- type Database_Connection is abstract new Ada.Finalization.Limited_Controlled with record Count : Natural := 0; Ident : String (1 .. 8) := (others => ' '); end record; type Database_Connection_Access is access all Database_Connection'Class; function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Query_Statement_Access is abstract; function Create_Statement (Database : in Database_Connection; Query : in String) return Query_Statement_Access is abstract; -- Create a delete statement. function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Delete_Statement_Access is abstract; -- Create an insert statement. function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Insert_Statement_Access is abstract; -- Create an update statement. function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Update_Statement_Access is abstract; -- Start a transaction. procedure Begin_Transaction (Database : in out Database_Connection) is abstract; -- Commit the current transaction. procedure Commit (Database : in out Database_Connection) is abstract; -- Rollback the current transaction. procedure Rollback (Database : in out Database_Connection) is abstract; -- Load the database schema definition for the current database. procedure Load_Schema (Database : in Database_Connection; Schema : out ADO.Schemas.Schema_Definition) is abstract; -- Get the database driver which manages this connection. function Get_Driver (Database : in Database_Connection) return Driver_Access is abstract; -- Closes the database connection procedure Close (Database : in out Database_Connection) is abstract; -- ------------------------------ -- The database configuration properties -- ------------------------------ type Configuration is new Ada.Finalization.Controlled with private; type Configuration_Access is access all Configuration'Class; -- Set the connection URL to connect to the database. -- The driver connection is a string of the form: -- -- driver://[host][:port]/[database][?property1][=value1]... -- -- If the string is invalid or if the driver cannot be found, -- the Connection_Error exception is raised. procedure Set_Connection (Controller : in out Configuration; URI : in String); -- Set a property on the datasource for the driver. -- The driver can retrieve the property to configure and open -- the database connection. procedure Set_Property (Controller : in out Configuration; Name : in String; Value : in String); -- Get a property from the data source configuration. -- If the property does not exist, an empty string is returned. function Get_Property (Controller : in Configuration; Name : in String) return String; -- Get the server hostname. function Get_Server (Controller : in Configuration) return String; -- Get the server port. function Get_Port (Controller : in Configuration) return Integer; -- Get the database name. function Get_Database (Controller : in Configuration) return String; -- Create a new connection using the configuration parameters. procedure Create_Connection (Config : in Configuration'Class; Result : out Database_Connection_Access); -- ------------------------------ -- Database Driver -- ------------------------------ -- Create a new connection using the configuration parameters. procedure Create_Connection (D : in out Driver; Config : in Configuration'Class; Result : out Database_Connection_Access) is abstract; -- Get the driver unique index. function Get_Driver_Index (D : in Driver) return Driver_Index; -- Get the driver name. function Get_Driver_Name (D : in Driver) return String; -- Register a database driver. procedure Register (Driver : in Driver_Access); -- Get a database driver given its name. function Get_Driver (Name : in String) return Driver_Access; private type Driver is abstract new Ada.Finalization.Limited_Controlled with record Name : Util.Strings.Name_Access; Index : Driver_Index; end record; type Configuration is new Ada.Finalization.Controlled with record URI : Unbounded_String := Null_Unbounded_String; Server : Unbounded_String := Null_Unbounded_String; Port : Integer := 0; Database : Unbounded_String := Null_Unbounded_String; Properties : Util.Properties.Manager; Driver : Driver_Access; end record; end ADO.Drivers.Connections;
11177
----------------------------------------------------------------------- -- ADO Drivers -- Database Drivers -- Copyright (C) 2010, 2011, 2012 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Finalization; with ADO.Statements; with ADO.Schemas; with Util.Properties; with Util.Strings; -- The <b>ADO.Drivers</b> package represents the database driver that will create -- database connections and provide the database specific implementation. package ADO.Drivers.Connections is use ADO.Statements; type Driver is abstract tagged limited private; type Driver_Access is access all Driver'Class; -- ------------------------------ -- Database connection implementation -- ------------------------------ -- type Database_Connection is abstract new Ada.Finalization.Limited_Controlled with record Count : Natural := 0; Ident : String (1 .. 8) := (others => ' '); end record; type Database_Connection_Access is access all Database_Connection'Class; function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Query_Statement_Access is abstract; function Create_Statement (Database : in Database_Connection; Query : in String) return Query_Statement_Access is abstract; -- Create a delete statement. function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Delete_Statement_Access is abstract; -- Create an insert statement. function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Insert_Statement_Access is abstract; -- Create an update statement. function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Update_Statement_Access is abstract; -- Start a transaction. procedure Begin_Transaction (Database : in out Database_Connection) is abstract; -- Commit the current transaction. procedure Commit (Database : in out Database_Connection) is abstract; -- Rollback the current transaction. procedure Rollback (Database : in out Database_Connection) is abstract; -- Load the database schema definition for the current database. procedure Load_Schema (Database : in Database_Connection; Schema : out ADO.Schemas.Schema_Definition) is abstract; -- Get the database driver which manages this connection. function Get_Driver (Database : in Database_Connection) return Driver_Access is abstract; -- Closes the database connection procedure Close (Database : in out Database_Connection) is abstract; -- ------------------------------ -- The database configuration properties -- ------------------------------ type Configuration is new Ada.Finalization.Controlled with private; type Configuration_Access is access all Configuration'Class; -- Set the connection URL to connect to the database. -- The driver connection is a string of the form: -- -- driver://[host][:port]/[database][?property1][=value1]... -- -- If the string is invalid or if the driver cannot be found, -- the Connection_Error exception is raised. procedure Set_Connection (Controller : in out Configuration; URI : in String); -- Set a property on the datasource for the driver. -- The driver can retrieve the property to configure and open -- the database connection. procedure Set_Property (Controller : in out Configuration; Name : in String; Value : in String); -- Get a property from the data source configuration. -- If the property does not exist, an empty string is returned. function Get_Property (Controller : in Configuration; Name : in String) return String; -- Get the server hostname. function Get_Server (Controller : in Configuration) return String; -- Get the server port. function Get_Port (Controller : in Configuration) return Integer; -- Get the database name. function Get_Database (Controller : in Configuration) return String; -- Create a new connection using the configuration parameters. procedure Create_Connection (Config : in Configuration'Class; Result : out Database_Connection_Access); -- ------------------------------ -- Database Driver -- ------------------------------ -- Create a new connection using the configuration parameters. procedure Create_Connection (D : in out Driver; Config : in Configuration'Class; Result : out Database_Connection_Access) is abstract; -- Get the driver unique index. function Get_Driver_Index (D : in Driver) return Driver_Index; -- Get the driver name. function Get_Driver_Name (D : in Driver) return String; -- Register a database driver. procedure Register (Driver : in Driver_Access); -- Get a database driver given its name. function Get_Driver (Name : in String) return Driver_Access; private type Driver is abstract new Ada.Finalization.Limited_Controlled with record Name : Util.Strings.Name_Access; Index : Driver_Index; end record; type Configuration is new Ada.Finalization.Controlled with record URI : Unbounded_String := Null_Unbounded_String; Server : Unbounded_String := Null_Unbounded_String; Port : Integer := 0; Database : Unbounded_String := Null_Unbounded_String; Properties : Util.Properties.Manager; Driver : Driver_Access; end record; end ADO.Drivers.Connections;
true
----------------------------------------------------------------------- -- ADO Drivers -- Database Drivers -- Copyright (C) 2010, 2011, 2012 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Finalization; with ADO.Statements; with ADO.Schemas; with Util.Properties; with Util.Strings; -- The <b>ADO.Drivers</b> package represents the database driver that will create -- database connections and provide the database specific implementation. package ADO.Drivers.Connections is use ADO.Statements; type Driver is abstract tagged limited private; type Driver_Access is access all Driver'Class; -- ------------------------------ -- Database connection implementation -- ------------------------------ -- type Database_Connection is abstract new Ada.Finalization.Limited_Controlled with record Count : Natural := 0; Ident : String (1 .. 8) := (others => ' '); end record; type Database_Connection_Access is access all Database_Connection'Class; function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Query_Statement_Access is abstract; function Create_Statement (Database : in Database_Connection; Query : in String) return Query_Statement_Access is abstract; -- Create a delete statement. function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Delete_Statement_Access is abstract; -- Create an insert statement. function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Insert_Statement_Access is abstract; -- Create an update statement. function Create_Statement (Database : in Database_Connection; Table : in ADO.Schemas.Class_Mapping_Access) return Update_Statement_Access is abstract; -- Start a transaction. procedure Begin_Transaction (Database : in out Database_Connection) is abstract; -- Commit the current transaction. procedure Commit (Database : in out Database_Connection) is abstract; -- Rollback the current transaction. procedure Rollback (Database : in out Database_Connection) is abstract; -- Load the database schema definition for the current database. procedure Load_Schema (Database : in Database_Connection; Schema : out ADO.Schemas.Schema_Definition) is abstract; -- Get the database driver which manages this connection. function Get_Driver (Database : in Database_Connection) return Driver_Access is abstract; -- Closes the database connection procedure Close (Database : in out Database_Connection) is abstract; -- ------------------------------ -- The database configuration properties -- ------------------------------ type Configuration is new Ada.Finalization.Controlled with private; type Configuration_Access is access all Configuration'Class; -- Set the connection URL to connect to the database. -- The driver connection is a string of the form: -- -- driver://[host][:port]/[database][?property1][=value1]... -- -- If the string is invalid or if the driver cannot be found, -- the Connection_Error exception is raised. procedure Set_Connection (Controller : in out Configuration; URI : in String); -- Set a property on the datasource for the driver. -- The driver can retrieve the property to configure and open -- the database connection. procedure Set_Property (Controller : in out Configuration; Name : in String; Value : in String); -- Get a property from the data source configuration. -- If the property does not exist, an empty string is returned. function Get_Property (Controller : in Configuration; Name : in String) return String; -- Get the server hostname. function Get_Server (Controller : in Configuration) return String; -- Get the server port. function Get_Port (Controller : in Configuration) return Integer; -- Get the database name. function Get_Database (Controller : in Configuration) return String; -- Create a new connection using the configuration parameters. procedure Create_Connection (Config : in Configuration'Class; Result : out Database_Connection_Access); -- ------------------------------ -- Database Driver -- ------------------------------ -- Create a new connection using the configuration parameters. procedure Create_Connection (D : in out Driver; Config : in Configuration'Class; Result : out Database_Connection_Access) is abstract; -- Get the driver unique index. function Get_Driver_Index (D : in Driver) return Driver_Index; -- Get the driver name. function Get_Driver_Name (D : in Driver) return String; -- Register a database driver. procedure Register (Driver : in Driver_Access); -- Get a database driver given its name. function Get_Driver (Name : in String) return Driver_Access; private type Driver is abstract new Ada.Finalization.Limited_Controlled with record Name : Util.Strings.Name_Access; Index : Driver_Index; end record; type Configuration is new Ada.Finalization.Controlled with record URI : Unbounded_String := Null_Unbounded_String; Server : Unbounded_String := Null_Unbounded_String; Port : Integer := 0; Database : Unbounded_String := Null_Unbounded_String; Properties : Util.Properties.Manager; Driver : Driver_Access; end record; end ADO.Drivers.Connections;
[ { "context": " --\n-- Copyright © 2010-2017, Vadim Godunko <vgodunko@gmail.com> --\n-- All rig", "end": 829, "score": 0.9998857378959656, "start": 816, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2010-2017, Vadim Godunko <vgodunko@gmail.com> --\n-- All rights reserved. ", "end": 849, "score": 0.9999322891235352, "start": 831, "tag": "EMAIL", "value": "vgodunko@gmail.com" } ]
source/xml/sax/matreshka-internals-xml-symbol_tables.adb
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2017, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This package provides symbol table to store frequently used strings, -- allocate identifier for them and reduce number of memory allocations by -- reusing shared strings. ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; with League.Strings.Internals; with Matreshka.Internals.Strings.Operations; with Matreshka.Internals.Unicode.Characters.Latin; package body Matreshka.Internals.XML.Symbol_Tables is use Matreshka.Internals.Unicode.Characters.Latin; procedure Free is new Ada.Unchecked_Deallocation (Symbol_Record_Array, Symbol_Record_Array_Access); function Is_Valid_NS_Name_Start_Character (Code : Matreshka.Internals.Unicode.Code_Point) return Boolean; -- Returns True when code point belongs to NSNameStartChar. ------------- -- Element -- ------------- function Element (Self : Symbol_Table; Identifier : Symbol_Identifier) return Element_Identifier is begin return Self.Table (Identifier).Element; end Element; -------------- -- Finalize -- -------------- procedure Finalize (Self : in out Symbol_Table) is begin for J in Self.Table'First .. Self.Last loop Matreshka.Internals.Strings.Dereference (Self.Table (J).String); end loop; Free (Self.Table); end Finalize; -------------------- -- General_Entity -- -------------------- function General_Entity (Self : Symbol_Table; Identifier : Symbol_Identifier) return Entity_Identifier is begin return Self.Table (Identifier).General_Entity; end General_Entity; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out Symbol_Table) is procedure Register_Predefined_Entity (Name : League.Strings.Universal_String; Entity : Entity_Identifier); -- Registers predefined entity. procedure Register_Symbol (Name : League.Strings.Universal_String); -------------------------------- -- Register_Predefined_Entity -- -------------------------------- procedure Register_Predefined_Entity (Name : League.Strings.Universal_String; Entity : Entity_Identifier) is N : constant Matreshka.Internals.Strings.Shared_String_Access := League.Strings.Internals.Internal (Name); begin Matreshka.Internals.Strings.Reference (N); Self.Last := Self.Last + 1; Self.Table (Self.Last) := (String => N, Namespace_Processed => False, Prefix_Name => No_Symbol, Local_Name => No_Symbol, Element => No_Element, Notation => No_Notation, Parameter_Entity => No_Entity, General_Entity => Entity); end Register_Predefined_Entity; --------------------- -- Register_Symbol -- --------------------- procedure Register_Symbol (Name : League.Strings.Universal_String) is N : constant Matreshka.Internals.Strings.Shared_String_Access := League.Strings.Internals.Internal (Name); begin Matreshka.Internals.Strings.Reference (N); Self.Last := Self.Last + 1; Self.Table (Self.Last) := (String => N, Namespace_Processed => False, Prefix_Name => No_Symbol, Local_Name => No_Symbol, Element => No_Element, Notation => No_Notation, Parameter_Entity => No_Entity, General_Entity => No_Entity); end Register_Symbol; begin Self.Table := new Symbol_Record_Array (0 .. 31); Self.Table (No_Symbol) := (String => Matreshka.Internals.Strings.Shared_Empty'Access, Namespace_Processed => True, Prefix_Name => No_Symbol, Local_Name => No_Symbol, Element => No_Element, Notation => No_Notation, Parameter_Entity => No_Entity, General_Entity => No_Entity); Self.Last := No_Symbol; -- Register predefined entities. Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("lt"), Entity => Entity_lt); Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("gt"), Entity => Entity_gt); Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("amp"), Entity => Entity_amp); Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("apos"), Entity => Entity_apos); Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("quot"), Entity => Entity_quot); -- Register attribute type's names. Register_Symbol (League.Strings.To_Universal_String ("CDATA")); Register_Symbol (League.Strings.To_Universal_String ("ID")); Register_Symbol (League.Strings.To_Universal_String ("IDREF")); Register_Symbol (League.Strings.To_Universal_String ("IDREFS")); Register_Symbol (League.Strings.To_Universal_String ("NMTOKEN")); Register_Symbol (League.Strings.To_Universal_String ("NMTOKENS")); Register_Symbol (League.Strings.To_Universal_String ("ENTITY")); Register_Symbol (League.Strings.To_Universal_String ("ENTITIES")); Register_Symbol (League.Strings.To_Universal_String ("NOTATION")); -- Register well known names and namespaces. Register_Symbol (League.Strings.To_Universal_String ("xml")); Register_Symbol (League.Strings.To_Universal_String ("xmlns")); Register_Symbol (League.Strings.To_Universal_String ("http://www.w3.org/XML/1998/namespace")); Register_Symbol (League.Strings.To_Universal_String ("http://www.w3.org/2000/xmlns/")); Register_Symbol (League.Strings.To_Universal_String ("xml:base")); end Initialize; ------------ -- Insert -- ------------ procedure Insert (Self : in out Symbol_Table; String : not null Matreshka.Internals.Strings.Shared_String_Access; First : Matreshka.Internals.Utf16.Utf16_String_Index; Size : Matreshka.Internals.Utf16.Utf16_String_Index; Length : Natural; Namespaces : Boolean; Qname_Error : out Qualified_Name_Errors; Identifier : out Symbol_Identifier) is use Matreshka.Internals.Unicode; use Matreshka.Internals.Utf16; D_Position : Utf16_String_Index; D_Index : Natural; C : Code_Point; C_Position : Utf16_String_Index; C_Index : Natural; Found : Boolean := False; N_Position : Utf16_String_Index; T_Position : Utf16_String_Index; Prefix_Name : Symbol_Identifier; Local_Name : Symbol_Identifier; begin for J in Self.Table'First .. Self.Last loop if Self.Table (J).String.Unused = Size then N_Position := First; T_Position := 0; while N_Position < First + Size loop exit when String.Value (N_Position) /= Self.Table (J).String.Value (T_Position); N_Position := N_Position + 1; T_Position := T_Position + 1; end loop; if N_Position = First + Size then Identifier := J; Found := True; exit; end if; end if; end loop; if not Found then Self.Last := Self.Last + 1; Identifier := Self.Last; if Self.Last > Self.Table'Last then declare Old : Symbol_Record_Array_Access := Self.Table; begin Self.Table := new Symbol_Record_Array (0 .. Old'Last + 32); Self.Table (Old'Range) := Old.all; Free (Old); end; end if; Self.Table (Identifier) := (String => Matreshka.Internals.Strings.Operations.Slice (String, First, Size, Length), Namespace_Processed => False, Prefix_Name => No_Symbol, Local_Name => No_Symbol, Element => No_Element, Notation => No_Notation, Parameter_Entity => No_Entity, General_Entity => No_Entity); end if; if Namespaces and then not Self.Table (Identifier).Namespace_Processed then D_Position := First; D_Index := 1; Found := False; while D_Position < First + Size loop Unchecked_Next (String.Value, D_Position, C); D_Index := D_Index + 1; if C = Colon then if Found then -- Second colon found in qualified name, document is not -- wellformed. Identifier := No_Symbol; Qname_Error := Multiple_Colons; return; else -- Colon occupy one code unit, use this fact instead of -- more expensive Unchecked_Previous. C_Position := D_Position - 1; C_Index := D_Index - 1; Found := True; end if; end if; end loop; if Found then if C_Position = First then -- Colon is the first character in the qualified name, -- document is not wellformed. Identifier := No_Symbol; Qname_Error := Colon_At_Start; return; elsif C_Position = First + Size - 1 then -- Colon is the last character in the qualified name, -- document is not wellformed. Identifier := No_Symbol; Qname_Error := Colon_At_End; return; end if; -- Check whether the first character after colon belongs to -- NSNameStartChar. D_Position := C_Position + 1; Unchecked_Next (String.Value, D_Position, C); if not Is_Valid_NS_Name_Start_Character (C) then Identifier := No_Symbol; Qname_Error := First_Character_Is_Not_NS_Name_Start_Char; return; end if; Insert (Self, String, First, C_Position - First, C_Index - 1, False, Qname_Error, Prefix_Name); Insert (Self, String, C_Position + 1, First + Size - C_Position - 1, Length - C_Index, False, Qname_Error, Local_Name); Self.Table (Identifier).Prefix_Name := Prefix_Name; Self.Table (Identifier).Local_Name := Local_Name; else Self.Table (Identifier).Local_Name := Identifier; end if; Self.Table (Identifier).Namespace_Processed := True; end if; Qname_Error := Valid; end Insert; ------------ -- Insert -- ------------ procedure Insert (Self : in out Symbol_Table; String : not null Matreshka.Internals.Strings.Shared_String_Access; Identifier : out Symbol_Identifier) is Error : Qualified_Name_Errors; begin Insert (Self, String, 0, String.Unused, String.Length, False, Error, Identifier); end Insert; -------------------------------------- -- Is_Valid_NS_Name_Start_Character -- -------------------------------------- function Is_Valid_NS_Name_Start_Character (Code : Matreshka.Internals.Unicode.Code_Point) return Boolean is use type Matreshka.Internals.Unicode.Code_Point; begin return Code in 16#0041# .. 16#005A# -- A-Z or Code = 16#005F# -- _ or Code in 16#0061# .. 16#007A# -- a-z or Code in 16#00C0# .. 16#00D6# -- \u00C0-\u00D6 or Code in 16#00D8# .. 16#00F6# -- \u00D8-\u00F6 or Code in 16#00F8# .. 16#02FF# -- \u00F8-\u02FF or Code in 16#0370# .. 16#037D# -- \u0370-\u037D or Code in 16#037F# .. 16#1FFF# -- \u037F-\u1FFF or Code in 16#200C# .. 16#200D# -- \u200C-\u200D or Code in 16#2070# .. 16#218F# -- \u2070-\u218F or Code in 16#2C00# .. 16#2FEF# -- \u2C00-\u2FEF or Code in 16#3001# .. 16#D7FF# -- \u3001-\uD7FF or Code in 16#F900# .. 16#FDCF# -- \uF900-\uFDCF or Code in 16#FDF0# .. 16#FFFD# -- \uFDF0-\uFFFD or Code in 16#10000# .. 16#EFFFF#; -- \u10000-\uEFFFF end Is_Valid_NS_Name_Start_Character; ---------------- -- Local_Name -- ---------------- function Local_Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return Symbol_Identifier is begin return Self.Table (Identifier).Local_Name; end Local_Name; ---------------- -- Local_Name -- ---------------- function Local_Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return not null Matreshka.Internals.Strings.Shared_String_Access is begin return Self.Table (Self.Table (Identifier).Local_Name).String; end Local_Name; ---------- -- Name -- ---------- function Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return not null Matreshka.Internals.Strings.Shared_String_Access is begin return Self.Table (Identifier).String; end Name; ---------- -- Name -- ---------- function Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return League.Strings.Universal_String is begin return League.Strings.Internals.Create (Self.Table (Identifier).String); end Name; -------------- -- Notation -- -------------- function Notation (Self : Symbol_Table; Identifier : Symbol_Identifier) return Notation_Identifier is begin return Self.Table (Identifier).Notation; end Notation; ---------------------- -- Parameter_Entity -- ---------------------- function Parameter_Entity (Self : Symbol_Table; Identifier : Symbol_Identifier) return Entity_Identifier is begin return Self.Table (Identifier).Parameter_Entity; end Parameter_Entity; ----------------- -- Prefix_Name -- ----------------- function Prefix_Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return Symbol_Identifier is begin return Self.Table (Identifier).Prefix_Name; end Prefix_Name; ----------- -- Reset -- ----------- procedure Reset (Self : in out Symbol_Table) is begin Finalize (Self); Initialize (Self); end Reset; ----------------- -- Set_Element -- ----------------- procedure Set_Element (Self : in out Symbol_Table; Identifier : Symbol_Identifier; Element : Element_Identifier) is begin Self.Table (Identifier).Element := Element; end Set_Element; ------------------------ -- Set_General_Entity -- ------------------------ procedure Set_General_Entity (Self : in out Symbol_Table; Identifier : Symbol_Identifier; Entity : Entity_Identifier) is begin Self.Table (Identifier).General_Entity := Entity; end Set_General_Entity; ------------------ -- Set_Notation -- ------------------ procedure Set_Notation (Self : in out Symbol_Table; Identifier : Symbol_Identifier; Notation : Notation_Identifier) is begin Self.Table (Identifier).Notation := Notation; end Set_Notation; -------------------------- -- Set_Parameter_Entity -- -------------------------- procedure Set_Parameter_Entity (Self : in out Symbol_Table; Identifier : Symbol_Identifier; Entity : Entity_Identifier) is begin Self.Table (Identifier).Parameter_Entity := Entity; end Set_Parameter_Entity; end Matreshka.Internals.XML.Symbol_Tables;
6700
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2017, <NAME> <<EMAIL>> -- -- 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 symbol table to store frequently used strings, -- allocate identifier for them and reduce number of memory allocations by -- reusing shared strings. ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; with League.Strings.Internals; with Matreshka.Internals.Strings.Operations; with Matreshka.Internals.Unicode.Characters.Latin; package body Matreshka.Internals.XML.Symbol_Tables is use Matreshka.Internals.Unicode.Characters.Latin; procedure Free is new Ada.Unchecked_Deallocation (Symbol_Record_Array, Symbol_Record_Array_Access); function Is_Valid_NS_Name_Start_Character (Code : Matreshka.Internals.Unicode.Code_Point) return Boolean; -- Returns True when code point belongs to NSNameStartChar. ------------- -- Element -- ------------- function Element (Self : Symbol_Table; Identifier : Symbol_Identifier) return Element_Identifier is begin return Self.Table (Identifier).Element; end Element; -------------- -- Finalize -- -------------- procedure Finalize (Self : in out Symbol_Table) is begin for J in Self.Table'First .. Self.Last loop Matreshka.Internals.Strings.Dereference (Self.Table (J).String); end loop; Free (Self.Table); end Finalize; -------------------- -- General_Entity -- -------------------- function General_Entity (Self : Symbol_Table; Identifier : Symbol_Identifier) return Entity_Identifier is begin return Self.Table (Identifier).General_Entity; end General_Entity; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out Symbol_Table) is procedure Register_Predefined_Entity (Name : League.Strings.Universal_String; Entity : Entity_Identifier); -- Registers predefined entity. procedure Register_Symbol (Name : League.Strings.Universal_String); -------------------------------- -- Register_Predefined_Entity -- -------------------------------- procedure Register_Predefined_Entity (Name : League.Strings.Universal_String; Entity : Entity_Identifier) is N : constant Matreshka.Internals.Strings.Shared_String_Access := League.Strings.Internals.Internal (Name); begin Matreshka.Internals.Strings.Reference (N); Self.Last := Self.Last + 1; Self.Table (Self.Last) := (String => N, Namespace_Processed => False, Prefix_Name => No_Symbol, Local_Name => No_Symbol, Element => No_Element, Notation => No_Notation, Parameter_Entity => No_Entity, General_Entity => Entity); end Register_Predefined_Entity; --------------------- -- Register_Symbol -- --------------------- procedure Register_Symbol (Name : League.Strings.Universal_String) is N : constant Matreshka.Internals.Strings.Shared_String_Access := League.Strings.Internals.Internal (Name); begin Matreshka.Internals.Strings.Reference (N); Self.Last := Self.Last + 1; Self.Table (Self.Last) := (String => N, Namespace_Processed => False, Prefix_Name => No_Symbol, Local_Name => No_Symbol, Element => No_Element, Notation => No_Notation, Parameter_Entity => No_Entity, General_Entity => No_Entity); end Register_Symbol; begin Self.Table := new Symbol_Record_Array (0 .. 31); Self.Table (No_Symbol) := (String => Matreshka.Internals.Strings.Shared_Empty'Access, Namespace_Processed => True, Prefix_Name => No_Symbol, Local_Name => No_Symbol, Element => No_Element, Notation => No_Notation, Parameter_Entity => No_Entity, General_Entity => No_Entity); Self.Last := No_Symbol; -- Register predefined entities. Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("lt"), Entity => Entity_lt); Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("gt"), Entity => Entity_gt); Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("amp"), Entity => Entity_amp); Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("apos"), Entity => Entity_apos); Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("quot"), Entity => Entity_quot); -- Register attribute type's names. Register_Symbol (League.Strings.To_Universal_String ("CDATA")); Register_Symbol (League.Strings.To_Universal_String ("ID")); Register_Symbol (League.Strings.To_Universal_String ("IDREF")); Register_Symbol (League.Strings.To_Universal_String ("IDREFS")); Register_Symbol (League.Strings.To_Universal_String ("NMTOKEN")); Register_Symbol (League.Strings.To_Universal_String ("NMTOKENS")); Register_Symbol (League.Strings.To_Universal_String ("ENTITY")); Register_Symbol (League.Strings.To_Universal_String ("ENTITIES")); Register_Symbol (League.Strings.To_Universal_String ("NOTATION")); -- Register well known names and namespaces. Register_Symbol (League.Strings.To_Universal_String ("xml")); Register_Symbol (League.Strings.To_Universal_String ("xmlns")); Register_Symbol (League.Strings.To_Universal_String ("http://www.w3.org/XML/1998/namespace")); Register_Symbol (League.Strings.To_Universal_String ("http://www.w3.org/2000/xmlns/")); Register_Symbol (League.Strings.To_Universal_String ("xml:base")); end Initialize; ------------ -- Insert -- ------------ procedure Insert (Self : in out Symbol_Table; String : not null Matreshka.Internals.Strings.Shared_String_Access; First : Matreshka.Internals.Utf16.Utf16_String_Index; Size : Matreshka.Internals.Utf16.Utf16_String_Index; Length : Natural; Namespaces : Boolean; Qname_Error : out Qualified_Name_Errors; Identifier : out Symbol_Identifier) is use Matreshka.Internals.Unicode; use Matreshka.Internals.Utf16; D_Position : Utf16_String_Index; D_Index : Natural; C : Code_Point; C_Position : Utf16_String_Index; C_Index : Natural; Found : Boolean := False; N_Position : Utf16_String_Index; T_Position : Utf16_String_Index; Prefix_Name : Symbol_Identifier; Local_Name : Symbol_Identifier; begin for J in Self.Table'First .. Self.Last loop if Self.Table (J).String.Unused = Size then N_Position := First; T_Position := 0; while N_Position < First + Size loop exit when String.Value (N_Position) /= Self.Table (J).String.Value (T_Position); N_Position := N_Position + 1; T_Position := T_Position + 1; end loop; if N_Position = First + Size then Identifier := J; Found := True; exit; end if; end if; end loop; if not Found then Self.Last := Self.Last + 1; Identifier := Self.Last; if Self.Last > Self.Table'Last then declare Old : Symbol_Record_Array_Access := Self.Table; begin Self.Table := new Symbol_Record_Array (0 .. Old'Last + 32); Self.Table (Old'Range) := Old.all; Free (Old); end; end if; Self.Table (Identifier) := (String => Matreshka.Internals.Strings.Operations.Slice (String, First, Size, Length), Namespace_Processed => False, Prefix_Name => No_Symbol, Local_Name => No_Symbol, Element => No_Element, Notation => No_Notation, Parameter_Entity => No_Entity, General_Entity => No_Entity); end if; if Namespaces and then not Self.Table (Identifier).Namespace_Processed then D_Position := First; D_Index := 1; Found := False; while D_Position < First + Size loop Unchecked_Next (String.Value, D_Position, C); D_Index := D_Index + 1; if C = Colon then if Found then -- Second colon found in qualified name, document is not -- wellformed. Identifier := No_Symbol; Qname_Error := Multiple_Colons; return; else -- Colon occupy one code unit, use this fact instead of -- more expensive Unchecked_Previous. C_Position := D_Position - 1; C_Index := D_Index - 1; Found := True; end if; end if; end loop; if Found then if C_Position = First then -- Colon is the first character in the qualified name, -- document is not wellformed. Identifier := No_Symbol; Qname_Error := Colon_At_Start; return; elsif C_Position = First + Size - 1 then -- Colon is the last character in the qualified name, -- document is not wellformed. Identifier := No_Symbol; Qname_Error := Colon_At_End; return; end if; -- Check whether the first character after colon belongs to -- NSNameStartChar. D_Position := C_Position + 1; Unchecked_Next (String.Value, D_Position, C); if not Is_Valid_NS_Name_Start_Character (C) then Identifier := No_Symbol; Qname_Error := First_Character_Is_Not_NS_Name_Start_Char; return; end if; Insert (Self, String, First, C_Position - First, C_Index - 1, False, Qname_Error, Prefix_Name); Insert (Self, String, C_Position + 1, First + Size - C_Position - 1, Length - C_Index, False, Qname_Error, Local_Name); Self.Table (Identifier).Prefix_Name := Prefix_Name; Self.Table (Identifier).Local_Name := Local_Name; else Self.Table (Identifier).Local_Name := Identifier; end if; Self.Table (Identifier).Namespace_Processed := True; end if; Qname_Error := Valid; end Insert; ------------ -- Insert -- ------------ procedure Insert (Self : in out Symbol_Table; String : not null Matreshka.Internals.Strings.Shared_String_Access; Identifier : out Symbol_Identifier) is Error : Qualified_Name_Errors; begin Insert (Self, String, 0, String.Unused, String.Length, False, Error, Identifier); end Insert; -------------------------------------- -- Is_Valid_NS_Name_Start_Character -- -------------------------------------- function Is_Valid_NS_Name_Start_Character (Code : Matreshka.Internals.Unicode.Code_Point) return Boolean is use type Matreshka.Internals.Unicode.Code_Point; begin return Code in 16#0041# .. 16#005A# -- A-Z or Code = 16#005F# -- _ or Code in 16#0061# .. 16#007A# -- a-z or Code in 16#00C0# .. 16#00D6# -- \u00C0-\u00D6 or Code in 16#00D8# .. 16#00F6# -- \u00D8-\u00F6 or Code in 16#00F8# .. 16#02FF# -- \u00F8-\u02FF or Code in 16#0370# .. 16#037D# -- \u0370-\u037D or Code in 16#037F# .. 16#1FFF# -- \u037F-\u1FFF or Code in 16#200C# .. 16#200D# -- \u200C-\u200D or Code in 16#2070# .. 16#218F# -- \u2070-\u218F or Code in 16#2C00# .. 16#2FEF# -- \u2C00-\u2FEF or Code in 16#3001# .. 16#D7FF# -- \u3001-\uD7FF or Code in 16#F900# .. 16#FDCF# -- \uF900-\uFDCF or Code in 16#FDF0# .. 16#FFFD# -- \uFDF0-\uFFFD or Code in 16#10000# .. 16#EFFFF#; -- \u10000-\uEFFFF end Is_Valid_NS_Name_Start_Character; ---------------- -- Local_Name -- ---------------- function Local_Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return Symbol_Identifier is begin return Self.Table (Identifier).Local_Name; end Local_Name; ---------------- -- Local_Name -- ---------------- function Local_Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return not null Matreshka.Internals.Strings.Shared_String_Access is begin return Self.Table (Self.Table (Identifier).Local_Name).String; end Local_Name; ---------- -- Name -- ---------- function Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return not null Matreshka.Internals.Strings.Shared_String_Access is begin return Self.Table (Identifier).String; end Name; ---------- -- Name -- ---------- function Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return League.Strings.Universal_String is begin return League.Strings.Internals.Create (Self.Table (Identifier).String); end Name; -------------- -- Notation -- -------------- function Notation (Self : Symbol_Table; Identifier : Symbol_Identifier) return Notation_Identifier is begin return Self.Table (Identifier).Notation; end Notation; ---------------------- -- Parameter_Entity -- ---------------------- function Parameter_Entity (Self : Symbol_Table; Identifier : Symbol_Identifier) return Entity_Identifier is begin return Self.Table (Identifier).Parameter_Entity; end Parameter_Entity; ----------------- -- Prefix_Name -- ----------------- function Prefix_Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return Symbol_Identifier is begin return Self.Table (Identifier).Prefix_Name; end Prefix_Name; ----------- -- Reset -- ----------- procedure Reset (Self : in out Symbol_Table) is begin Finalize (Self); Initialize (Self); end Reset; ----------------- -- Set_Element -- ----------------- procedure Set_Element (Self : in out Symbol_Table; Identifier : Symbol_Identifier; Element : Element_Identifier) is begin Self.Table (Identifier).Element := Element; end Set_Element; ------------------------ -- Set_General_Entity -- ------------------------ procedure Set_General_Entity (Self : in out Symbol_Table; Identifier : Symbol_Identifier; Entity : Entity_Identifier) is begin Self.Table (Identifier).General_Entity := Entity; end Set_General_Entity; ------------------ -- Set_Notation -- ------------------ procedure Set_Notation (Self : in out Symbol_Table; Identifier : Symbol_Identifier; Notation : Notation_Identifier) is begin Self.Table (Identifier).Notation := Notation; end Set_Notation; -------------------------- -- Set_Parameter_Entity -- -------------------------- procedure Set_Parameter_Entity (Self : in out Symbol_Table; Identifier : Symbol_Identifier; Entity : Entity_Identifier) is begin Self.Table (Identifier).Parameter_Entity := Entity; end Set_Parameter_Entity; end Matreshka.Internals.XML.Symbol_Tables;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- XML Processor -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2017, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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 symbol table to store frequently used strings, -- allocate identifier for them and reduce number of memory allocations by -- reusing shared strings. ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; with League.Strings.Internals; with Matreshka.Internals.Strings.Operations; with Matreshka.Internals.Unicode.Characters.Latin; package body Matreshka.Internals.XML.Symbol_Tables is use Matreshka.Internals.Unicode.Characters.Latin; procedure Free is new Ada.Unchecked_Deallocation (Symbol_Record_Array, Symbol_Record_Array_Access); function Is_Valid_NS_Name_Start_Character (Code : Matreshka.Internals.Unicode.Code_Point) return Boolean; -- Returns True when code point belongs to NSNameStartChar. ------------- -- Element -- ------------- function Element (Self : Symbol_Table; Identifier : Symbol_Identifier) return Element_Identifier is begin return Self.Table (Identifier).Element; end Element; -------------- -- Finalize -- -------------- procedure Finalize (Self : in out Symbol_Table) is begin for J in Self.Table'First .. Self.Last loop Matreshka.Internals.Strings.Dereference (Self.Table (J).String); end loop; Free (Self.Table); end Finalize; -------------------- -- General_Entity -- -------------------- function General_Entity (Self : Symbol_Table; Identifier : Symbol_Identifier) return Entity_Identifier is begin return Self.Table (Identifier).General_Entity; end General_Entity; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : in out Symbol_Table) is procedure Register_Predefined_Entity (Name : League.Strings.Universal_String; Entity : Entity_Identifier); -- Registers predefined entity. procedure Register_Symbol (Name : League.Strings.Universal_String); -------------------------------- -- Register_Predefined_Entity -- -------------------------------- procedure Register_Predefined_Entity (Name : League.Strings.Universal_String; Entity : Entity_Identifier) is N : constant Matreshka.Internals.Strings.Shared_String_Access := League.Strings.Internals.Internal (Name); begin Matreshka.Internals.Strings.Reference (N); Self.Last := Self.Last + 1; Self.Table (Self.Last) := (String => N, Namespace_Processed => False, Prefix_Name => No_Symbol, Local_Name => No_Symbol, Element => No_Element, Notation => No_Notation, Parameter_Entity => No_Entity, General_Entity => Entity); end Register_Predefined_Entity; --------------------- -- Register_Symbol -- --------------------- procedure Register_Symbol (Name : League.Strings.Universal_String) is N : constant Matreshka.Internals.Strings.Shared_String_Access := League.Strings.Internals.Internal (Name); begin Matreshka.Internals.Strings.Reference (N); Self.Last := Self.Last + 1; Self.Table (Self.Last) := (String => N, Namespace_Processed => False, Prefix_Name => No_Symbol, Local_Name => No_Symbol, Element => No_Element, Notation => No_Notation, Parameter_Entity => No_Entity, General_Entity => No_Entity); end Register_Symbol; begin Self.Table := new Symbol_Record_Array (0 .. 31); Self.Table (No_Symbol) := (String => Matreshka.Internals.Strings.Shared_Empty'Access, Namespace_Processed => True, Prefix_Name => No_Symbol, Local_Name => No_Symbol, Element => No_Element, Notation => No_Notation, Parameter_Entity => No_Entity, General_Entity => No_Entity); Self.Last := No_Symbol; -- Register predefined entities. Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("lt"), Entity => Entity_lt); Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("gt"), Entity => Entity_gt); Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("amp"), Entity => Entity_amp); Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("apos"), Entity => Entity_apos); Register_Predefined_Entity (Name => League.Strings.To_Universal_String ("quot"), Entity => Entity_quot); -- Register attribute type's names. Register_Symbol (League.Strings.To_Universal_String ("CDATA")); Register_Symbol (League.Strings.To_Universal_String ("ID")); Register_Symbol (League.Strings.To_Universal_String ("IDREF")); Register_Symbol (League.Strings.To_Universal_String ("IDREFS")); Register_Symbol (League.Strings.To_Universal_String ("NMTOKEN")); Register_Symbol (League.Strings.To_Universal_String ("NMTOKENS")); Register_Symbol (League.Strings.To_Universal_String ("ENTITY")); Register_Symbol (League.Strings.To_Universal_String ("ENTITIES")); Register_Symbol (League.Strings.To_Universal_String ("NOTATION")); -- Register well known names and namespaces. Register_Symbol (League.Strings.To_Universal_String ("xml")); Register_Symbol (League.Strings.To_Universal_String ("xmlns")); Register_Symbol (League.Strings.To_Universal_String ("http://www.w3.org/XML/1998/namespace")); Register_Symbol (League.Strings.To_Universal_String ("http://www.w3.org/2000/xmlns/")); Register_Symbol (League.Strings.To_Universal_String ("xml:base")); end Initialize; ------------ -- Insert -- ------------ procedure Insert (Self : in out Symbol_Table; String : not null Matreshka.Internals.Strings.Shared_String_Access; First : Matreshka.Internals.Utf16.Utf16_String_Index; Size : Matreshka.Internals.Utf16.Utf16_String_Index; Length : Natural; Namespaces : Boolean; Qname_Error : out Qualified_Name_Errors; Identifier : out Symbol_Identifier) is use Matreshka.Internals.Unicode; use Matreshka.Internals.Utf16; D_Position : Utf16_String_Index; D_Index : Natural; C : Code_Point; C_Position : Utf16_String_Index; C_Index : Natural; Found : Boolean := False; N_Position : Utf16_String_Index; T_Position : Utf16_String_Index; Prefix_Name : Symbol_Identifier; Local_Name : Symbol_Identifier; begin for J in Self.Table'First .. Self.Last loop if Self.Table (J).String.Unused = Size then N_Position := First; T_Position := 0; while N_Position < First + Size loop exit when String.Value (N_Position) /= Self.Table (J).String.Value (T_Position); N_Position := N_Position + 1; T_Position := T_Position + 1; end loop; if N_Position = First + Size then Identifier := J; Found := True; exit; end if; end if; end loop; if not Found then Self.Last := Self.Last + 1; Identifier := Self.Last; if Self.Last > Self.Table'Last then declare Old : Symbol_Record_Array_Access := Self.Table; begin Self.Table := new Symbol_Record_Array (0 .. Old'Last + 32); Self.Table (Old'Range) := Old.all; Free (Old); end; end if; Self.Table (Identifier) := (String => Matreshka.Internals.Strings.Operations.Slice (String, First, Size, Length), Namespace_Processed => False, Prefix_Name => No_Symbol, Local_Name => No_Symbol, Element => No_Element, Notation => No_Notation, Parameter_Entity => No_Entity, General_Entity => No_Entity); end if; if Namespaces and then not Self.Table (Identifier).Namespace_Processed then D_Position := First; D_Index := 1; Found := False; while D_Position < First + Size loop Unchecked_Next (String.Value, D_Position, C); D_Index := D_Index + 1; if C = Colon then if Found then -- Second colon found in qualified name, document is not -- wellformed. Identifier := No_Symbol; Qname_Error := Multiple_Colons; return; else -- Colon occupy one code unit, use this fact instead of -- more expensive Unchecked_Previous. C_Position := D_Position - 1; C_Index := D_Index - 1; Found := True; end if; end if; end loop; if Found then if C_Position = First then -- Colon is the first character in the qualified name, -- document is not wellformed. Identifier := No_Symbol; Qname_Error := Colon_At_Start; return; elsif C_Position = First + Size - 1 then -- Colon is the last character in the qualified name, -- document is not wellformed. Identifier := No_Symbol; Qname_Error := Colon_At_End; return; end if; -- Check whether the first character after colon belongs to -- NSNameStartChar. D_Position := C_Position + 1; Unchecked_Next (String.Value, D_Position, C); if not Is_Valid_NS_Name_Start_Character (C) then Identifier := No_Symbol; Qname_Error := First_Character_Is_Not_NS_Name_Start_Char; return; end if; Insert (Self, String, First, C_Position - First, C_Index - 1, False, Qname_Error, Prefix_Name); Insert (Self, String, C_Position + 1, First + Size - C_Position - 1, Length - C_Index, False, Qname_Error, Local_Name); Self.Table (Identifier).Prefix_Name := Prefix_Name; Self.Table (Identifier).Local_Name := Local_Name; else Self.Table (Identifier).Local_Name := Identifier; end if; Self.Table (Identifier).Namespace_Processed := True; end if; Qname_Error := Valid; end Insert; ------------ -- Insert -- ------------ procedure Insert (Self : in out Symbol_Table; String : not null Matreshka.Internals.Strings.Shared_String_Access; Identifier : out Symbol_Identifier) is Error : Qualified_Name_Errors; begin Insert (Self, String, 0, String.Unused, String.Length, False, Error, Identifier); end Insert; -------------------------------------- -- Is_Valid_NS_Name_Start_Character -- -------------------------------------- function Is_Valid_NS_Name_Start_Character (Code : Matreshka.Internals.Unicode.Code_Point) return Boolean is use type Matreshka.Internals.Unicode.Code_Point; begin return Code in 16#0041# .. 16#005A# -- A-Z or Code = 16#005F# -- _ or Code in 16#0061# .. 16#007A# -- a-z or Code in 16#00C0# .. 16#00D6# -- \u00C0-\u00D6 or Code in 16#00D8# .. 16#00F6# -- \u00D8-\u00F6 or Code in 16#00F8# .. 16#02FF# -- \u00F8-\u02FF or Code in 16#0370# .. 16#037D# -- \u0370-\u037D or Code in 16#037F# .. 16#1FFF# -- \u037F-\u1FFF or Code in 16#200C# .. 16#200D# -- \u200C-\u200D or Code in 16#2070# .. 16#218F# -- \u2070-\u218F or Code in 16#2C00# .. 16#2FEF# -- \u2C00-\u2FEF or Code in 16#3001# .. 16#D7FF# -- \u3001-\uD7FF or Code in 16#F900# .. 16#FDCF# -- \uF900-\uFDCF or Code in 16#FDF0# .. 16#FFFD# -- \uFDF0-\uFFFD or Code in 16#10000# .. 16#EFFFF#; -- \u10000-\uEFFFF end Is_Valid_NS_Name_Start_Character; ---------------- -- Local_Name -- ---------------- function Local_Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return Symbol_Identifier is begin return Self.Table (Identifier).Local_Name; end Local_Name; ---------------- -- Local_Name -- ---------------- function Local_Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return not null Matreshka.Internals.Strings.Shared_String_Access is begin return Self.Table (Self.Table (Identifier).Local_Name).String; end Local_Name; ---------- -- Name -- ---------- function Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return not null Matreshka.Internals.Strings.Shared_String_Access is begin return Self.Table (Identifier).String; end Name; ---------- -- Name -- ---------- function Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return League.Strings.Universal_String is begin return League.Strings.Internals.Create (Self.Table (Identifier).String); end Name; -------------- -- Notation -- -------------- function Notation (Self : Symbol_Table; Identifier : Symbol_Identifier) return Notation_Identifier is begin return Self.Table (Identifier).Notation; end Notation; ---------------------- -- Parameter_Entity -- ---------------------- function Parameter_Entity (Self : Symbol_Table; Identifier : Symbol_Identifier) return Entity_Identifier is begin return Self.Table (Identifier).Parameter_Entity; end Parameter_Entity; ----------------- -- Prefix_Name -- ----------------- function Prefix_Name (Self : Symbol_Table; Identifier : Symbol_Identifier) return Symbol_Identifier is begin return Self.Table (Identifier).Prefix_Name; end Prefix_Name; ----------- -- Reset -- ----------- procedure Reset (Self : in out Symbol_Table) is begin Finalize (Self); Initialize (Self); end Reset; ----------------- -- Set_Element -- ----------------- procedure Set_Element (Self : in out Symbol_Table; Identifier : Symbol_Identifier; Element : Element_Identifier) is begin Self.Table (Identifier).Element := Element; end Set_Element; ------------------------ -- Set_General_Entity -- ------------------------ procedure Set_General_Entity (Self : in out Symbol_Table; Identifier : Symbol_Identifier; Entity : Entity_Identifier) is begin Self.Table (Identifier).General_Entity := Entity; end Set_General_Entity; ------------------ -- Set_Notation -- ------------------ procedure Set_Notation (Self : in out Symbol_Table; Identifier : Symbol_Identifier; Notation : Notation_Identifier) is begin Self.Table (Identifier).Notation := Notation; end Set_Notation; -------------------------- -- Set_Parameter_Entity -- -------------------------- procedure Set_Parameter_Entity (Self : in out Symbol_Table; Identifier : Symbol_Identifier; Entity : Entity_Identifier) is begin Self.Table (Identifier).Parameter_Entity := Entity; end Set_Parameter_Entity; end Matreshka.Internals.XML.Symbol_Tables;
[ { "context": "elpers for service contexts\n-- Copyright (C) 2013 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 167, "score": 0.9998733401298523, "start": 152, "tag": "NAME", "value": "Stephane Carrez" }, { "context": " Copyright (C) 2013 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 198, "score": 0.9998806118965149, "start": 183, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "3 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 225, "score": 0.999927818775177, "start": 200, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
awa/awaunit/awa-tests-helpers-contexts.adb
fuzzysloth/ada-awa
81
----------------------------------------------------------------------- -- users-tests-contexts -- Helpers for service contexts -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body AWA.Tests.Helpers.Contexts is -- ------------------------------ -- Get the attribute registered under the given name in the HTTP session. -- ------------------------------ overriding function Get_Session_Attribute (Ctx : in Service_Context; Name : in String) return Util.Beans.Objects.Object is Pos : constant Util.Beans.Objects.Maps.Cursor := Ctx.Session_Attributes.Find (Name); begin if Util.Beans.Objects.Maps.Has_Element (Pos) then return Util.Beans.Objects.Maps.Element (Pos); else return Util.Beans.Objects.Null_Object; end if; end Get_Session_Attribute; -- ------------------------------ -- Set the attribute registered under the given name in the HTTP session. -- ------------------------------ overriding procedure Set_Session_Attribute (Ctx : in out Service_Context; Name : in String; Value : in Util.Beans.Objects.Object) is begin Ctx.Session_Attributes.Include (Name, Value); end Set_Session_Attribute; end AWA.Tests.Helpers.Contexts;
25311
----------------------------------------------------------------------- -- users-tests-contexts -- Helpers for service contexts -- Copyright (C) 2013 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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 AWA.Tests.Helpers.Contexts is -- ------------------------------ -- Get the attribute registered under the given name in the HTTP session. -- ------------------------------ overriding function Get_Session_Attribute (Ctx : in Service_Context; Name : in String) return Util.Beans.Objects.Object is Pos : constant Util.Beans.Objects.Maps.Cursor := Ctx.Session_Attributes.Find (Name); begin if Util.Beans.Objects.Maps.Has_Element (Pos) then return Util.Beans.Objects.Maps.Element (Pos); else return Util.Beans.Objects.Null_Object; end if; end Get_Session_Attribute; -- ------------------------------ -- Set the attribute registered under the given name in the HTTP session. -- ------------------------------ overriding procedure Set_Session_Attribute (Ctx : in out Service_Context; Name : in String; Value : in Util.Beans.Objects.Object) is begin Ctx.Session_Attributes.Include (Name, Value); end Set_Session_Attribute; end AWA.Tests.Helpers.Contexts;
true
----------------------------------------------------------------------- -- users-tests-contexts -- Helpers for service contexts -- Copyright (C) 2013 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- 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 AWA.Tests.Helpers.Contexts is -- ------------------------------ -- Get the attribute registered under the given name in the HTTP session. -- ------------------------------ overriding function Get_Session_Attribute (Ctx : in Service_Context; Name : in String) return Util.Beans.Objects.Object is Pos : constant Util.Beans.Objects.Maps.Cursor := Ctx.Session_Attributes.Find (Name); begin if Util.Beans.Objects.Maps.Has_Element (Pos) then return Util.Beans.Objects.Maps.Element (Pos); else return Util.Beans.Objects.Null_Object; end if; end Get_Session_Attribute; -- ------------------------------ -- Set the attribute registered under the given name in the HTTP session. -- ------------------------------ overriding procedure Set_Session_Attribute (Ctx : in out Service_Context; Name : in String; Value : in Util.Beans.Objects.Object) is begin Ctx.Session_Attributes.Include (Name, Value); end Set_Session_Attribute; end AWA.Tests.Helpers.Contexts;
[ { "context": " --\n-- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> --\n-- Al", "end": 824, "score": 0.9998863339424133, "start": 811, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> --\n-- All rights reserved. ", "end": 844, "score": 0.9999317526817322, "start": 826, "tag": "EMAIL", "value": "vgodunko@gmail.com" } ]
source/amf/mofext/amf-internals-mof_tags.ads
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Internals.MOF_Elements; with AMF.MOF.Tags; with AMF.UML.Comments.Collections; with AMF.UML.Elements.Collections; with AMF.Visitors; package AMF.Internals.MOF_Tags is type MOF_Tag_Proxy is limited new AMF.Internals.MOF_Elements.MOF_Element_Proxy and AMF.MOF.Tags.MOF_Tag with null record; overriding function Get_Name (Self : not null access constant MOF_Tag_Proxy) return League.Strings.Universal_String; -- Getter of Tag::name. -- overriding procedure Set_Name (Self : not null access MOF_Tag_Proxy; To : League.Strings.Universal_String); -- Setter of Tag::name. -- overriding function Get_Value (Self : not null access constant MOF_Tag_Proxy) return League.Strings.Universal_String; -- Getter of Tag::value. -- overriding procedure Set_Value (Self : not null access MOF_Tag_Proxy; To : League.Strings.Universal_String); -- Setter of Tag::value. -- overriding function Get_Element (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Tag::element. -- overriding function Get_Tag_Owner (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.UML_Element_Access; -- Getter of Tag::tagOwner. -- overriding procedure Set_Tag_Owner (Self : not null access MOF_Tag_Proxy; To : AMF.UML.Elements.UML_Element_Access); -- Setter of Tag::tagOwner. -- overriding function Get_Owned_Comment (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Comments.Collections.Set_Of_UML_Comment; -- Getter of Element::ownedComment. -- -- The Comments owned by this element. overriding function Get_Owned_Element (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Element::ownedElement. -- -- The Elements owned by this element. overriding function Get_Owner (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.UML_Element_Access; -- Getter of Element::owner. -- -- The Element that owns this element. overriding function All_Owned_Elements (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Operation Element::allOwnedElements. -- -- The query allOwnedElements() gives all of the direct and indirect owned -- elements of an element. overriding function Must_Be_Owned (Self : not null access constant MOF_Tag_Proxy) return Boolean; -- Operation Element::mustBeOwned. -- -- The query mustBeOwned() indicates whether elements of this type must -- have an owner. Subclasses of Element that do not require an owner must -- override this operation. overriding procedure Enter_Element (Self : not null access constant MOF_Tag_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Leave_Element (Self : not null access constant MOF_Tag_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Element (Self : not null access constant MOF_Tag_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of iterator interface. end AMF.Internals.MOF_Tags;
20771
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, <NAME> <<EMAIL>> -- -- 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.Internals.MOF_Elements; with AMF.MOF.Tags; with AMF.UML.Comments.Collections; with AMF.UML.Elements.Collections; with AMF.Visitors; package AMF.Internals.MOF_Tags is type MOF_Tag_Proxy is limited new AMF.Internals.MOF_Elements.MOF_Element_Proxy and AMF.MOF.Tags.MOF_Tag with null record; overriding function Get_Name (Self : not null access constant MOF_Tag_Proxy) return League.Strings.Universal_String; -- Getter of Tag::name. -- overriding procedure Set_Name (Self : not null access MOF_Tag_Proxy; To : League.Strings.Universal_String); -- Setter of Tag::name. -- overriding function Get_Value (Self : not null access constant MOF_Tag_Proxy) return League.Strings.Universal_String; -- Getter of Tag::value. -- overriding procedure Set_Value (Self : not null access MOF_Tag_Proxy; To : League.Strings.Universal_String); -- Setter of Tag::value. -- overriding function Get_Element (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Tag::element. -- overriding function Get_Tag_Owner (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.UML_Element_Access; -- Getter of Tag::tagOwner. -- overriding procedure Set_Tag_Owner (Self : not null access MOF_Tag_Proxy; To : AMF.UML.Elements.UML_Element_Access); -- Setter of Tag::tagOwner. -- overriding function Get_Owned_Comment (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Comments.Collections.Set_Of_UML_Comment; -- Getter of Element::ownedComment. -- -- The Comments owned by this element. overriding function Get_Owned_Element (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Element::ownedElement. -- -- The Elements owned by this element. overriding function Get_Owner (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.UML_Element_Access; -- Getter of Element::owner. -- -- The Element that owns this element. overriding function All_Owned_Elements (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Operation Element::allOwnedElements. -- -- The query allOwnedElements() gives all of the direct and indirect owned -- elements of an element. overriding function Must_Be_Owned (Self : not null access constant MOF_Tag_Proxy) return Boolean; -- Operation Element::mustBeOwned. -- -- The query mustBeOwned() indicates whether elements of this type must -- have an owner. Subclasses of Element that do not require an owner must -- override this operation. overriding procedure Enter_Element (Self : not null access constant MOF_Tag_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Leave_Element (Self : not null access constant MOF_Tag_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Element (Self : not null access constant MOF_Tag_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of iterator interface. end AMF.Internals.MOF_Tags;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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.Internals.MOF_Elements; with AMF.MOF.Tags; with AMF.UML.Comments.Collections; with AMF.UML.Elements.Collections; with AMF.Visitors; package AMF.Internals.MOF_Tags is type MOF_Tag_Proxy is limited new AMF.Internals.MOF_Elements.MOF_Element_Proxy and AMF.MOF.Tags.MOF_Tag with null record; overriding function Get_Name (Self : not null access constant MOF_Tag_Proxy) return League.Strings.Universal_String; -- Getter of Tag::name. -- overriding procedure Set_Name (Self : not null access MOF_Tag_Proxy; To : League.Strings.Universal_String); -- Setter of Tag::name. -- overriding function Get_Value (Self : not null access constant MOF_Tag_Proxy) return League.Strings.Universal_String; -- Getter of Tag::value. -- overriding procedure Set_Value (Self : not null access MOF_Tag_Proxy; To : League.Strings.Universal_String); -- Setter of Tag::value. -- overriding function Get_Element (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Tag::element. -- overriding function Get_Tag_Owner (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.UML_Element_Access; -- Getter of Tag::tagOwner. -- overriding procedure Set_Tag_Owner (Self : not null access MOF_Tag_Proxy; To : AMF.UML.Elements.UML_Element_Access); -- Setter of Tag::tagOwner. -- overriding function Get_Owned_Comment (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Comments.Collections.Set_Of_UML_Comment; -- Getter of Element::ownedComment. -- -- The Comments owned by this element. overriding function Get_Owned_Element (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Getter of Element::ownedElement. -- -- The Elements owned by this element. overriding function Get_Owner (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.UML_Element_Access; -- Getter of Element::owner. -- -- The Element that owns this element. overriding function All_Owned_Elements (Self : not null access constant MOF_Tag_Proxy) return AMF.UML.Elements.Collections.Set_Of_UML_Element; -- Operation Element::allOwnedElements. -- -- The query allOwnedElements() gives all of the direct and indirect owned -- elements of an element. overriding function Must_Be_Owned (Self : not null access constant MOF_Tag_Proxy) return Boolean; -- Operation Element::mustBeOwned. -- -- The query mustBeOwned() indicates whether elements of this type must -- have an owner. Subclasses of Element that do not require an owner must -- override this operation. overriding procedure Enter_Element (Self : not null access constant MOF_Tag_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Leave_Element (Self : not null access constant MOF_Tag_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of visitor interface. overriding procedure Visit_Element (Self : not null access constant MOF_Tag_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); -- Dispatch call to corresponding subprogram of iterator interface. end AMF.Internals.MOF_Tags;
[ { "context": "-- SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 43, "score": 0.999863862991333, "start": 33, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 63, "score": 0.9999313950538635, "start": 45, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
sources/ada/processes.adb
reznikmm/jupyter
4
-- SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- with Ada.Streams; with Ada.Exceptions; with League.Stream_Element_Vectors; with League.Text_Codecs; with Spawn.Environments; with Spawn.Processes.Monitor_Loop; with Spawn.Processes; with Spawn.String_Vectors; package body Processes is function "+" (Text : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; --------- -- Run -- --------- procedure Run (Program : League.Strings.Universal_String; Arguments : League.String_Vectors.Universal_String_Vector; Directory : League.Strings.Universal_String; Env : Environment := No_Env; Output : out League.Strings.Universal_String; Errors : out League.Strings.Universal_String; Status : out Integer) is type Listener is new Spawn.Processes.Process_Listener with record Output : League.Stream_Element_Vectors.Stream_Element_Vector; Errors : League.Stream_Element_Vectors.Stream_Element_Vector; Status : Integer := 0; Done : Boolean := False; Write : Boolean := True; end record; procedure Standard_Output_Available (Self : in out Listener); procedure Standard_Error_Available (Self : in out Listener); procedure Finished (Self : in out Listener; Exit_Status : Spawn.Processes.Process_Exit_Status; Exit_Code : Spawn.Processes.Process_Exit_Code); procedure Error_Occurred (Self : in out Listener; Process_Error : Integer); procedure Exception_Occurred (Self : in out Listener; Occurrence : Ada.Exceptions.Exception_Occurrence); Process : Spawn.Processes.Process; Codec : constant League.Text_Codecs.Text_Codec := League.Text_Codecs.Codec_For_Application_Locale; ------------------------------- -- Standard_Output_Available -- ------------------------------- procedure Standard_Output_Available (Self : in out Listener) is use type Ada.Streams.Stream_Element_Count; Data : Ada.Streams.Stream_Element_Array (1 .. 512); Last : Ada.Streams.Stream_Element_Count; begin loop Process.Read_Standard_Output (Data, Last); exit when Last < Data'First; Self.Output.Append (Data (1 .. Last)); end loop; end Standard_Output_Available; ------------------------------ -- Standard_Error_Available -- ------------------------------ procedure Standard_Error_Available (Self : in out Listener) is use type Ada.Streams.Stream_Element_Count; Data : Ada.Streams.Stream_Element_Array (1 .. 512); Last : Ada.Streams.Stream_Element_Count; begin loop Process.Read_Standard_Error (Data, Last); exit when Last < Data'First; Self.Errors.Append (Data (1 .. Last)); end loop; end Standard_Error_Available; -------------- -- Finished -- -------------- procedure Finished (Self : in out Listener; Exit_Status : Spawn.Processes.Process_Exit_Status; Exit_Code : Spawn.Processes.Process_Exit_Code) is pragma Unreferenced (Exit_Status); begin Self.Status := Integer (Exit_Code); Self.Done := True; end Finished; -------------------- -- Error_Occurred -- -------------------- procedure Error_Occurred (Self : in out Listener; Process_Error : Integer) is pragma Unreferenced (Self); begin Errors.Append (+"Error_Occurred"); Self.Status := Process_Error; Self.Done := True; end Error_Occurred; procedure Exception_Occurred (Self : in out Listener; Occurrence : Ada.Exceptions.Exception_Occurrence) is begin Errors.Append (League.Strings.From_UTF_8_String (Ada.Exceptions.Exception_Information (Occurrence))); Self.Status := -1; Self.Done := True; end Exception_Occurred; Args : Spawn.String_Vectors.UTF_8_String_Vector; Feedback : aliased Listener; begin Process.Set_Program (Program.To_UTF_8_String); for J in 1 .. Arguments.Length loop Args.Append (Arguments (J).To_UTF_8_String); end loop; if Env /= No_Env then declare Environment : Spawn.Environments.Process_Environment := Process.Environment; begin for J in 1 .. Env.Names.Length loop Environment.Insert (Env.Names (J).To_UTF_8_String, Env.Values (J).To_UTF_8_String); end loop; Process.Set_Environment (Environment); end; end if; Process.Set_Arguments (Args); Process.Set_Working_Directory (Directory.To_UTF_8_String); Process.Set_Listener (Feedback'Unchecked_Access); Process.Start; while not Feedback.Done loop Spawn.Processes.Monitor_Loop (Timeout => 50); end loop; Output := Codec.Decode (Feedback.Output); Errors.Append (Codec.Decode (Feedback.Errors)); Status := Feedback.Status; end Run; end Processes;
4215
-- SPDX-FileCopyrightText: 2020 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- with Ada.Streams; with Ada.Exceptions; with League.Stream_Element_Vectors; with League.Text_Codecs; with Spawn.Environments; with Spawn.Processes.Monitor_Loop; with Spawn.Processes; with Spawn.String_Vectors; package body Processes is function "+" (Text : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; --------- -- Run -- --------- procedure Run (Program : League.Strings.Universal_String; Arguments : League.String_Vectors.Universal_String_Vector; Directory : League.Strings.Universal_String; Env : Environment := No_Env; Output : out League.Strings.Universal_String; Errors : out League.Strings.Universal_String; Status : out Integer) is type Listener is new Spawn.Processes.Process_Listener with record Output : League.Stream_Element_Vectors.Stream_Element_Vector; Errors : League.Stream_Element_Vectors.Stream_Element_Vector; Status : Integer := 0; Done : Boolean := False; Write : Boolean := True; end record; procedure Standard_Output_Available (Self : in out Listener); procedure Standard_Error_Available (Self : in out Listener); procedure Finished (Self : in out Listener; Exit_Status : Spawn.Processes.Process_Exit_Status; Exit_Code : Spawn.Processes.Process_Exit_Code); procedure Error_Occurred (Self : in out Listener; Process_Error : Integer); procedure Exception_Occurred (Self : in out Listener; Occurrence : Ada.Exceptions.Exception_Occurrence); Process : Spawn.Processes.Process; Codec : constant League.Text_Codecs.Text_Codec := League.Text_Codecs.Codec_For_Application_Locale; ------------------------------- -- Standard_Output_Available -- ------------------------------- procedure Standard_Output_Available (Self : in out Listener) is use type Ada.Streams.Stream_Element_Count; Data : Ada.Streams.Stream_Element_Array (1 .. 512); Last : Ada.Streams.Stream_Element_Count; begin loop Process.Read_Standard_Output (Data, Last); exit when Last < Data'First; Self.Output.Append (Data (1 .. Last)); end loop; end Standard_Output_Available; ------------------------------ -- Standard_Error_Available -- ------------------------------ procedure Standard_Error_Available (Self : in out Listener) is use type Ada.Streams.Stream_Element_Count; Data : Ada.Streams.Stream_Element_Array (1 .. 512); Last : Ada.Streams.Stream_Element_Count; begin loop Process.Read_Standard_Error (Data, Last); exit when Last < Data'First; Self.Errors.Append (Data (1 .. Last)); end loop; end Standard_Error_Available; -------------- -- Finished -- -------------- procedure Finished (Self : in out Listener; Exit_Status : Spawn.Processes.Process_Exit_Status; Exit_Code : Spawn.Processes.Process_Exit_Code) is pragma Unreferenced (Exit_Status); begin Self.Status := Integer (Exit_Code); Self.Done := True; end Finished; -------------------- -- Error_Occurred -- -------------------- procedure Error_Occurred (Self : in out Listener; Process_Error : Integer) is pragma Unreferenced (Self); begin Errors.Append (+"Error_Occurred"); Self.Status := Process_Error; Self.Done := True; end Error_Occurred; procedure Exception_Occurred (Self : in out Listener; Occurrence : Ada.Exceptions.Exception_Occurrence) is begin Errors.Append (League.Strings.From_UTF_8_String (Ada.Exceptions.Exception_Information (Occurrence))); Self.Status := -1; Self.Done := True; end Exception_Occurred; Args : Spawn.String_Vectors.UTF_8_String_Vector; Feedback : aliased Listener; begin Process.Set_Program (Program.To_UTF_8_String); for J in 1 .. Arguments.Length loop Args.Append (Arguments (J).To_UTF_8_String); end loop; if Env /= No_Env then declare Environment : Spawn.Environments.Process_Environment := Process.Environment; begin for J in 1 .. Env.Names.Length loop Environment.Insert (Env.Names (J).To_UTF_8_String, Env.Values (J).To_UTF_8_String); end loop; Process.Set_Environment (Environment); end; end if; Process.Set_Arguments (Args); Process.Set_Working_Directory (Directory.To_UTF_8_String); Process.Set_Listener (Feedback'Unchecked_Access); Process.Start; while not Feedback.Done loop Spawn.Processes.Monitor_Loop (Timeout => 50); end loop; Output := Codec.Decode (Feedback.Output); Errors.Append (Codec.Decode (Feedback.Errors)); Status := Feedback.Status; end Run; end Processes;
true
-- SPDX-FileCopyrightText: 2020 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- with Ada.Streams; with Ada.Exceptions; with League.Stream_Element_Vectors; with League.Text_Codecs; with Spawn.Environments; with Spawn.Processes.Monitor_Loop; with Spawn.Processes; with Spawn.String_Vectors; package body Processes is function "+" (Text : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; --------- -- Run -- --------- procedure Run (Program : League.Strings.Universal_String; Arguments : League.String_Vectors.Universal_String_Vector; Directory : League.Strings.Universal_String; Env : Environment := No_Env; Output : out League.Strings.Universal_String; Errors : out League.Strings.Universal_String; Status : out Integer) is type Listener is new Spawn.Processes.Process_Listener with record Output : League.Stream_Element_Vectors.Stream_Element_Vector; Errors : League.Stream_Element_Vectors.Stream_Element_Vector; Status : Integer := 0; Done : Boolean := False; Write : Boolean := True; end record; procedure Standard_Output_Available (Self : in out Listener); procedure Standard_Error_Available (Self : in out Listener); procedure Finished (Self : in out Listener; Exit_Status : Spawn.Processes.Process_Exit_Status; Exit_Code : Spawn.Processes.Process_Exit_Code); procedure Error_Occurred (Self : in out Listener; Process_Error : Integer); procedure Exception_Occurred (Self : in out Listener; Occurrence : Ada.Exceptions.Exception_Occurrence); Process : Spawn.Processes.Process; Codec : constant League.Text_Codecs.Text_Codec := League.Text_Codecs.Codec_For_Application_Locale; ------------------------------- -- Standard_Output_Available -- ------------------------------- procedure Standard_Output_Available (Self : in out Listener) is use type Ada.Streams.Stream_Element_Count; Data : Ada.Streams.Stream_Element_Array (1 .. 512); Last : Ada.Streams.Stream_Element_Count; begin loop Process.Read_Standard_Output (Data, Last); exit when Last < Data'First; Self.Output.Append (Data (1 .. Last)); end loop; end Standard_Output_Available; ------------------------------ -- Standard_Error_Available -- ------------------------------ procedure Standard_Error_Available (Self : in out Listener) is use type Ada.Streams.Stream_Element_Count; Data : Ada.Streams.Stream_Element_Array (1 .. 512); Last : Ada.Streams.Stream_Element_Count; begin loop Process.Read_Standard_Error (Data, Last); exit when Last < Data'First; Self.Errors.Append (Data (1 .. Last)); end loop; end Standard_Error_Available; -------------- -- Finished -- -------------- procedure Finished (Self : in out Listener; Exit_Status : Spawn.Processes.Process_Exit_Status; Exit_Code : Spawn.Processes.Process_Exit_Code) is pragma Unreferenced (Exit_Status); begin Self.Status := Integer (Exit_Code); Self.Done := True; end Finished; -------------------- -- Error_Occurred -- -------------------- procedure Error_Occurred (Self : in out Listener; Process_Error : Integer) is pragma Unreferenced (Self); begin Errors.Append (+"Error_Occurred"); Self.Status := Process_Error; Self.Done := True; end Error_Occurred; procedure Exception_Occurred (Self : in out Listener; Occurrence : Ada.Exceptions.Exception_Occurrence) is begin Errors.Append (League.Strings.From_UTF_8_String (Ada.Exceptions.Exception_Information (Occurrence))); Self.Status := -1; Self.Done := True; end Exception_Occurred; Args : Spawn.String_Vectors.UTF_8_String_Vector; Feedback : aliased Listener; begin Process.Set_Program (Program.To_UTF_8_String); for J in 1 .. Arguments.Length loop Args.Append (Arguments (J).To_UTF_8_String); end loop; if Env /= No_Env then declare Environment : Spawn.Environments.Process_Environment := Process.Environment; begin for J in 1 .. Env.Names.Length loop Environment.Insert (Env.Names (J).To_UTF_8_String, Env.Values (J).To_UTF_8_String); end loop; Process.Set_Environment (Environment); end; end if; Process.Set_Arguments (Args); Process.Set_Working_Directory (Directory.To_UTF_8_String); Process.Set_Listener (Feedback'Unchecked_Access); Process.Start; while not Feedback.Done loop Spawn.Processes.Monitor_Loop (Timeout => 50); end loop; Output := Codec.Decode (Feedback.Output); Errors.Append (Codec.Decode (Feedback.Errors)); Status := Feedback.Status; end Run; end Processes;
[ { "context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 43, "score": 0.9998573064804077, "start": 33, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 63, "score": 0.9999315142631531, "start": 45, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
tools/generator/meta-writes.ads
reznikmm/gela
0
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Meta.Classes; with Meta.Read; package Meta.Writes is procedure Write_Elements (Vector : Meta.Read.Class_Vectors.Vector); procedure Write_Elements_Body (Vector : Meta.Read.Class_Vectors.Vector); procedure Write_Visitors (Vector : Meta.Read.Class_Vectors.Vector); procedure Write_Iterators (Vector : Meta.Read.Class_Vectors.Vector); procedure Write_Factories (Vector : Meta.Read.Class_Vectors.Vector; Implicit : Boolean := False); procedure Write_Factories_Body (Vector : Meta.Read.Class_Vectors.Vector; Implicit : Boolean := False); procedure Write_One_Element (Item : Meta.Classes.Class; With_List : Boolean); procedure Write_One_Node (Vector : Meta.Read.Class_Vectors.Vector; Item : Meta.Classes.Class); procedure Write_One_Node_Body (Vector : Meta.Read.Class_Vectors.Vector; Item : Meta.Classes.Class); end Meta.Writes;
3704
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Meta.Classes; with Meta.Read; package Meta.Writes is procedure Write_Elements (Vector : Meta.Read.Class_Vectors.Vector); procedure Write_Elements_Body (Vector : Meta.Read.Class_Vectors.Vector); procedure Write_Visitors (Vector : Meta.Read.Class_Vectors.Vector); procedure Write_Iterators (Vector : Meta.Read.Class_Vectors.Vector); procedure Write_Factories (Vector : Meta.Read.Class_Vectors.Vector; Implicit : Boolean := False); procedure Write_Factories_Body (Vector : Meta.Read.Class_Vectors.Vector; Implicit : Boolean := False); procedure Write_One_Element (Item : Meta.Classes.Class; With_List : Boolean); procedure Write_One_Node (Vector : Meta.Read.Class_Vectors.Vector; Item : Meta.Classes.Class); procedure Write_One_Node_Body (Vector : Meta.Read.Class_Vectors.Vector; Item : Meta.Classes.Class); end Meta.Writes;
true
-- SPDX-FileCopyrightText: 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with Meta.Classes; with Meta.Read; package Meta.Writes is procedure Write_Elements (Vector : Meta.Read.Class_Vectors.Vector); procedure Write_Elements_Body (Vector : Meta.Read.Class_Vectors.Vector); procedure Write_Visitors (Vector : Meta.Read.Class_Vectors.Vector); procedure Write_Iterators (Vector : Meta.Read.Class_Vectors.Vector); procedure Write_Factories (Vector : Meta.Read.Class_Vectors.Vector; Implicit : Boolean := False); procedure Write_Factories_Body (Vector : Meta.Read.Class_Vectors.Vector; Implicit : Boolean := False); procedure Write_One_Element (Item : Meta.Classes.Class; With_List : Boolean); procedure Write_One_Node (Vector : Meta.Read.Class_Vectors.Vector; Item : Meta.Classes.Class); procedure Write_One_Node_Body (Vector : Meta.Read.Class_Vectors.Vector; Item : Meta.Classes.Class); end Meta.Writes;
[ { "context": "-- Ada regular expression library\n-- (c) Kristian Klomsten Skordal 2020 <kristian.skordal@wafflemail.net>\n-- Report", "end": 68, "score": 0.9998829364776611, "start": 43, "tag": "NAME", "value": "Kristian Klomsten Skordal" }, { "context": "n library\n-- (c) Kristian Klomsten Skordal 2020 <kristian.skordal@wafflemail.net>\n-- Report bugs and issues on <https://github.co", "end": 106, "score": 0.9999318718910217, "start": 75, "tag": "EMAIL", "value": "kristian.skordal@wafflemail.net" }, { "context": "eport bugs and issues on <https://github.com/skordal/ada-regex>\n\nwith Ada.Unchecked_Deallocation;\n\npac", "end": 165, "score": 0.6574476361274719, "start": 163, "tag": "USERNAME", "value": "al" } ]
src/regex-state_machines.adb
skordal/ada-regex
2
-- Ada regular expression library -- (c) Kristian Klomsten Skordal 2020 <kristian.skordal@wafflemail.net> -- Report bugs and issues on <https://github.com/skordal/ada-regex> with Ada.Unchecked_Deallocation; package body Regex.State_Machines is use Regex.Syntax_Trees; function Clone (Object : in Input_Symbol_Access) return Input_Symbol_Access is New_Object : constant Input_Symbol_Access := new Input_Symbol (Symbol_Type => Object.Symbol_Type); begin New_Object.all := Object.all; return New_Object; end Clone; function Compare_Input_Symbols (Left, Right : in Input_Symbol_Access) return Boolean is begin case Left.Symbol_Type is when Single_Character => if Right.Symbol_Type = Single_Character then return Left.Char < Right.Char; else return True; end if; when Any_Character => return False; end case; end Compare_Input_Symbols; function Input_Symbol_Equals (Left, Right : in Input_Symbol_Access) return Boolean is begin return Left.all = Right.all; end Input_Symbol_Equals; function "<" (Left, Right : in State_Machine_Transition) return Boolean is begin return Compare_Input_Symbols (Left.Transition_On, Right.Transition_On); end "<"; function "=" (Left, Right : in State_Machine_Transition) return Boolean is begin return Input_Symbol_Equals (Left.Transition_On, Right.Transition_On) and Left.Target_State = Right.Target_State; end "="; function Create_Transition_On_Symbol (Input_Symbol : in Input_Symbol_Access; Target_State : in State_Machine_State_Access) return State_Machine_Transition is begin return Retval : State_Machine_Transition do Retval.Transition_On := Input_Symbol; Retval.Target_State := Target_State; end return; end Create_Transition_On_Symbol; procedure Adjust (This : in out State_Machine_Transition) is pragma Assert (This.Transition_On /= null); New_Input_Symbol : constant Input_Symbol_Access := new Input_Symbol ( Symbol_Type => This.Transition_On.Symbol_Type); begin New_Input_Symbol.all := This.Transition_On.all; This.Transition_On := New_Input_Symbol; end Adjust; procedure Finalize (This : in out State_Machine_Transition) is procedure Free is new Ada.Unchecked_Deallocation (Input_Symbol, Input_Symbol_Access); begin Free (This.Transition_On); end Finalize; function Create_State (Syntax_Tree_Nodes : in Syntax_Tree_Node_Sets.Sorted_Set) return State_Machine_State_Access is Retval : constant State_Machine_State_Access := new State_Machine_State'( Syntax_Tree_Nodes => Syntax_Tree_Nodes, Transitions => State_Machine_Transition_Vectors.Empty_Vector, Acceptance_Id => 0, others => False); begin return Retval; end Create_State; end Regex.State_Machines;
14810
-- Ada regular expression library -- (c) <NAME> 2020 <<EMAIL>> -- Report bugs and issues on <https://github.com/skordal/ada-regex> with Ada.Unchecked_Deallocation; package body Regex.State_Machines is use Regex.Syntax_Trees; function Clone (Object : in Input_Symbol_Access) return Input_Symbol_Access is New_Object : constant Input_Symbol_Access := new Input_Symbol (Symbol_Type => Object.Symbol_Type); begin New_Object.all := Object.all; return New_Object; end Clone; function Compare_Input_Symbols (Left, Right : in Input_Symbol_Access) return Boolean is begin case Left.Symbol_Type is when Single_Character => if Right.Symbol_Type = Single_Character then return Left.Char < Right.Char; else return True; end if; when Any_Character => return False; end case; end Compare_Input_Symbols; function Input_Symbol_Equals (Left, Right : in Input_Symbol_Access) return Boolean is begin return Left.all = Right.all; end Input_Symbol_Equals; function "<" (Left, Right : in State_Machine_Transition) return Boolean is begin return Compare_Input_Symbols (Left.Transition_On, Right.Transition_On); end "<"; function "=" (Left, Right : in State_Machine_Transition) return Boolean is begin return Input_Symbol_Equals (Left.Transition_On, Right.Transition_On) and Left.Target_State = Right.Target_State; end "="; function Create_Transition_On_Symbol (Input_Symbol : in Input_Symbol_Access; Target_State : in State_Machine_State_Access) return State_Machine_Transition is begin return Retval : State_Machine_Transition do Retval.Transition_On := Input_Symbol; Retval.Target_State := Target_State; end return; end Create_Transition_On_Symbol; procedure Adjust (This : in out State_Machine_Transition) is pragma Assert (This.Transition_On /= null); New_Input_Symbol : constant Input_Symbol_Access := new Input_Symbol ( Symbol_Type => This.Transition_On.Symbol_Type); begin New_Input_Symbol.all := This.Transition_On.all; This.Transition_On := New_Input_Symbol; end Adjust; procedure Finalize (This : in out State_Machine_Transition) is procedure Free is new Ada.Unchecked_Deallocation (Input_Symbol, Input_Symbol_Access); begin Free (This.Transition_On); end Finalize; function Create_State (Syntax_Tree_Nodes : in Syntax_Tree_Node_Sets.Sorted_Set) return State_Machine_State_Access is Retval : constant State_Machine_State_Access := new State_Machine_State'( Syntax_Tree_Nodes => Syntax_Tree_Nodes, Transitions => State_Machine_Transition_Vectors.Empty_Vector, Acceptance_Id => 0, others => False); begin return Retval; end Create_State; end Regex.State_Machines;
true
-- Ada regular expression library -- (c) PI:NAME:<NAME>END_PI 2020 <PI:EMAIL:<EMAIL>END_PI> -- Report bugs and issues on <https://github.com/skordal/ada-regex> with Ada.Unchecked_Deallocation; package body Regex.State_Machines is use Regex.Syntax_Trees; function Clone (Object : in Input_Symbol_Access) return Input_Symbol_Access is New_Object : constant Input_Symbol_Access := new Input_Symbol (Symbol_Type => Object.Symbol_Type); begin New_Object.all := Object.all; return New_Object; end Clone; function Compare_Input_Symbols (Left, Right : in Input_Symbol_Access) return Boolean is begin case Left.Symbol_Type is when Single_Character => if Right.Symbol_Type = Single_Character then return Left.Char < Right.Char; else return True; end if; when Any_Character => return False; end case; end Compare_Input_Symbols; function Input_Symbol_Equals (Left, Right : in Input_Symbol_Access) return Boolean is begin return Left.all = Right.all; end Input_Symbol_Equals; function "<" (Left, Right : in State_Machine_Transition) return Boolean is begin return Compare_Input_Symbols (Left.Transition_On, Right.Transition_On); end "<"; function "=" (Left, Right : in State_Machine_Transition) return Boolean is begin return Input_Symbol_Equals (Left.Transition_On, Right.Transition_On) and Left.Target_State = Right.Target_State; end "="; function Create_Transition_On_Symbol (Input_Symbol : in Input_Symbol_Access; Target_State : in State_Machine_State_Access) return State_Machine_Transition is begin return Retval : State_Machine_Transition do Retval.Transition_On := Input_Symbol; Retval.Target_State := Target_State; end return; end Create_Transition_On_Symbol; procedure Adjust (This : in out State_Machine_Transition) is pragma Assert (This.Transition_On /= null); New_Input_Symbol : constant Input_Symbol_Access := new Input_Symbol ( Symbol_Type => This.Transition_On.Symbol_Type); begin New_Input_Symbol.all := This.Transition_On.all; This.Transition_On := New_Input_Symbol; end Adjust; procedure Finalize (This : in out State_Machine_Transition) is procedure Free is new Ada.Unchecked_Deallocation (Input_Symbol, Input_Symbol_Access); begin Free (This.Transition_On); end Finalize; function Create_State (Syntax_Tree_Nodes : in Syntax_Tree_Node_Sets.Sorted_Set) return State_Machine_State_Access is Retval : constant State_Machine_State_Access := new State_Machine_State'( Syntax_Tree_Nodes => Syntax_Tree_Nodes, Transitions => State_Machine_Transition_Vectors.Empty_Vector, Acceptance_Id => 0, others => False); begin return Retval; end Create_State; end Regex.State_Machines;
[ { "context": "\nwith text_io; use text_io;\r\n\r\n-- translated from Marsaglia, Tsang diehard suite.\r\n\r\nprocedure gcd_6", "end": 212, "score": 0.5381650924682617, "start": 211, "tag": "NAME", "value": "M" } ]
disorderly/gcd_6bytes_2.adb
jscparker/math_packages
30
with Disorderly.Basic_Rand; use Disorderly.Basic_Rand; with Disorderly.Basic_Rand.Clock_Entropy; with Ada.Numerics.Discrete_Random; with Chi_Gaussian_CDF; with text_io; use text_io; -- translated from Marsaglia, Tsang diehard suite. procedure gcd_6bytes_2 is Bits_per_Random_Word : constant := 48; -- Must set this correctly here. There's no way to check this. Stream_1 : Disorderly.Basic_Rand.State; -- Create a stream of Random numbers. -- Initializing this after the begin, w/ a call to Reset_with_Calendar subtype gnat_Random_Int is Random_Int range 0 .. 2**Bits_per_Random_Word-1; package rnd is new ada.numerics.Discrete_Random (gnat_Random_Int); g : rnd.generator; -- Call rnd.Reset (g); to initialize. type Real is digits 15; package Chi_Analysis is new Chi_Gaussian_CDF (Real); use Chi_Analysis; type Unsigned_64 is mod 2**64; type Statistical_Data is array (Unsigned_64 range <>) of Real; -- Greatest Common Divisor Count test. -- -- 1st test counts No of occurances of GCD's calculated for pairs of Rands: Span_of_GCD_Count_Test : constant := 100; subtype GCD_Count_Test_Range is Unsigned_64 range 1 .. Span_of_GCD_Count_Test; subtype GCD_Counts is Statistical_Data (GCD_Count_Test_Range); True_DOF_for_GCD_Count_Test : constant := Span_of_GCD_Count_Test - 1; -- Greatest Common Divisor Iterations test. -- -- 2nd test counts No of Iterations required to find GCD of a pair of Rands: subtype GCD_Iterations_Test_Range is Unsigned_64 range 5..53; subtype GCD_Iterations_Stats is Statistical_Data (GCD_Iterations_Test_Range); True_DOF_for_Iterations_Test : constant := 48; Probability_of_GCD_Iterations : constant GCD_Iterations_Stats := ( 1.82133747963399E-09, 9.58898969998596E-09, 4.95900373562431E-08, 2.27481731154183E-07, 9.28626032480111E-07, 3.40040609676470E-06, 1.12699881420596E-05, 3.40712181596310E-05, 9.44518676549460E-05, 2.41209404024540E-04, 5.69742894566334E-04, 1.24896390954733E-03, 2.54813052386917E-03, 4.85060876606904E-03, 8.63352069814511E-03, 1.43949377324915E-02, 2.25197150861574E-02, 3.31014969046822E-02, 4.57718000608556E-02, 5.96024363457740E-02, 7.31521241333012E-02, 8.46879485357183E-02, 9.25374818484444E-02, 9.54841741832165E-02, 9.30779824121723E-02, 8.57414430641431E-02, 7.46531672639515E-02, 6.14429557739744E-02, 4.78042557873558E-02, 3.51559583569137E-02, 2.44342786072529E-02, 1.60456052696471E-02, 9.95230933086590E-03, 5.82790566428320E-03, 3.22011217073676E-03, 1.67784031979238E-03, 8.23785205774590E-04, 3.80796274659059E-04, 1.65557171340292E-04, 6.76216404052808E-05, 2.59157200839291E-05, 9.30882508186161E-06, 3.12834803067835E-06, 9.80931601705069E-07, 2.86878314503330E-07, 7.78360272500109E-08, 1.97336355105359E-08, 4.56083856575878E-09, 1.23887369078947E-09 ); -- distr based on 141 * 2^34 sample size --------------------------------- -- Get_Chi_Statistic_and_P_val -- --------------------------------- procedure Get_Chi_Statistic_and_P_val (Probability_Distribution : in Statistical_Data; Observed_Count : in Statistical_Data; True_Degrees_of_Freedom : in Positive; Sample_Size : in Unsigned_64; Chi_squared : out Real; P_val, P_val_Variance : out Real) is Expected_Count, Sum : Real; begin Sum := 0.0; for i in Probability_Distribution'Range loop Expected_Count := Probability_Distribution(i) * Real (Sample_Size); Sum := Sum + (Observed_Count(i) - Expected_Count)**2 / Expected_Count; end loop; Chi_squared := Sum; P_val := Chi_Squared_CDF (Real (True_Degrees_of_Freedom), Chi_squared); P_val_Variance := (P_val-0.5)**2; end Get_Chi_Statistic_and_P_val; ------------------------------ -- Greatest_Common_Divisors -- ------------------------------ -- translated from Marsaglia's diehard suite. -- GCD Test, uses pairs of Rand's: u and v -- where pairs = Sample_Size. -- ***Requires uniform rands on 0..2**Bits_per_Random_Word-1.*** procedure Greatest_Common_Divisors (Sample_Size : in Unsigned_64; Count_of_GCD_Iterations : out GCD_Iterations_Stats) is Observed_Count_of_GCDs : GCD_Counts; s, e : Real; p99, chi99,variance_p99 : Real; ave_chi99, ave_p99, ave_variance_p99 : Real := 0.0; p, chi, variance_p : Real; ave_p, ave_chi, ave_variance_p : Real := 0.0; k : Unsigned_64; u, v, w : Unsigned_64; u0, v0 : Random_Int; No_of_Samples : constant Integer := 2**16; begin Observed_Count_of_GCDs := (others => 0.0); Count_of_GCD_Iterations := (others => 0.0); Outer: for j in 1..No_of_Samples loop Observed_Count_of_GCDs := (others => 0.0); Count_of_GCD_Iterations := (others => 0.0); for i in Unsigned_64 range 1 .. Sample_Size loop Get_Pair: loop --Get_Random(u0, Stream_1); --Get_Random(v0, Stream_1); --u := Unsigned_64 (u0 mod 2**Bits_per_Random_Word); --v := Unsigned_64 (v0 mod 2**Bits_per_Random_Word); u := Unsigned_64 (rnd.Random (g)); v := Unsigned_64 (rnd.Random (g)); exit Get_Pair when (u > 0 and then v > 0); end loop Get_Pair; k := 0; Euclid: loop w := u mod v; u := v; v := w; k := k + 1; exit Euclid when v = 0; end loop Euclid; -- k is Observed number of Iterations to obtain greatest common divisor (GCD). -- u is the greatest common divisor (GCD). if k < Count_of_GCD_Iterations'First then k := Count_of_GCD_Iterations'First; end if; if k > Count_of_GCD_Iterations'Last then k := Count_of_GCD_Iterations'Last; end if; Count_of_GCD_Iterations(k) := Count_of_GCD_Iterations(k)+1.0; if u > Observed_Count_of_GCDs'Last then u := Observed_Count_of_GCDs'Last; end if; if u < Observed_Count_of_GCDs'First then u := Observed_Count_of_GCDs'First; end if; Observed_Count_of_GCDs(u) := Observed_Count_of_GCDs(u) + 1.0; end loop; Get_Chi_Statistic_and_P_val (Probability_Distribution => Probability_of_GCD_Iterations, Observed_Count => Count_of_GCD_Iterations, True_Degrees_of_Freedom => True_DOF_for_Iterations_Test, Sample_Size => Sample_Size, Chi_squared => chi, P_val => p, P_val_Variance => variance_p); ave_chi := ave_chi + chi; ave_p := ave_p + p; ave_variance_p := ave_variance_p + variance_p; -- on range 1..99 distribution seems to be: (0.607926 + 6.0e-8 * i) / i^2 -- theoretical value, with inf number of bits: 0.60792710 / i^2 -- -- e := Real (Sample_Size) * 0.6081842 / Real (i)**2;--asymptotically, i = 5410 p99 := 0.0; variance_p99 := 0.0; --e := Real (Sample_Size) * 0.61097691e-2; -- in theory, p >> 2**32 e := Real (Sample_Size) * 0.61097e-2; -- I get 0.61097e-2 chi99 := (Observed_Count_of_GCDs(GCD_Count_Test_Range'Last) - e)**2 / e; for i in GCD_Count_Test_Range'First .. GCD_Count_Test_Range'Last-1 loop e := Real (Sample_Size) * (0.607926 + 6.0E-8 * Real (i)) / Real (i)**2; s := (Observed_Count_of_GCDs(i) - e)**2 / e; chi99 := chi99 + s; end loop; p99 := Chi_Squared_CDF (Real(True_DOF_for_GCD_Count_Test), chi99); variance_p99 := (p99-0.5)**2; ave_chi99 := ave_chi99 + chi99; ave_p99 := ave_p99 + p99; ave_variance_p99 := ave_variance_p99 + variance_p99; new_line(1); put("Test"); put (Integer'Image(j)); put(". Chi^2 (48 dof), ave p-val, and ave normalized variance of GCD iterations:"); new_line; put(" "); put (Real'Image (chi)); put (Real'Image (ave_p / Real(j))); put (Real'Image (ave_variance_p / (Real(j)*(0.25/3.0)))); -- should -> 1.0 new_line(1); put(" Chi^2 (99 dof), ave p-val, and ave normalized variance of GCD's:"); new_line; put(" "); put (Real'Image (chi99)); put (Real'Image (ave_p99 / Real(j))); put (Real'Image (ave_variance_p99 / (Real(j)*(0.25/3.0)))); end loop Outer; end Greatest_Common_Divisors; begin rnd.Reset (g); Disorderly.Basic_Rand.Clock_Entropy.Reset (Stream_1); -- The state of the generator is Stream_1. (Starts up a random stream.) test: declare Sample_Size : constant Unsigned_64 := 2**40; -- turn way up to best see failure -- 2**32 Sample_Size is OK, chi squared wise. -- 2**37 Sample_Size is gd stnd tst. Tks a day at least (2+ for gnat etc)! Full_Sample_Size : Real; Sample_Iteration_Stats : GCD_Iterations_Stats; Full_Iteration_Stats : GCD_Iterations_Stats := (others => 0.0); begin for i in 1..2**16 loop Greatest_Common_Divisors (Sample_Size, Sample_Iteration_Stats); Full_Sample_Size := Real(i)*Real(Sample_Size); for k in Full_Iteration_Stats'Range loop Full_Iteration_Stats(k) := Full_Iteration_Stats(k) + Sample_Iteration_Stats(k); end loop; new_line; put (Integer'Image (i)); put ("Total Sample_Size:"); put (Real'Image (Real(i)*Real(Sample_Size))); new_line; for k in Full_Iteration_Stats'Range loop if (Integer(k)-Integer(Full_Iteration_Stats'First)) mod 3 = 0 then new_line; end if; put (Real'Image (Full_Iteration_Stats(k) / Full_Sample_Size)); put (","); end loop; new_line; end loop; end test; end;
23600
with Disorderly.Basic_Rand; use Disorderly.Basic_Rand; with Disorderly.Basic_Rand.Clock_Entropy; with Ada.Numerics.Discrete_Random; with Chi_Gaussian_CDF; with text_io; use text_io; -- translated from <NAME>arsaglia, Tsang diehard suite. procedure gcd_6bytes_2 is Bits_per_Random_Word : constant := 48; -- Must set this correctly here. There's no way to check this. Stream_1 : Disorderly.Basic_Rand.State; -- Create a stream of Random numbers. -- Initializing this after the begin, w/ a call to Reset_with_Calendar subtype gnat_Random_Int is Random_Int range 0 .. 2**Bits_per_Random_Word-1; package rnd is new ada.numerics.Discrete_Random (gnat_Random_Int); g : rnd.generator; -- Call rnd.Reset (g); to initialize. type Real is digits 15; package Chi_Analysis is new Chi_Gaussian_CDF (Real); use Chi_Analysis; type Unsigned_64 is mod 2**64; type Statistical_Data is array (Unsigned_64 range <>) of Real; -- Greatest Common Divisor Count test. -- -- 1st test counts No of occurances of GCD's calculated for pairs of Rands: Span_of_GCD_Count_Test : constant := 100; subtype GCD_Count_Test_Range is Unsigned_64 range 1 .. Span_of_GCD_Count_Test; subtype GCD_Counts is Statistical_Data (GCD_Count_Test_Range); True_DOF_for_GCD_Count_Test : constant := Span_of_GCD_Count_Test - 1; -- Greatest Common Divisor Iterations test. -- -- 2nd test counts No of Iterations required to find GCD of a pair of Rands: subtype GCD_Iterations_Test_Range is Unsigned_64 range 5..53; subtype GCD_Iterations_Stats is Statistical_Data (GCD_Iterations_Test_Range); True_DOF_for_Iterations_Test : constant := 48; Probability_of_GCD_Iterations : constant GCD_Iterations_Stats := ( 1.82133747963399E-09, 9.58898969998596E-09, 4.95900373562431E-08, 2.27481731154183E-07, 9.28626032480111E-07, 3.40040609676470E-06, 1.12699881420596E-05, 3.40712181596310E-05, 9.44518676549460E-05, 2.41209404024540E-04, 5.69742894566334E-04, 1.24896390954733E-03, 2.54813052386917E-03, 4.85060876606904E-03, 8.63352069814511E-03, 1.43949377324915E-02, 2.25197150861574E-02, 3.31014969046822E-02, 4.57718000608556E-02, 5.96024363457740E-02, 7.31521241333012E-02, 8.46879485357183E-02, 9.25374818484444E-02, 9.54841741832165E-02, 9.30779824121723E-02, 8.57414430641431E-02, 7.46531672639515E-02, 6.14429557739744E-02, 4.78042557873558E-02, 3.51559583569137E-02, 2.44342786072529E-02, 1.60456052696471E-02, 9.95230933086590E-03, 5.82790566428320E-03, 3.22011217073676E-03, 1.67784031979238E-03, 8.23785205774590E-04, 3.80796274659059E-04, 1.65557171340292E-04, 6.76216404052808E-05, 2.59157200839291E-05, 9.30882508186161E-06, 3.12834803067835E-06, 9.80931601705069E-07, 2.86878314503330E-07, 7.78360272500109E-08, 1.97336355105359E-08, 4.56083856575878E-09, 1.23887369078947E-09 ); -- distr based on 141 * 2^34 sample size --------------------------------- -- Get_Chi_Statistic_and_P_val -- --------------------------------- procedure Get_Chi_Statistic_and_P_val (Probability_Distribution : in Statistical_Data; Observed_Count : in Statistical_Data; True_Degrees_of_Freedom : in Positive; Sample_Size : in Unsigned_64; Chi_squared : out Real; P_val, P_val_Variance : out Real) is Expected_Count, Sum : Real; begin Sum := 0.0; for i in Probability_Distribution'Range loop Expected_Count := Probability_Distribution(i) * Real (Sample_Size); Sum := Sum + (Observed_Count(i) - Expected_Count)**2 / Expected_Count; end loop; Chi_squared := Sum; P_val := Chi_Squared_CDF (Real (True_Degrees_of_Freedom), Chi_squared); P_val_Variance := (P_val-0.5)**2; end Get_Chi_Statistic_and_P_val; ------------------------------ -- Greatest_Common_Divisors -- ------------------------------ -- translated from Marsaglia's diehard suite. -- GCD Test, uses pairs of Rand's: u and v -- where pairs = Sample_Size. -- ***Requires uniform rands on 0..2**Bits_per_Random_Word-1.*** procedure Greatest_Common_Divisors (Sample_Size : in Unsigned_64; Count_of_GCD_Iterations : out GCD_Iterations_Stats) is Observed_Count_of_GCDs : GCD_Counts; s, e : Real; p99, chi99,variance_p99 : Real; ave_chi99, ave_p99, ave_variance_p99 : Real := 0.0; p, chi, variance_p : Real; ave_p, ave_chi, ave_variance_p : Real := 0.0; k : Unsigned_64; u, v, w : Unsigned_64; u0, v0 : Random_Int; No_of_Samples : constant Integer := 2**16; begin Observed_Count_of_GCDs := (others => 0.0); Count_of_GCD_Iterations := (others => 0.0); Outer: for j in 1..No_of_Samples loop Observed_Count_of_GCDs := (others => 0.0); Count_of_GCD_Iterations := (others => 0.0); for i in Unsigned_64 range 1 .. Sample_Size loop Get_Pair: loop --Get_Random(u0, Stream_1); --Get_Random(v0, Stream_1); --u := Unsigned_64 (u0 mod 2**Bits_per_Random_Word); --v := Unsigned_64 (v0 mod 2**Bits_per_Random_Word); u := Unsigned_64 (rnd.Random (g)); v := Unsigned_64 (rnd.Random (g)); exit Get_Pair when (u > 0 and then v > 0); end loop Get_Pair; k := 0; Euclid: loop w := u mod v; u := v; v := w; k := k + 1; exit Euclid when v = 0; end loop Euclid; -- k is Observed number of Iterations to obtain greatest common divisor (GCD). -- u is the greatest common divisor (GCD). if k < Count_of_GCD_Iterations'First then k := Count_of_GCD_Iterations'First; end if; if k > Count_of_GCD_Iterations'Last then k := Count_of_GCD_Iterations'Last; end if; Count_of_GCD_Iterations(k) := Count_of_GCD_Iterations(k)+1.0; if u > Observed_Count_of_GCDs'Last then u := Observed_Count_of_GCDs'Last; end if; if u < Observed_Count_of_GCDs'First then u := Observed_Count_of_GCDs'First; end if; Observed_Count_of_GCDs(u) := Observed_Count_of_GCDs(u) + 1.0; end loop; Get_Chi_Statistic_and_P_val (Probability_Distribution => Probability_of_GCD_Iterations, Observed_Count => Count_of_GCD_Iterations, True_Degrees_of_Freedom => True_DOF_for_Iterations_Test, Sample_Size => Sample_Size, Chi_squared => chi, P_val => p, P_val_Variance => variance_p); ave_chi := ave_chi + chi; ave_p := ave_p + p; ave_variance_p := ave_variance_p + variance_p; -- on range 1..99 distribution seems to be: (0.607926 + 6.0e-8 * i) / i^2 -- theoretical value, with inf number of bits: 0.60792710 / i^2 -- -- e := Real (Sample_Size) * 0.6081842 / Real (i)**2;--asymptotically, i = 5410 p99 := 0.0; variance_p99 := 0.0; --e := Real (Sample_Size) * 0.61097691e-2; -- in theory, p >> 2**32 e := Real (Sample_Size) * 0.61097e-2; -- I get 0.61097e-2 chi99 := (Observed_Count_of_GCDs(GCD_Count_Test_Range'Last) - e)**2 / e; for i in GCD_Count_Test_Range'First .. GCD_Count_Test_Range'Last-1 loop e := Real (Sample_Size) * (0.607926 + 6.0E-8 * Real (i)) / Real (i)**2; s := (Observed_Count_of_GCDs(i) - e)**2 / e; chi99 := chi99 + s; end loop; p99 := Chi_Squared_CDF (Real(True_DOF_for_GCD_Count_Test), chi99); variance_p99 := (p99-0.5)**2; ave_chi99 := ave_chi99 + chi99; ave_p99 := ave_p99 + p99; ave_variance_p99 := ave_variance_p99 + variance_p99; new_line(1); put("Test"); put (Integer'Image(j)); put(". Chi^2 (48 dof), ave p-val, and ave normalized variance of GCD iterations:"); new_line; put(" "); put (Real'Image (chi)); put (Real'Image (ave_p / Real(j))); put (Real'Image (ave_variance_p / (Real(j)*(0.25/3.0)))); -- should -> 1.0 new_line(1); put(" Chi^2 (99 dof), ave p-val, and ave normalized variance of GCD's:"); new_line; put(" "); put (Real'Image (chi99)); put (Real'Image (ave_p99 / Real(j))); put (Real'Image (ave_variance_p99 / (Real(j)*(0.25/3.0)))); end loop Outer; end Greatest_Common_Divisors; begin rnd.Reset (g); Disorderly.Basic_Rand.Clock_Entropy.Reset (Stream_1); -- The state of the generator is Stream_1. (Starts up a random stream.) test: declare Sample_Size : constant Unsigned_64 := 2**40; -- turn way up to best see failure -- 2**32 Sample_Size is OK, chi squared wise. -- 2**37 Sample_Size is gd stnd tst. Tks a day at least (2+ for gnat etc)! Full_Sample_Size : Real; Sample_Iteration_Stats : GCD_Iterations_Stats; Full_Iteration_Stats : GCD_Iterations_Stats := (others => 0.0); begin for i in 1..2**16 loop Greatest_Common_Divisors (Sample_Size, Sample_Iteration_Stats); Full_Sample_Size := Real(i)*Real(Sample_Size); for k in Full_Iteration_Stats'Range loop Full_Iteration_Stats(k) := Full_Iteration_Stats(k) + Sample_Iteration_Stats(k); end loop; new_line; put (Integer'Image (i)); put ("Total Sample_Size:"); put (Real'Image (Real(i)*Real(Sample_Size))); new_line; for k in Full_Iteration_Stats'Range loop if (Integer(k)-Integer(Full_Iteration_Stats'First)) mod 3 = 0 then new_line; end if; put (Real'Image (Full_Iteration_Stats(k) / Full_Sample_Size)); put (","); end loop; new_line; end loop; end test; end;
true
with Disorderly.Basic_Rand; use Disorderly.Basic_Rand; with Disorderly.Basic_Rand.Clock_Entropy; with Ada.Numerics.Discrete_Random; with Chi_Gaussian_CDF; with text_io; use text_io; -- translated from PI:NAME:<NAME>END_PIarsaglia, Tsang diehard suite. procedure gcd_6bytes_2 is Bits_per_Random_Word : constant := 48; -- Must set this correctly here. There's no way to check this. Stream_1 : Disorderly.Basic_Rand.State; -- Create a stream of Random numbers. -- Initializing this after the begin, w/ a call to Reset_with_Calendar subtype gnat_Random_Int is Random_Int range 0 .. 2**Bits_per_Random_Word-1; package rnd is new ada.numerics.Discrete_Random (gnat_Random_Int); g : rnd.generator; -- Call rnd.Reset (g); to initialize. type Real is digits 15; package Chi_Analysis is new Chi_Gaussian_CDF (Real); use Chi_Analysis; type Unsigned_64 is mod 2**64; type Statistical_Data is array (Unsigned_64 range <>) of Real; -- Greatest Common Divisor Count test. -- -- 1st test counts No of occurances of GCD's calculated for pairs of Rands: Span_of_GCD_Count_Test : constant := 100; subtype GCD_Count_Test_Range is Unsigned_64 range 1 .. Span_of_GCD_Count_Test; subtype GCD_Counts is Statistical_Data (GCD_Count_Test_Range); True_DOF_for_GCD_Count_Test : constant := Span_of_GCD_Count_Test - 1; -- Greatest Common Divisor Iterations test. -- -- 2nd test counts No of Iterations required to find GCD of a pair of Rands: subtype GCD_Iterations_Test_Range is Unsigned_64 range 5..53; subtype GCD_Iterations_Stats is Statistical_Data (GCD_Iterations_Test_Range); True_DOF_for_Iterations_Test : constant := 48; Probability_of_GCD_Iterations : constant GCD_Iterations_Stats := ( 1.82133747963399E-09, 9.58898969998596E-09, 4.95900373562431E-08, 2.27481731154183E-07, 9.28626032480111E-07, 3.40040609676470E-06, 1.12699881420596E-05, 3.40712181596310E-05, 9.44518676549460E-05, 2.41209404024540E-04, 5.69742894566334E-04, 1.24896390954733E-03, 2.54813052386917E-03, 4.85060876606904E-03, 8.63352069814511E-03, 1.43949377324915E-02, 2.25197150861574E-02, 3.31014969046822E-02, 4.57718000608556E-02, 5.96024363457740E-02, 7.31521241333012E-02, 8.46879485357183E-02, 9.25374818484444E-02, 9.54841741832165E-02, 9.30779824121723E-02, 8.57414430641431E-02, 7.46531672639515E-02, 6.14429557739744E-02, 4.78042557873558E-02, 3.51559583569137E-02, 2.44342786072529E-02, 1.60456052696471E-02, 9.95230933086590E-03, 5.82790566428320E-03, 3.22011217073676E-03, 1.67784031979238E-03, 8.23785205774590E-04, 3.80796274659059E-04, 1.65557171340292E-04, 6.76216404052808E-05, 2.59157200839291E-05, 9.30882508186161E-06, 3.12834803067835E-06, 9.80931601705069E-07, 2.86878314503330E-07, 7.78360272500109E-08, 1.97336355105359E-08, 4.56083856575878E-09, 1.23887369078947E-09 ); -- distr based on 141 * 2^34 sample size --------------------------------- -- Get_Chi_Statistic_and_P_val -- --------------------------------- procedure Get_Chi_Statistic_and_P_val (Probability_Distribution : in Statistical_Data; Observed_Count : in Statistical_Data; True_Degrees_of_Freedom : in Positive; Sample_Size : in Unsigned_64; Chi_squared : out Real; P_val, P_val_Variance : out Real) is Expected_Count, Sum : Real; begin Sum := 0.0; for i in Probability_Distribution'Range loop Expected_Count := Probability_Distribution(i) * Real (Sample_Size); Sum := Sum + (Observed_Count(i) - Expected_Count)**2 / Expected_Count; end loop; Chi_squared := Sum; P_val := Chi_Squared_CDF (Real (True_Degrees_of_Freedom), Chi_squared); P_val_Variance := (P_val-0.5)**2; end Get_Chi_Statistic_and_P_val; ------------------------------ -- Greatest_Common_Divisors -- ------------------------------ -- translated from Marsaglia's diehard suite. -- GCD Test, uses pairs of Rand's: u and v -- where pairs = Sample_Size. -- ***Requires uniform rands on 0..2**Bits_per_Random_Word-1.*** procedure Greatest_Common_Divisors (Sample_Size : in Unsigned_64; Count_of_GCD_Iterations : out GCD_Iterations_Stats) is Observed_Count_of_GCDs : GCD_Counts; s, e : Real; p99, chi99,variance_p99 : Real; ave_chi99, ave_p99, ave_variance_p99 : Real := 0.0; p, chi, variance_p : Real; ave_p, ave_chi, ave_variance_p : Real := 0.0; k : Unsigned_64; u, v, w : Unsigned_64; u0, v0 : Random_Int; No_of_Samples : constant Integer := 2**16; begin Observed_Count_of_GCDs := (others => 0.0); Count_of_GCD_Iterations := (others => 0.0); Outer: for j in 1..No_of_Samples loop Observed_Count_of_GCDs := (others => 0.0); Count_of_GCD_Iterations := (others => 0.0); for i in Unsigned_64 range 1 .. Sample_Size loop Get_Pair: loop --Get_Random(u0, Stream_1); --Get_Random(v0, Stream_1); --u := Unsigned_64 (u0 mod 2**Bits_per_Random_Word); --v := Unsigned_64 (v0 mod 2**Bits_per_Random_Word); u := Unsigned_64 (rnd.Random (g)); v := Unsigned_64 (rnd.Random (g)); exit Get_Pair when (u > 0 and then v > 0); end loop Get_Pair; k := 0; Euclid: loop w := u mod v; u := v; v := w; k := k + 1; exit Euclid when v = 0; end loop Euclid; -- k is Observed number of Iterations to obtain greatest common divisor (GCD). -- u is the greatest common divisor (GCD). if k < Count_of_GCD_Iterations'First then k := Count_of_GCD_Iterations'First; end if; if k > Count_of_GCD_Iterations'Last then k := Count_of_GCD_Iterations'Last; end if; Count_of_GCD_Iterations(k) := Count_of_GCD_Iterations(k)+1.0; if u > Observed_Count_of_GCDs'Last then u := Observed_Count_of_GCDs'Last; end if; if u < Observed_Count_of_GCDs'First then u := Observed_Count_of_GCDs'First; end if; Observed_Count_of_GCDs(u) := Observed_Count_of_GCDs(u) + 1.0; end loop; Get_Chi_Statistic_and_P_val (Probability_Distribution => Probability_of_GCD_Iterations, Observed_Count => Count_of_GCD_Iterations, True_Degrees_of_Freedom => True_DOF_for_Iterations_Test, Sample_Size => Sample_Size, Chi_squared => chi, P_val => p, P_val_Variance => variance_p); ave_chi := ave_chi + chi; ave_p := ave_p + p; ave_variance_p := ave_variance_p + variance_p; -- on range 1..99 distribution seems to be: (0.607926 + 6.0e-8 * i) / i^2 -- theoretical value, with inf number of bits: 0.60792710 / i^2 -- -- e := Real (Sample_Size) * 0.6081842 / Real (i)**2;--asymptotically, i = 5410 p99 := 0.0; variance_p99 := 0.0; --e := Real (Sample_Size) * 0.61097691e-2; -- in theory, p >> 2**32 e := Real (Sample_Size) * 0.61097e-2; -- I get 0.61097e-2 chi99 := (Observed_Count_of_GCDs(GCD_Count_Test_Range'Last) - e)**2 / e; for i in GCD_Count_Test_Range'First .. GCD_Count_Test_Range'Last-1 loop e := Real (Sample_Size) * (0.607926 + 6.0E-8 * Real (i)) / Real (i)**2; s := (Observed_Count_of_GCDs(i) - e)**2 / e; chi99 := chi99 + s; end loop; p99 := Chi_Squared_CDF (Real(True_DOF_for_GCD_Count_Test), chi99); variance_p99 := (p99-0.5)**2; ave_chi99 := ave_chi99 + chi99; ave_p99 := ave_p99 + p99; ave_variance_p99 := ave_variance_p99 + variance_p99; new_line(1); put("Test"); put (Integer'Image(j)); put(". Chi^2 (48 dof), ave p-val, and ave normalized variance of GCD iterations:"); new_line; put(" "); put (Real'Image (chi)); put (Real'Image (ave_p / Real(j))); put (Real'Image (ave_variance_p / (Real(j)*(0.25/3.0)))); -- should -> 1.0 new_line(1); put(" Chi^2 (99 dof), ave p-val, and ave normalized variance of GCD's:"); new_line; put(" "); put (Real'Image (chi99)); put (Real'Image (ave_p99 / Real(j))); put (Real'Image (ave_variance_p99 / (Real(j)*(0.25/3.0)))); end loop Outer; end Greatest_Common_Divisors; begin rnd.Reset (g); Disorderly.Basic_Rand.Clock_Entropy.Reset (Stream_1); -- The state of the generator is Stream_1. (Starts up a random stream.) test: declare Sample_Size : constant Unsigned_64 := 2**40; -- turn way up to best see failure -- 2**32 Sample_Size is OK, chi squared wise. -- 2**37 Sample_Size is gd stnd tst. Tks a day at least (2+ for gnat etc)! Full_Sample_Size : Real; Sample_Iteration_Stats : GCD_Iterations_Stats; Full_Iteration_Stats : GCD_Iterations_Stats := (others => 0.0); begin for i in 1..2**16 loop Greatest_Common_Divisors (Sample_Size, Sample_Iteration_Stats); Full_Sample_Size := Real(i)*Real(Sample_Size); for k in Full_Iteration_Stats'Range loop Full_Iteration_Stats(k) := Full_Iteration_Stats(k) + Sample_Iteration_Stats(k); end loop; new_line; put (Integer'Image (i)); put ("Total Sample_Size:"); put (Real'Image (Real(i)*Real(Sample_Size))); new_line; for k in Full_Iteration_Stats'Range loop if (Integer(k)-Integer(Full_Iteration_Stats'First)) mod 3 = 0 then new_line; end if; put (Real'Image (Full_Iteration_Stats(k) / Full_Sample_Size)); put (","); end loop; new_line; end loop; end test; end;
[ { "context": "--------------------------------\n-- Copyright 2020 Thomas E. Dickey --\n-- Co", "end": 745, "score": 0.9998565316200256, "start": 729, "tag": "NAME", "value": "Thomas E. Dickey" }, { "context": "-------------------------------------\n-- Author: Juergen Pfeifer, 1996\n-- Version Control:\n-- $Revision: 1.14 $\n", "end": 2872, "score": 0.9998742938041687, "start": 2857, "tag": "NAME", "value": "Juergen Pfeifer" } ]
Ada95/src/terminal_interface-curses-text_io-aux.adb
ProtonAOSP-platina/android_external_libncurses
269
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Text_IO.Aux -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 Thomas E. Dickey -- -- Copyright 1999-2006,2009 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: -- $Revision: 1.14 $ -- $Date: 2020/02/02 23:34:34 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ package body Terminal_Interface.Curses.Text_IO.Aux is procedure Put_Buf (Win : Window; Buf : String; Width : Field; Signal : Boolean := True; Ljust : Boolean := False) is L : Field; Len : Field; W : Field := Width; LC : Line_Count; CC : Column_Count; Y : Line_Position; X : Column_Position; procedure Output (From, To : Field); procedure Output (From, To : Field) is begin if Len > 0 then if W = 0 then W := Len; end if; if Len > W then -- LRM A10.6 (7) says this W := Len; end if; pragma Assert (Len <= W); Get_Size (Win, LC, CC); if Column_Count (Len) > CC then if Signal then raise Layout_Error; else return; end if; else if Len < W and then not Ljust then declare Filler : constant String (1 .. (W - Len)) := (others => ' '); begin Put (Win, Filler); end; end if; Get_Cursor_Position (Win, Y, X); if (X + Column_Position (Len)) > CC then New_Line (Win); end if; Put (Win, Buf (From .. To)); if Len < W and then Ljust then declare Filler : constant String (1 .. (W - Len)) := (others => ' '); begin Put (Win, Filler); end; end if; end if; end if; end Output; begin pragma Assert (Win /= Null_Window); if Ljust then L := 1; for I in 1 .. Buf'Length loop exit when Buf (L) = ' '; L := L + 1; end loop; Len := L - 1; Output (1, Len); else -- input buffer is not left justified L := Buf'Length; for I in 1 .. Buf'Length loop exit when Buf (L) = ' '; L := L - 1; end loop; Len := Buf'Length - L; Output (L + 1, Buf'Length); end if; end Put_Buf; end Terminal_Interface.Curses.Text_IO.Aux;
22724
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Text_IO.Aux -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 <NAME> -- -- Copyright 1999-2006,2009 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: <NAME>, 1996 -- Version Control: -- $Revision: 1.14 $ -- $Date: 2020/02/02 23:34:34 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ package body Terminal_Interface.Curses.Text_IO.Aux is procedure Put_Buf (Win : Window; Buf : String; Width : Field; Signal : Boolean := True; Ljust : Boolean := False) is L : Field; Len : Field; W : Field := Width; LC : Line_Count; CC : Column_Count; Y : Line_Position; X : Column_Position; procedure Output (From, To : Field); procedure Output (From, To : Field) is begin if Len > 0 then if W = 0 then W := Len; end if; if Len > W then -- LRM A10.6 (7) says this W := Len; end if; pragma Assert (Len <= W); Get_Size (Win, LC, CC); if Column_Count (Len) > CC then if Signal then raise Layout_Error; else return; end if; else if Len < W and then not Ljust then declare Filler : constant String (1 .. (W - Len)) := (others => ' '); begin Put (Win, Filler); end; end if; Get_Cursor_Position (Win, Y, X); if (X + Column_Position (Len)) > CC then New_Line (Win); end if; Put (Win, Buf (From .. To)); if Len < W and then Ljust then declare Filler : constant String (1 .. (W - Len)) := (others => ' '); begin Put (Win, Filler); end; end if; end if; end if; end Output; begin pragma Assert (Win /= Null_Window); if Ljust then L := 1; for I in 1 .. Buf'Length loop exit when Buf (L) = ' '; L := L + 1; end loop; Len := L - 1; Output (1, Len); else -- input buffer is not left justified L := Buf'Length; for I in 1 .. Buf'Length loop exit when Buf (L) = ' '; L := L - 1; end loop; Len := Buf'Length - L; Output (L + 1, Buf'Length); end if; end Put_Buf; end Terminal_Interface.Curses.Text_IO.Aux;
true
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Text_IO.Aux -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright 2020 PI:NAME:<NAME>END_PI -- -- Copyright 1999-2006,2009 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- -- "Software"), to deal in the Software without restriction, including -- -- without limitation the rights to use, copy, modify, merge, publish, -- -- distribute, distribute with modifications, sublicense, and/or sell -- -- copies of the Software, and to permit persons to whom the Software is -- -- furnished to do so, subject to the following conditions: -- -- -- -- The above copyright notice and this permission notice shall be included -- -- in all copies or substantial portions of the Software. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -- -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -- -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -- -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- -- -- -- Except as contained in this notice, the name(s) of the above copyright -- -- holders shall not be used in advertising or otherwise to promote the -- -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ -- Author: PI:NAME:<NAME>END_PI, 1996 -- Version Control: -- $Revision: 1.14 $ -- $Date: 2020/02/02 23:34:34 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ package body Terminal_Interface.Curses.Text_IO.Aux is procedure Put_Buf (Win : Window; Buf : String; Width : Field; Signal : Boolean := True; Ljust : Boolean := False) is L : Field; Len : Field; W : Field := Width; LC : Line_Count; CC : Column_Count; Y : Line_Position; X : Column_Position; procedure Output (From, To : Field); procedure Output (From, To : Field) is begin if Len > 0 then if W = 0 then W := Len; end if; if Len > W then -- LRM A10.6 (7) says this W := Len; end if; pragma Assert (Len <= W); Get_Size (Win, LC, CC); if Column_Count (Len) > CC then if Signal then raise Layout_Error; else return; end if; else if Len < W and then not Ljust then declare Filler : constant String (1 .. (W - Len)) := (others => ' '); begin Put (Win, Filler); end; end if; Get_Cursor_Position (Win, Y, X); if (X + Column_Position (Len)) > CC then New_Line (Win); end if; Put (Win, Buf (From .. To)); if Len < W and then Ljust then declare Filler : constant String (1 .. (W - Len)) := (others => ' '); begin Put (Win, Filler); end; end if; end if; end if; end Output; begin pragma Assert (Win /= Null_Window); if Ljust then L := 1; for I in 1 .. Buf'Length loop exit when Buf (L) = ' '; L := L + 1; end loop; Len := L - 1; Output (1, Len); else -- input buffer is not left justified L := Buf'Length; for I in 1 .. Buf'Length loop exit when Buf (L) = ' '; L := L - 1; end loop; Len := Buf'Length - L; Output (L + 1, Buf'Length); end if; end Put_Buf; end Terminal_Interface.Curses.Text_IO.Aux;
[ { "context": "-- Copyright 2016 Steven Stewart-Gallus\n--\n-- Licensed under the Apache License, Version ", "end": 39, "score": 0.9993307590484619, "start": 18, "tag": "NAME", "value": "Steven Stewart-Gallus" } ]
src/ada-core/src/linted-logs.adb
mstewartgallus/linted
0
-- Copyright 2016 Steven Stewart-Gallus -- -- 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 Interfaces.C; with Libc.Syslog; package body Linted.Logs is package C renames Interfaces.C; use type C.unsigned; procedure syslog (pri : C.int; fmt : C.char_array; str : C.char_array); pragma Import (C_Variadic_2, syslog, "syslog"); procedure Log (Pri : Priority; Str : String) with Spark_Mode => Off is Sys_Pri : C.int; begin declare Ident : aliased C.char_array := C.To_C (Ada.Command_Line.Command_Name); begin Libc.Syslog.openlog (Ident, C.int (C.unsigned (Libc.Syslog.LOG_PID) or Libc.Syslog.LOG_NDELAY), Libc.Syslog.LOG_USER); end; case Pri is when Error => Sys_Pri := Libc.Syslog.LOG_ERR; when Warning => Sys_Pri := Libc.Syslog.LOG_WARNING; when Info => Sys_Pri := Libc.Syslog.LOG_INFO; end case; declare Fmt : C.char_array := C.To_C ("%s"); C_Str : C.char_array := C.To_C (Str); begin syslog (Sys_Pri, Fmt, C_Str); end; end Log; end Linted.Logs;
5094
-- Copyright 2016 <NAME> -- -- 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 Interfaces.C; with Libc.Syslog; package body Linted.Logs is package C renames Interfaces.C; use type C.unsigned; procedure syslog (pri : C.int; fmt : C.char_array; str : C.char_array); pragma Import (C_Variadic_2, syslog, "syslog"); procedure Log (Pri : Priority; Str : String) with Spark_Mode => Off is Sys_Pri : C.int; begin declare Ident : aliased C.char_array := C.To_C (Ada.Command_Line.Command_Name); begin Libc.Syslog.openlog (Ident, C.int (C.unsigned (Libc.Syslog.LOG_PID) or Libc.Syslog.LOG_NDELAY), Libc.Syslog.LOG_USER); end; case Pri is when Error => Sys_Pri := Libc.Syslog.LOG_ERR; when Warning => Sys_Pri := Libc.Syslog.LOG_WARNING; when Info => Sys_Pri := Libc.Syslog.LOG_INFO; end case; declare Fmt : C.char_array := C.To_C ("%s"); C_Str : C.char_array := C.To_C (Str); begin syslog (Sys_Pri, Fmt, C_Str); end; end Log; end Linted.Logs;
true
-- Copyright 2016 PI:NAME:<NAME>END_PI -- -- 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 Interfaces.C; with Libc.Syslog; package body Linted.Logs is package C renames Interfaces.C; use type C.unsigned; procedure syslog (pri : C.int; fmt : C.char_array; str : C.char_array); pragma Import (C_Variadic_2, syslog, "syslog"); procedure Log (Pri : Priority; Str : String) with Spark_Mode => Off is Sys_Pri : C.int; begin declare Ident : aliased C.char_array := C.To_C (Ada.Command_Line.Command_Name); begin Libc.Syslog.openlog (Ident, C.int (C.unsigned (Libc.Syslog.LOG_PID) or Libc.Syslog.LOG_NDELAY), Libc.Syslog.LOG_USER); end; case Pri is when Error => Sys_Pri := Libc.Syslog.LOG_ERR; when Warning => Sys_Pri := Libc.Syslog.LOG_WARNING; when Info => Sys_Pri := Libc.Syslog.LOG_INFO; end case; declare Fmt : C.char_array := C.To_C ("%s"); C_Str : C.char_array := C.To_C (Str); begin syslog (Sys_Pri, Fmt, C_Str); end; end Log; end Linted.Logs;
[ { "context": "-- MP: a Music Player\n-- Copyright (C) 2020 by PragmAda Software Engineering. All rights reserved.\n-- Re", "end": 55, "score": 0.9964979290962219, "start": 47, "tag": "NAME", "value": "PragmAda" } ]
mp.ads
jrcarter/MP
1
-- MP: a Music Player -- Copyright (C) 2020 by PragmAda Software Engineering. All rights reserved. -- Released under the terms of the BSD 3-Clause license; see https://opensource.org/licenses -- -- Uses the Gnoga audio widget to create a music player -- -- The audio widget requires relative paths to the audio files. The file browser in this program will only choose audio files that -- are in the program's working directory, or in a directory under that. -- -- 2020-09-15 Initial version -- package MP is pragma Pure; end MP;
13950
-- MP: a Music Player -- Copyright (C) 2020 by <NAME> Software Engineering. All rights reserved. -- Released under the terms of the BSD 3-Clause license; see https://opensource.org/licenses -- -- Uses the Gnoga audio widget to create a music player -- -- The audio widget requires relative paths to the audio files. The file browser in this program will only choose audio files that -- are in the program's working directory, or in a directory under that. -- -- 2020-09-15 Initial version -- package MP is pragma Pure; end MP;
true
-- MP: a Music Player -- Copyright (C) 2020 by PI:NAME:<NAME>END_PI Software Engineering. All rights reserved. -- Released under the terms of the BSD 3-Clause license; see https://opensource.org/licenses -- -- Uses the Gnoga audio widget to create a music player -- -- The audio widget requires relative paths to the audio files. The file browser in this program will only choose audio files that -- are in the program's working directory, or in a directory under that. -- -- 2020-09-15 Initial version -- package MP is pragma Pure; end MP;
[ { "context": " --\n-- Eugene Nonko, cm@liceum.secna.ru ", "end": 730, "score": 0.9998676180839539, "start": 718, "tag": "NAME", "value": "Eugene Nonko" }, { "context": " --\n-- Eugene Nonko, cm@liceum.secna.ru --\n-- ", "end": 750, "score": 0.9999306201934814, "start": 732, "tag": "EMAIL", "value": "cm@liceum.secna.ru" } ]
src/format/formatted_output-enumeration_output.adb
dshadrin/AProxy
1
------------------------------------------------------------------------------ -- -- -- File: -- -- formatted_output-enumeration_output.adb -- -- -- -- Description: -- -- Formatted_Output.Enumeration_Output generic package body -- -- -- -- Author: -- -- Eugene Nonko, cm@liceum.secna.ru -- -- -- -- Revision history: -- -- 27/01/99 - original -- -- 16/03/99 - added support for justification characters -- -- -- ------------------------------------------------------------------------------ with Ada.Text_IO, Ada.Characters.Handling, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded; use Ada.Text_IO, Ada.Characters.Handling, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded; package body Formatted_Output.Enumeration_Output is package Item_Type_IO is new Enumeration_IO (Item_Type); use Item_Type_IO; type Style_Type is (Capitalized, Upper_Case, Lower_Case); function Format (Value : Item_Type; Initial_Width : Integer; Justification : Alignment; Style : Style_Type) return String is Img : String (1 .. Maximal_Item_Length); Width, Real_Width : Integer; Past_Last : Integer := 1; begin -- Format case Style is when Capitalized => Put (Img, Value, Set => Type_Set'(Lower_Case)); Img (1) := To_Upper (Img (1)); when Lower_Case => Put (Img, Value, Set => Type_Set'(Lower_Case)); when Upper_Case => Put (Img, Value, Set => Type_Set'(Upper_Case)); end case; while Img (Past_Last) /= ' ' loop Past_Last := Past_Last + 1; end loop; Real_Width := Past_Last - 1; if Initial_Width < Real_Width then Width := Real_Width; else Width := Initial_Width; end if; declare S : String (1 .. Width); begin Move (Img (Past_Last - Real_Width .. Past_Last - 1), S, Justify => Justification, Pad => Filler); return S; end; end Format; function "&" (Fmt : Format_Type; Value : Item_Type) return Format_Type is Command_Start : constant Integer := Scan_To_Percent_Sign (Fmt); Width : Integer := 0; Digit_Occured, Justification_Changed : Boolean := False; Justification : Alignment := Right; Fmt_Copy : Unbounded_String; begin -- "&" if Command_Start /= 0 then Fmt_Copy := Unbounded_String (Fmt); for I in Command_Start + 1 .. Length (Fmt_Copy) loop case Element (Fmt_Copy, I) is when 'c' => Replace_Slice (Fmt_Copy, Command_Start, I, Format (Value, Width, Justification, Capitalized)); return Format_Type (Fmt_Copy); when 'u' => Replace_Slice (Fmt_Copy, Command_Start, I, Format (Value, Width, Justification, Upper_Case)); return Format_Type (Fmt_Copy); when 'l' => Replace_Slice (Fmt_Copy, Command_Start, I, Format (Value, Width, Justification, Lower_Case)); return Format_Type (Fmt_Copy); when '-' | '+' | '*' => if Justification_Changed or else Digit_Occured then raise Format_Error; end if; Justification_Changed := True; case Element (Fmt_Copy, I) is when '-' => Justification := Left; when '+' => Justification := Right; when '*' => Justification := Center; when others => null; end case; when '0' .. '9' => Width := Width * 10 + Character'Pos (Element (Fmt_Copy, I)) - Character'Pos ('0'); when others => raise Format_Error; end case; end loop; end if; raise Format_Error; end "&"; end Formatted_Output.Enumeration_Output;
25686
------------------------------------------------------------------------------ -- -- -- File: -- -- formatted_output-enumeration_output.adb -- -- -- -- Description: -- -- Formatted_Output.Enumeration_Output generic package body -- -- -- -- Author: -- -- <NAME>, <EMAIL> -- -- -- -- Revision history: -- -- 27/01/99 - original -- -- 16/03/99 - added support for justification characters -- -- -- ------------------------------------------------------------------------------ with Ada.Text_IO, Ada.Characters.Handling, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded; use Ada.Text_IO, Ada.Characters.Handling, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded; package body Formatted_Output.Enumeration_Output is package Item_Type_IO is new Enumeration_IO (Item_Type); use Item_Type_IO; type Style_Type is (Capitalized, Upper_Case, Lower_Case); function Format (Value : Item_Type; Initial_Width : Integer; Justification : Alignment; Style : Style_Type) return String is Img : String (1 .. Maximal_Item_Length); Width, Real_Width : Integer; Past_Last : Integer := 1; begin -- Format case Style is when Capitalized => Put (Img, Value, Set => Type_Set'(Lower_Case)); Img (1) := To_Upper (Img (1)); when Lower_Case => Put (Img, Value, Set => Type_Set'(Lower_Case)); when Upper_Case => Put (Img, Value, Set => Type_Set'(Upper_Case)); end case; while Img (Past_Last) /= ' ' loop Past_Last := Past_Last + 1; end loop; Real_Width := Past_Last - 1; if Initial_Width < Real_Width then Width := Real_Width; else Width := Initial_Width; end if; declare S : String (1 .. Width); begin Move (Img (Past_Last - Real_Width .. Past_Last - 1), S, Justify => Justification, Pad => Filler); return S; end; end Format; function "&" (Fmt : Format_Type; Value : Item_Type) return Format_Type is Command_Start : constant Integer := Scan_To_Percent_Sign (Fmt); Width : Integer := 0; Digit_Occured, Justification_Changed : Boolean := False; Justification : Alignment := Right; Fmt_Copy : Unbounded_String; begin -- "&" if Command_Start /= 0 then Fmt_Copy := Unbounded_String (Fmt); for I in Command_Start + 1 .. Length (Fmt_Copy) loop case Element (Fmt_Copy, I) is when 'c' => Replace_Slice (Fmt_Copy, Command_Start, I, Format (Value, Width, Justification, Capitalized)); return Format_Type (Fmt_Copy); when 'u' => Replace_Slice (Fmt_Copy, Command_Start, I, Format (Value, Width, Justification, Upper_Case)); return Format_Type (Fmt_Copy); when 'l' => Replace_Slice (Fmt_Copy, Command_Start, I, Format (Value, Width, Justification, Lower_Case)); return Format_Type (Fmt_Copy); when '-' | '+' | '*' => if Justification_Changed or else Digit_Occured then raise Format_Error; end if; Justification_Changed := True; case Element (Fmt_Copy, I) is when '-' => Justification := Left; when '+' => Justification := Right; when '*' => Justification := Center; when others => null; end case; when '0' .. '9' => Width := Width * 10 + Character'Pos (Element (Fmt_Copy, I)) - Character'Pos ('0'); when others => raise Format_Error; end case; end loop; end if; raise Format_Error; end "&"; end Formatted_Output.Enumeration_Output;
true
------------------------------------------------------------------------------ -- -- -- File: -- -- formatted_output-enumeration_output.adb -- -- -- -- Description: -- -- Formatted_Output.Enumeration_Output generic package body -- -- -- -- Author: -- -- PI:NAME:<NAME>END_PI, PI:EMAIL:<EMAIL>END_PI -- -- -- -- Revision history: -- -- 27/01/99 - original -- -- 16/03/99 - added support for justification characters -- -- -- ------------------------------------------------------------------------------ with Ada.Text_IO, Ada.Characters.Handling, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded; use Ada.Text_IO, Ada.Characters.Handling, Ada.Strings, Ada.Strings.Fixed, Ada.Strings.Unbounded; package body Formatted_Output.Enumeration_Output is package Item_Type_IO is new Enumeration_IO (Item_Type); use Item_Type_IO; type Style_Type is (Capitalized, Upper_Case, Lower_Case); function Format (Value : Item_Type; Initial_Width : Integer; Justification : Alignment; Style : Style_Type) return String is Img : String (1 .. Maximal_Item_Length); Width, Real_Width : Integer; Past_Last : Integer := 1; begin -- Format case Style is when Capitalized => Put (Img, Value, Set => Type_Set'(Lower_Case)); Img (1) := To_Upper (Img (1)); when Lower_Case => Put (Img, Value, Set => Type_Set'(Lower_Case)); when Upper_Case => Put (Img, Value, Set => Type_Set'(Upper_Case)); end case; while Img (Past_Last) /= ' ' loop Past_Last := Past_Last + 1; end loop; Real_Width := Past_Last - 1; if Initial_Width < Real_Width then Width := Real_Width; else Width := Initial_Width; end if; declare S : String (1 .. Width); begin Move (Img (Past_Last - Real_Width .. Past_Last - 1), S, Justify => Justification, Pad => Filler); return S; end; end Format; function "&" (Fmt : Format_Type; Value : Item_Type) return Format_Type is Command_Start : constant Integer := Scan_To_Percent_Sign (Fmt); Width : Integer := 0; Digit_Occured, Justification_Changed : Boolean := False; Justification : Alignment := Right; Fmt_Copy : Unbounded_String; begin -- "&" if Command_Start /= 0 then Fmt_Copy := Unbounded_String (Fmt); for I in Command_Start + 1 .. Length (Fmt_Copy) loop case Element (Fmt_Copy, I) is when 'c' => Replace_Slice (Fmt_Copy, Command_Start, I, Format (Value, Width, Justification, Capitalized)); return Format_Type (Fmt_Copy); when 'u' => Replace_Slice (Fmt_Copy, Command_Start, I, Format (Value, Width, Justification, Upper_Case)); return Format_Type (Fmt_Copy); when 'l' => Replace_Slice (Fmt_Copy, Command_Start, I, Format (Value, Width, Justification, Lower_Case)); return Format_Type (Fmt_Copy); when '-' | '+' | '*' => if Justification_Changed or else Digit_Occured then raise Format_Error; end if; Justification_Changed := True; case Element (Fmt_Copy, I) is when '-' => Justification := Left; when '+' => Justification := Right; when '*' => Justification := Center; when others => null; end case; when '0' .. '9' => Width := Width * 10 + Character'Pos (Element (Fmt_Copy, I)) - Character'Pos ('0'); when others => raise Format_Error; end case; end loop; end if; raise Format_Error; end "&"; end Formatted_Output.Enumeration_Output;
[ { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --\n-- All rig", "end": 829, "score": 0.9998879432678223, "start": 816, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --\n-- All rights reserved. ", "end": 849, "score": 0.9999330639839172, "start": 831, "tag": "EMAIL", "value": "vgodunko@gmail.com" } ]
source/amf/uml/amf-uml-structural_features.ads
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- By specializing multiplicity element, it supports a multiplicity that -- specifies valid cardinalities for the collection of values associated with -- an instantiation of the structural feature. -- -- A structural feature is a typed feature of a classifier that specifies the -- structure of instances of the classifier. ------------------------------------------------------------------------------ with AMF.UML.Features; with AMF.UML.Multiplicity_Elements; with AMF.UML.Typed_Elements; package AMF.UML.Structural_Features is pragma Preelaborate; type UML_Structural_Feature is limited interface and AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element and AMF.UML.Features.UML_Feature and AMF.UML.Typed_Elements.UML_Typed_Element; type UML_Structural_Feature_Access is access all UML_Structural_Feature'Class; for UML_Structural_Feature_Access'Storage_Size use 0; not overriding function Get_Is_Read_Only (Self : not null access constant UML_Structural_Feature) return Boolean is abstract; -- Getter of StructuralFeature::isReadOnly. -- -- States whether the feature's value may be modified by a client. not overriding procedure Set_Is_Read_Only (Self : not null access UML_Structural_Feature; To : Boolean) is abstract; -- Setter of StructuralFeature::isReadOnly. -- -- States whether the feature's value may be modified by a client. end AMF.UML.Structural_Features;
13487
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- 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. ------------------------------------------------------------------------------ -- By specializing multiplicity element, it supports a multiplicity that -- specifies valid cardinalities for the collection of values associated with -- an instantiation of the structural feature. -- -- A structural feature is a typed feature of a classifier that specifies the -- structure of instances of the classifier. ------------------------------------------------------------------------------ with AMF.UML.Features; with AMF.UML.Multiplicity_Elements; with AMF.UML.Typed_Elements; package AMF.UML.Structural_Features is pragma Preelaborate; type UML_Structural_Feature is limited interface and AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element and AMF.UML.Features.UML_Feature and AMF.UML.Typed_Elements.UML_Typed_Element; type UML_Structural_Feature_Access is access all UML_Structural_Feature'Class; for UML_Structural_Feature_Access'Storage_Size use 0; not overriding function Get_Is_Read_Only (Self : not null access constant UML_Structural_Feature) return Boolean is abstract; -- Getter of StructuralFeature::isReadOnly. -- -- States whether the feature's value may be modified by a client. not overriding procedure Set_Is_Read_Only (Self : not null access UML_Structural_Feature; To : Boolean) is abstract; -- Setter of StructuralFeature::isReadOnly. -- -- States whether the feature's value may be modified by a client. end AMF.UML.Structural_Features;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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. ------------------------------------------------------------------------------ -- By specializing multiplicity element, it supports a multiplicity that -- specifies valid cardinalities for the collection of values associated with -- an instantiation of the structural feature. -- -- A structural feature is a typed feature of a classifier that specifies the -- structure of instances of the classifier. ------------------------------------------------------------------------------ with AMF.UML.Features; with AMF.UML.Multiplicity_Elements; with AMF.UML.Typed_Elements; package AMF.UML.Structural_Features is pragma Preelaborate; type UML_Structural_Feature is limited interface and AMF.UML.Multiplicity_Elements.UML_Multiplicity_Element and AMF.UML.Features.UML_Feature and AMF.UML.Typed_Elements.UML_Typed_Element; type UML_Structural_Feature_Access is access all UML_Structural_Feature'Class; for UML_Structural_Feature_Access'Storage_Size use 0; not overriding function Get_Is_Read_Only (Self : not null access constant UML_Structural_Feature) return Boolean is abstract; -- Getter of StructuralFeature::isReadOnly. -- -- States whether the feature's value may be modified by a client. not overriding procedure Set_Is_Read_Only (Self : not null access UML_Structural_Feature; To : Boolean) is abstract; -- Setter of StructuralFeature::isReadOnly. -- -- States whether the feature's value may be modified by a client. end AMF.UML.Structural_Features;
[ { "context": "e-Identifier: Apache-2.0\n--\n-- Copyright (c) 2019 onox <denkpadje@gmail.com>\n--\n-- Licensed under the A", "end": 70, "score": 0.9992201328277588, "start": 66, "tag": "USERNAME", "value": "onox" }, { "context": "ifier: Apache-2.0\n--\n-- Copyright (c) 2019 onox <denkpadje@gmail.com>\n--\n-- Licensed under the Apache License, Versio", "end": 91, "score": 0.9999234080314636, "start": 72, "tag": "EMAIL", "value": "denkpadje@gmail.com" } ]
orka_plugin_sdl/src/orka-inputs-sdl.adb
onox/orka
52
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2019 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with SDL.Inputs.Mice; package body Orka.Inputs.SDL is overriding procedure Set_Cursor_Mode (Object : in out SDL_Pointer_Input; Mode : Pointers.Default.Cursor_Mode) is use all type Pointers.Default.Cursor_Mode; begin case Mode is when Normal => Standard.SDL.Inputs.Mice.Set_Relative_Mode (False); Standard.SDL.Inputs.Mice.Show_Cursor (True); when Hidden => Standard.SDL.Inputs.Mice.Set_Relative_Mode (False); Standard.SDL.Inputs.Mice.Show_Cursor (False); when Disabled => Standard.SDL.Inputs.Mice.Set_Relative_Mode (True); end case; end Set_Cursor_Mode; procedure Set_Button_State (Object : in out SDL_Pointer_Input; Subject : Standard.SDL.Events.Mice.Buttons; State : Pointers.Button_State) is use Standard.SDL.Events; use all type Inputs.Pointers.Button; begin case Subject is when Mice.Left => Object.Set_Button_State (Left, State); when Mice.Right => Object.Set_Button_State (Right, State); when Mice.Middle => Object.Set_Button_State (Middle, State); when others => raise Program_Error with "Invalid mouse button"; end case; end Set_Button_State; procedure Set_Window (Object : in out SDL_Pointer_Input; Window : Standard.SDL.Video.Windows.Window) is begin Object.Window := Window.Get_ID; end Set_Window; function Create_Pointer_Input return Inputs.Pointers.Pointer_Input_Ptr is begin return new SDL_Pointer_Input' (Pointers.Default.Abstract_Pointer_Input with others => <>); end Create_Pointer_Input; end Orka.Inputs.SDL;
5848
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2019 onox <<EMAIL>> -- -- 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 SDL.Inputs.Mice; package body Orka.Inputs.SDL is overriding procedure Set_Cursor_Mode (Object : in out SDL_Pointer_Input; Mode : Pointers.Default.Cursor_Mode) is use all type Pointers.Default.Cursor_Mode; begin case Mode is when Normal => Standard.SDL.Inputs.Mice.Set_Relative_Mode (False); Standard.SDL.Inputs.Mice.Show_Cursor (True); when Hidden => Standard.SDL.Inputs.Mice.Set_Relative_Mode (False); Standard.SDL.Inputs.Mice.Show_Cursor (False); when Disabled => Standard.SDL.Inputs.Mice.Set_Relative_Mode (True); end case; end Set_Cursor_Mode; procedure Set_Button_State (Object : in out SDL_Pointer_Input; Subject : Standard.SDL.Events.Mice.Buttons; State : Pointers.Button_State) is use Standard.SDL.Events; use all type Inputs.Pointers.Button; begin case Subject is when Mice.Left => Object.Set_Button_State (Left, State); when Mice.Right => Object.Set_Button_State (Right, State); when Mice.Middle => Object.Set_Button_State (Middle, State); when others => raise Program_Error with "Invalid mouse button"; end case; end Set_Button_State; procedure Set_Window (Object : in out SDL_Pointer_Input; Window : Standard.SDL.Video.Windows.Window) is begin Object.Window := Window.Get_ID; end Set_Window; function Create_Pointer_Input return Inputs.Pointers.Pointer_Input_Ptr is begin return new SDL_Pointer_Input' (Pointers.Default.Abstract_Pointer_Input with others => <>); end Create_Pointer_Input; end Orka.Inputs.SDL;
true
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2019 onox <PI:EMAIL:<EMAIL>END_PI> -- -- 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 SDL.Inputs.Mice; package body Orka.Inputs.SDL is overriding procedure Set_Cursor_Mode (Object : in out SDL_Pointer_Input; Mode : Pointers.Default.Cursor_Mode) is use all type Pointers.Default.Cursor_Mode; begin case Mode is when Normal => Standard.SDL.Inputs.Mice.Set_Relative_Mode (False); Standard.SDL.Inputs.Mice.Show_Cursor (True); when Hidden => Standard.SDL.Inputs.Mice.Set_Relative_Mode (False); Standard.SDL.Inputs.Mice.Show_Cursor (False); when Disabled => Standard.SDL.Inputs.Mice.Set_Relative_Mode (True); end case; end Set_Cursor_Mode; procedure Set_Button_State (Object : in out SDL_Pointer_Input; Subject : Standard.SDL.Events.Mice.Buttons; State : Pointers.Button_State) is use Standard.SDL.Events; use all type Inputs.Pointers.Button; begin case Subject is when Mice.Left => Object.Set_Button_State (Left, State); when Mice.Right => Object.Set_Button_State (Right, State); when Mice.Middle => Object.Set_Button_State (Middle, State); when others => raise Program_Error with "Invalid mouse button"; end case; end Set_Button_State; procedure Set_Window (Object : in out SDL_Pointer_Input; Window : Standard.SDL.Video.Windows.Window) is begin Object.Window := Window.Get_ID; end Set_Window; function Create_Pointer_Input return Inputs.Pointers.Pointer_Input_Ptr is begin return new SDL_Pointer_Input' (Pointers.Default.Abstract_Pointer_Input with others => <>); end Create_Pointer_Input; end Orka.Inputs.SDL;
[ { "context": "-- part of OpenGLAda, (c) 2017 Felix Krause\n-- released under the terms of the MIT license, ", "end": 44, "score": 0.9998462796211243, "start": 32, "tag": "NAME", "value": "Felix Krause" } ]
src/gl/implementation/gl-enums-indexes.ads
Roldak/OpenGLAda
79
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with GL.Types; with GL.Enums.Getter; generic Min_Representation : Types.Int; Getter_Param : Enums.Getter.Parameter; package GL.Enums.Indexes is pragma Preelaborate; use GL.Types; Max : constant Int := Getter.Get_Max (Getter_Param); subtype Index is Int range 0 .. Max; function Representation (Value : Index) return Int; function Value (Representation : Int) return Index; end GL.Enums.Indexes;
25538
-- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" with GL.Types; with GL.Enums.Getter; generic Min_Representation : Types.Int; Getter_Param : Enums.Getter.Parameter; package GL.Enums.Indexes is pragma Preelaborate; use GL.Types; Max : constant Int := Getter.Get_Max (Getter_Param); subtype Index is Int range 0 .. Max; function Representation (Value : Index) return Int; function Value (Representation : Int) return Index; end GL.Enums.Indexes;
true
-- part of OpenGLAda, (c) 2017 PI:NAME:<NAME>END_PI -- released under the terms of the MIT license, see the file "COPYING" with GL.Types; with GL.Enums.Getter; generic Min_Representation : Types.Int; Getter_Param : Enums.Getter.Parameter; package GL.Enums.Indexes is pragma Preelaborate; use GL.Types; Max : constant Int := Getter.Get_Max (Getter_Param); subtype Index is Int range 0 .. Max; function Representation (Value : Index) return Int; function Value (Representation : Int) return Index; end GL.Enums.Indexes;
[ { "context": "-- Copyright 2017-2021 Jeff Foley. All rights reserved.\n-- Use of this source code ", "end": 33, "score": 0.9998526573181152, "start": 23, "tag": "NAME", "value": "Jeff Foley" }, { "context": "file.\n\nlocal url = require(\"url\")\n\nname = \"ArchiveIt\"\ntype = \"archive\"\n\nfunction start()\n set_rate_", "end": 200, "score": 0.5825909376144409, "start": 198, "tag": "USERNAME", "value": "It" } ]
resources/scripts/archive/archiveit.ads
Elon143/Amass
7,053
-- Copyright 2017-2021 Jeff Foley. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local url = require("url") name = "ArchiveIt" type = "archive" function start() set_rate_limit(2) end function vertical(ctx, domain) scrape(ctx, {['url']=first_url(domain)}) local found = pages(ctx, domain) if not found then return end for i=1,50,1 do local ok = scrape(ctx, {['url']=second_url(domain, i)}) if not ok then break end end end function first_url(domain) local params = { ['url']=domain, ['matchType']="domain", ['fl']="original", ['collapse']="urlkey", } return "https://wayback.archive-it.org/all/timemap/cdx?" .. url.build_query_string(params) end function second_url(domain, pagenum) local params = { ['show']="Sites", ['q']=domain, ['page']=pagenum, } return "https://archive-it.org/explore?" .. url.build_query_string(params) end function pages(ctx, domain) local u = "https://archive-it.org/explore?show=Sites&q=" .. domain local resp, err = request(ctx, {['url']=u}) if (err ~= nil and err ~= "") then log(ctx, "pages request to service failed: " .. err) return false end local match = find(resp, "No metadata results") if (match == nil or #match == 0) then return false end return true end
15418
-- Copyright 2017-2021 <NAME>. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local url = require("url") name = "ArchiveIt" type = "archive" function start() set_rate_limit(2) end function vertical(ctx, domain) scrape(ctx, {['url']=first_url(domain)}) local found = pages(ctx, domain) if not found then return end for i=1,50,1 do local ok = scrape(ctx, {['url']=second_url(domain, i)}) if not ok then break end end end function first_url(domain) local params = { ['url']=domain, ['matchType']="domain", ['fl']="original", ['collapse']="urlkey", } return "https://wayback.archive-it.org/all/timemap/cdx?" .. url.build_query_string(params) end function second_url(domain, pagenum) local params = { ['show']="Sites", ['q']=domain, ['page']=pagenum, } return "https://archive-it.org/explore?" .. url.build_query_string(params) end function pages(ctx, domain) local u = "https://archive-it.org/explore?show=Sites&q=" .. domain local resp, err = request(ctx, {['url']=u}) if (err ~= nil and err ~= "") then log(ctx, "pages request to service failed: " .. err) return false end local match = find(resp, "No metadata results") if (match == nil or #match == 0) then return false end return true end
true
-- Copyright 2017-2021 PI:NAME:<NAME>END_PI. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local url = require("url") name = "ArchiveIt" type = "archive" function start() set_rate_limit(2) end function vertical(ctx, domain) scrape(ctx, {['url']=first_url(domain)}) local found = pages(ctx, domain) if not found then return end for i=1,50,1 do local ok = scrape(ctx, {['url']=second_url(domain, i)}) if not ok then break end end end function first_url(domain) local params = { ['url']=domain, ['matchType']="domain", ['fl']="original", ['collapse']="urlkey", } return "https://wayback.archive-it.org/all/timemap/cdx?" .. url.build_query_string(params) end function second_url(domain, pagenum) local params = { ['show']="Sites", ['q']=domain, ['page']=pagenum, } return "https://archive-it.org/explore?" .. url.build_query_string(params) end function pages(ctx, domain) local u = "https://archive-it.org/explore?show=Sites&q=" .. domain local resp, err = request(ctx, {['url']=u}) if (err ~= nil and err ~= "") then log(ctx, "pages request to service failed: " .. err) return false end local match = find(resp, "No metadata results") if (match == nil or #match == 0) then return false end return true end
[ { "context": "-- SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 43, "score": 0.9998552203178406, "start": 33, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 63, "score": 0.9999306201934814, "start": 45, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
sources/md/markdown-fenced_code_blocks.ads
reznikmm/markdown
0
-- SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- with Ada.Tags; with League.String_Vectors; with League.Strings; with Markdown.Blocks; limited with Markdown.Visitors; package Markdown.Fenced_Code_Blocks is type Fenced_Code_Block is new Markdown.Blocks.Block with private; function Lines (Self : Fenced_Code_Block'Class) return League.String_Vectors.Universal_String_Vector; function Info_String (Self : Fenced_Code_Block'Class) return League.Strings.Universal_String; overriding function Create (Line : not null access Markdown.Blocks.Text_Line) return Fenced_Code_Block; overriding procedure Append_Line (Self : in out Fenced_Code_Block; Line : Markdown.Blocks.Text_Line; CIP : Can_Interrupt_Paragraph; Ok : in out Boolean); overriding procedure Visit (Self : in out Fenced_Code_Block; Visitor : in out Markdown.Visitors.Visitor'Class); procedure Filter (Line : Markdown.Blocks.Text_Line; Tag : in out Ada.Tags.Tag; CIP : out Can_Interrupt_Paragraph); private type Fenced_Code_Block is new Markdown.Blocks.Block with record Is_Tick_Fence : Boolean; Fence_Length : Positive; Fence_Indent : Natural; Closed : Boolean := False; Lines : League.String_Vectors.Universal_String_Vector; Blank : League.String_Vectors.Universal_String_Vector; Info_String : League.Strings.Universal_String; end record; end Markdown.Fenced_Code_Blocks;
25196
-- SPDX-FileCopyrightText: 2020 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- with Ada.Tags; with League.String_Vectors; with League.Strings; with Markdown.Blocks; limited with Markdown.Visitors; package Markdown.Fenced_Code_Blocks is type Fenced_Code_Block is new Markdown.Blocks.Block with private; function Lines (Self : Fenced_Code_Block'Class) return League.String_Vectors.Universal_String_Vector; function Info_String (Self : Fenced_Code_Block'Class) return League.Strings.Universal_String; overriding function Create (Line : not null access Markdown.Blocks.Text_Line) return Fenced_Code_Block; overriding procedure Append_Line (Self : in out Fenced_Code_Block; Line : Markdown.Blocks.Text_Line; CIP : Can_Interrupt_Paragraph; Ok : in out Boolean); overriding procedure Visit (Self : in out Fenced_Code_Block; Visitor : in out Markdown.Visitors.Visitor'Class); procedure Filter (Line : Markdown.Blocks.Text_Line; Tag : in out Ada.Tags.Tag; CIP : out Can_Interrupt_Paragraph); private type Fenced_Code_Block is new Markdown.Blocks.Block with record Is_Tick_Fence : Boolean; Fence_Length : Positive; Fence_Indent : Natural; Closed : Boolean := False; Lines : League.String_Vectors.Universal_String_Vector; Blank : League.String_Vectors.Universal_String_Vector; Info_String : League.Strings.Universal_String; end record; end Markdown.Fenced_Code_Blocks;
true
-- SPDX-FileCopyrightText: 2020 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ---------------------------------------------------------------- with Ada.Tags; with League.String_Vectors; with League.Strings; with Markdown.Blocks; limited with Markdown.Visitors; package Markdown.Fenced_Code_Blocks is type Fenced_Code_Block is new Markdown.Blocks.Block with private; function Lines (Self : Fenced_Code_Block'Class) return League.String_Vectors.Universal_String_Vector; function Info_String (Self : Fenced_Code_Block'Class) return League.Strings.Universal_String; overriding function Create (Line : not null access Markdown.Blocks.Text_Line) return Fenced_Code_Block; overriding procedure Append_Line (Self : in out Fenced_Code_Block; Line : Markdown.Blocks.Text_Line; CIP : Can_Interrupt_Paragraph; Ok : in out Boolean); overriding procedure Visit (Self : in out Fenced_Code_Block; Visitor : in out Markdown.Visitors.Visitor'Class); procedure Filter (Line : Markdown.Blocks.Text_Line; Tag : in out Ada.Tags.Tag; CIP : out Can_Interrupt_Paragraph); private type Fenced_Code_Block is new Markdown.Blocks.Block with record Is_Tick_Fence : Boolean; Fence_Length : Positive; Fence_Indent : Natural; Closed : Boolean := False; Lines : League.String_Vectors.Universal_String_Vector; Blank : League.String_Vectors.Universal_String_Vector; Info_String : League.Strings.Universal_String; end record; end Markdown.Fenced_Code_Blocks;
[ { "context": "--\n-- Copyright (c) 2007, 2008 Tero Koskinen <tero.koskinen@iki.fi>\n--\n-- Permission to use, c", "end": 44, "score": 0.9998421669006348, "start": 31, "tag": "NAME", "value": "Tero Koskinen" }, { "context": "--\n-- Copyright (c) 2007, 2008 Tero Koskinen <tero.koskinen@iki.fi>\n--\n-- Permission to use, copy, modify, and distr", "end": 66, "score": 0.9999343156814575, "start": 46, "tag": "EMAIL", "value": "tero.koskinen@iki.fi" } ]
testutil/ahven/ahven-temporary_output.adb
Letractively/ada-util
60
-- -- Copyright (c) 2007, 2008 Tero Koskinen <tero.koskinen@iki.fi> -- -- Permission to use, copy, modify, and distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- with Ada.Strings.Fixed; package body Ahven.Temporary_Output is use Ahven.AStrings; use Ada.Strings.Fixed; Temp_Counter : Natural := 0; procedure Create_Temp (File : out Temporary_File) is Filename : constant String := "ahven_temp_" & Trim (Integer'Image (Temp_Counter), Ada.Strings.Both); begin if Temp_Counter < Natural'Last then Temp_Counter := Temp_Counter + 1; else raise Temporary_File_Error; end if; File.Name := To_Bounded_String (Filename); Ada.Text_IO.Create (File.Handle, Ada.Text_IO.Out_File, Filename); end Create_Temp; function Get_Name (File : Temporary_File) return String is begin return To_String (File.Name); end Get_Name; procedure Redirect_Output (To_File : in out Temporary_File) is begin Ada.Text_IO.Flush; Ada.Text_IO.Set_Output (To_File.Handle); end Redirect_Output; procedure Restore_Output is begin Ada.Text_IO.Flush; Ada.Text_IO.Set_Output (Ada.Text_IO.Standard_Output); end Restore_Output; procedure Remove_Temp (File : in out Temporary_File) is begin if not Ada.Text_IO.Is_Open (File.Handle) then Ada.Text_IO.Open (File.Handle, Ada.Text_IO.Out_File, To_String (File.Name)); end if; Ada.Text_IO.Delete (File.Handle); end Remove_Temp; procedure Close_Temp (File : in out Temporary_File) is begin Ada.Text_IO.Close (File.Handle); end Close_Temp; end Ahven.Temporary_Output;
9500
-- -- Copyright (c) 2007, 2008 <NAME> <<EMAIL>> -- -- Permission to use, copy, modify, and distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- with Ada.Strings.Fixed; package body Ahven.Temporary_Output is use Ahven.AStrings; use Ada.Strings.Fixed; Temp_Counter : Natural := 0; procedure Create_Temp (File : out Temporary_File) is Filename : constant String := "ahven_temp_" & Trim (Integer'Image (Temp_Counter), Ada.Strings.Both); begin if Temp_Counter < Natural'Last then Temp_Counter := Temp_Counter + 1; else raise Temporary_File_Error; end if; File.Name := To_Bounded_String (Filename); Ada.Text_IO.Create (File.Handle, Ada.Text_IO.Out_File, Filename); end Create_Temp; function Get_Name (File : Temporary_File) return String is begin return To_String (File.Name); end Get_Name; procedure Redirect_Output (To_File : in out Temporary_File) is begin Ada.Text_IO.Flush; Ada.Text_IO.Set_Output (To_File.Handle); end Redirect_Output; procedure Restore_Output is begin Ada.Text_IO.Flush; Ada.Text_IO.Set_Output (Ada.Text_IO.Standard_Output); end Restore_Output; procedure Remove_Temp (File : in out Temporary_File) is begin if not Ada.Text_IO.Is_Open (File.Handle) then Ada.Text_IO.Open (File.Handle, Ada.Text_IO.Out_File, To_String (File.Name)); end if; Ada.Text_IO.Delete (File.Handle); end Remove_Temp; procedure Close_Temp (File : in out Temporary_File) is begin Ada.Text_IO.Close (File.Handle); end Close_Temp; end Ahven.Temporary_Output;
true
-- -- Copyright (c) 2007, 2008 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- Permission to use, copy, modify, and distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- with Ada.Strings.Fixed; package body Ahven.Temporary_Output is use Ahven.AStrings; use Ada.Strings.Fixed; Temp_Counter : Natural := 0; procedure Create_Temp (File : out Temporary_File) is Filename : constant String := "ahven_temp_" & Trim (Integer'Image (Temp_Counter), Ada.Strings.Both); begin if Temp_Counter < Natural'Last then Temp_Counter := Temp_Counter + 1; else raise Temporary_File_Error; end if; File.Name := To_Bounded_String (Filename); Ada.Text_IO.Create (File.Handle, Ada.Text_IO.Out_File, Filename); end Create_Temp; function Get_Name (File : Temporary_File) return String is begin return To_String (File.Name); end Get_Name; procedure Redirect_Output (To_File : in out Temporary_File) is begin Ada.Text_IO.Flush; Ada.Text_IO.Set_Output (To_File.Handle); end Redirect_Output; procedure Restore_Output is begin Ada.Text_IO.Flush; Ada.Text_IO.Set_Output (Ada.Text_IO.Standard_Output); end Restore_Output; procedure Remove_Temp (File : in out Temporary_File) is begin if not Ada.Text_IO.Is_Open (File.Handle) then Ada.Text_IO.Open (File.Handle, Ada.Text_IO.Out_File, To_String (File.Name)); end if; Ada.Text_IO.Delete (File.Handle); end Remove_Temp; procedure Close_Temp (File : in out Temporary_File) is begin Ada.Text_IO.Close (File.Handle); end Close_Temp; end Ahven.Temporary_Output;
[ { "context": "Fast Multimedia Library\n-- Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)\n-- This software is provid", "end": 147, "score": 0.9998608827590942, "start": 133, "tag": "NAME", "value": "Laurent Gomila" }, { "context": "ibrary\n-- Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)\n-- This software is provided 'as-is', without an", "end": 169, "score": 0.9999318718910217, "start": 149, "tag": "EMAIL", "value": "laurent@sfml-dev.org" } ]
include/sf-network-udpsocket.ads
Fabien-Chouteau/ASFML
0
--////////////////////////////////////////////////////////// -- SFML - Simple and Fast Multimedia Library -- Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) -- This software is provided 'as-is', without any express or implied warranty. -- In no event will the authors be held liable for any damages arising from the use of this software. -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it freely, -- subject to the following restrictions: -- 1. The origin of this software must not be misrepresented; -- you must not claim that you wrote the original software. -- If you use this software in a product, an acknowledgment -- in the product documentation would be appreciated but is not required. -- 2. Altered source versions must be plainly marked as such, -- and must not be misrepresented as being the original software. -- 3. This notice may not be removed or altered from any source distribution. --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// with Sf.Network.IpAddress; with Sf.Network.SocketStatus; package Sf.Network.UdpSocket is --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --/ @brief Create a new UDP socket --/ --/ @return A new sfUdpSocket object --/ --////////////////////////////////////////////////////////// function create return sfUdpSocket_Ptr; --////////////////////////////////////////////////////////// --/ @brief Destroy a UDP socket --/ --/ @param socket UDP socket to destroy --/ --////////////////////////////////////////////////////////// procedure destroy (socket : sfUdpSocket_Ptr); --////////////////////////////////////////////////////////// --/ @brief Set the blocking state of a UDP listener --/ --/ In blocking mode, calls will not return until they have --/ completed their task. For example, a call to --/ sfUDPSocket_receive in blocking mode won't return until --/ new data was actually received. --/ In non-blocking mode, calls will always return immediately, --/ using the return code to signal whether there was data --/ available or not. --/ By default, all sockets are blocking. --/ --/ @param socket UDP socket object --/ @param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking --/ --////////////////////////////////////////////////////////// procedure setBlocking (socket : sfUdpSocket_Ptr; blocking : sfBool); --////////////////////////////////////////////////////////// --/ @brief Tell whether a UDP socket is in blocking or non-blocking mode --/ --/ @param socket UDP socket object --/ --/ @return sfTrue if the socket is blocking, sfFalse otherwise --/ --////////////////////////////////////////////////////////// function isBlocking (socket : sfUdpSocket_Ptr) return sfBool; --////////////////////////////////////////////////////////// --/ @brief Get the port to which a UDP socket is bound locally --/ --/ If the socket is not bound to a port, this function --/ returns 0. --/ --/ @param socket UDP socket object --/ --/ @return Port to which the socket is bound --/ --////////////////////////////////////////////////////////// function getLocalPort (socket : sfUdpSocket_Ptr) return sfUint16; --////////////////////////////////////////////////////////// --/ @brief Bind a UDP socket to a specific port --/ --/ Binding the socket to a port is necessary for being --/ able to receive data on that port. --/ You can use the special value 0 to tell the --/ system to automatically pick an available port, and then --/ call sfUdpSocket_getLocalPort to retrieve the chosen port. --/ --/ If there is no specific address to listen to, pass sfIpAddress_Any --/ --/ @param socket UDP socket object --/ @param port Port to bind the socket to --/ @param address Address of the interface to bind to --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function bind (socket : sfUdpSocket_Ptr; port : sfUint16; address : Sf.Network.IpAddress.sfIpAddress) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Unbind a UDP socket from the local port to which it is bound --/ --/ The port that the socket was previously using is immediately --/ available after this function is called. If the --/ socket is not bound to a port, this function has no effect. --/ --/ @param socket UDP socket object --/ --////////////////////////////////////////////////////////// procedure unbind (socket : sfUdpSocket_Ptr); --////////////////////////////////////////////////////////// --/ @brief Send raw data to a remote peer with a UDP socket --/ --/ Make sure that @a size is not greater than --/ sfUdpSocket_maxDatagramSize(), otherwise this function will --/ fail and no data will be sent. --/ --/ @param socket UDP socket object --/ @param data Pointer to the sequence of bytes to send --/ @param size Number of bytes to send --/ @param remoteAddress Address of the receiver --/ @param remotePort Port of the receiver to send the data to --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function send (socket : sfUdpSocket_Ptr; data : Standard.System.Address; size : sfSize_t; remoteAddress : Sf.Network.IpAddress.sfIpAddress; remotePort : sfUint16) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Receive raw data from a remote peer with a UDP socket --/ --/ In blocking mode, this function will wait until some --/ bytes are actually received. --/ Be careful to use a buffer which is large enough for --/ the data that you intend to receive, if it is too small --/ then an error will be returned and *all* the data will --/ be lost. --/ --/ @param socket UDP socket object --/ @param data Pointer to the array to fill with the received bytes --/ @param size Maximum number of bytes that can be received --/ @param received This variable is filled with the actual number of bytes received --/ @param remoteAddress Address of the peer that sent the data --/ @param remotePort Port of the peer that sent the data --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function receive (socket : sfUdpSocket_Ptr; data : Standard.System.Address; size : sfSize_t; received : access sfSize_t; remoteAddress : access Sf.Network.IpAddress.sfIpAddress; remotePort : access sfUint16) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Send a formatted packet of data to a remote peer with a UDP socket --/ --/ Make sure that the packet size is not greater than --/ sfUdpSocket_maxDatagramSize(), otherwise this function will --/ fail and no data will be sent. --/ --/ @param socket UDP socket object --/ @param packet Packet to send --/ @param remoteAddress Address of the receiver --/ @param remotePort Port of the receiver to send the data to --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function sendPacket (socket : sfUdpSocket_Ptr; packet : sfPacket_Ptr; remoteAddress : Sf.Network.IpAddress.sfIpAddress; remotePort : sfUint16) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Receive a formatted packet of data from a remote peer with a UDP socket --/ --/ In blocking mode, this function will wait until the whole packet --/ has been received. --/ --/ @param packet Packet to fill with the received data --/ @param remoteAddress Address of the peer that sent the data --/ @param remotePort Port of the peer that sent the data --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function receivePacket (socket : sfUdpSocket_Ptr; packet : sfPacket_Ptr; remoteAddress : access Sf.Network.IpAddress.sfIpAddress; remotePort : access sfUint16) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Return the maximum number of bytes that can be --/ sent in a single UDP datagram --/ --/ @return The maximum size of a UDP datagram (message) --/ --////////////////////////////////////////////////////////// function maxDatagramSize return sfUint32; private pragma Import (C, create, "sfUdpSocket_create"); pragma Import (C, destroy, "sfUdpSocket_destroy"); pragma Import (C, setBlocking, "sfUdpSocket_setBlocking"); pragma Import (C, isBlocking, "sfUdpSocket_isBlocking"); pragma Import (C, getLocalPort, "sfUdpSocket_getLocalPort"); pragma Import (C, bind, "sfUdpSocket_bind"); pragma Import (C, unbind, "sfUdpSocket_unbind"); pragma Import (C, send, "sfUdpSocket_send"); pragma Import (C, receive, "sfUdpSocket_receive"); pragma Import (C, sendPacket, "sfUdpSocket_sendPacket"); pragma Import (C, receivePacket, "sfUdpSocket_receivePacket"); pragma Import (C, maxDatagramSize, "sfUdpSocket_maxDatagramSize"); end Sf.Network.UdpSocket;
28050
--////////////////////////////////////////////////////////// -- SFML - Simple and Fast Multimedia Library -- Copyright (C) 2007-2015 <NAME> (<EMAIL>) -- This software is provided 'as-is', without any express or implied warranty. -- In no event will the authors be held liable for any damages arising from the use of this software. -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it freely, -- subject to the following restrictions: -- 1. The origin of this software must not be misrepresented; -- you must not claim that you wrote the original software. -- If you use this software in a product, an acknowledgment -- in the product documentation would be appreciated but is not required. -- 2. Altered source versions must be plainly marked as such, -- and must not be misrepresented as being the original software. -- 3. This notice may not be removed or altered from any source distribution. --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// with Sf.Network.IpAddress; with Sf.Network.SocketStatus; package Sf.Network.UdpSocket is --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --/ @brief Create a new UDP socket --/ --/ @return A new sfUdpSocket object --/ --////////////////////////////////////////////////////////// function create return sfUdpSocket_Ptr; --////////////////////////////////////////////////////////// --/ @brief Destroy a UDP socket --/ --/ @param socket UDP socket to destroy --/ --////////////////////////////////////////////////////////// procedure destroy (socket : sfUdpSocket_Ptr); --////////////////////////////////////////////////////////// --/ @brief Set the blocking state of a UDP listener --/ --/ In blocking mode, calls will not return until they have --/ completed their task. For example, a call to --/ sfUDPSocket_receive in blocking mode won't return until --/ new data was actually received. --/ In non-blocking mode, calls will always return immediately, --/ using the return code to signal whether there was data --/ available or not. --/ By default, all sockets are blocking. --/ --/ @param socket UDP socket object --/ @param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking --/ --////////////////////////////////////////////////////////// procedure setBlocking (socket : sfUdpSocket_Ptr; blocking : sfBool); --////////////////////////////////////////////////////////// --/ @brief Tell whether a UDP socket is in blocking or non-blocking mode --/ --/ @param socket UDP socket object --/ --/ @return sfTrue if the socket is blocking, sfFalse otherwise --/ --////////////////////////////////////////////////////////// function isBlocking (socket : sfUdpSocket_Ptr) return sfBool; --////////////////////////////////////////////////////////// --/ @brief Get the port to which a UDP socket is bound locally --/ --/ If the socket is not bound to a port, this function --/ returns 0. --/ --/ @param socket UDP socket object --/ --/ @return Port to which the socket is bound --/ --////////////////////////////////////////////////////////// function getLocalPort (socket : sfUdpSocket_Ptr) return sfUint16; --////////////////////////////////////////////////////////// --/ @brief Bind a UDP socket to a specific port --/ --/ Binding the socket to a port is necessary for being --/ able to receive data on that port. --/ You can use the special value 0 to tell the --/ system to automatically pick an available port, and then --/ call sfUdpSocket_getLocalPort to retrieve the chosen port. --/ --/ If there is no specific address to listen to, pass sfIpAddress_Any --/ --/ @param socket UDP socket object --/ @param port Port to bind the socket to --/ @param address Address of the interface to bind to --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function bind (socket : sfUdpSocket_Ptr; port : sfUint16; address : Sf.Network.IpAddress.sfIpAddress) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Unbind a UDP socket from the local port to which it is bound --/ --/ The port that the socket was previously using is immediately --/ available after this function is called. If the --/ socket is not bound to a port, this function has no effect. --/ --/ @param socket UDP socket object --/ --////////////////////////////////////////////////////////// procedure unbind (socket : sfUdpSocket_Ptr); --////////////////////////////////////////////////////////// --/ @brief Send raw data to a remote peer with a UDP socket --/ --/ Make sure that @a size is not greater than --/ sfUdpSocket_maxDatagramSize(), otherwise this function will --/ fail and no data will be sent. --/ --/ @param socket UDP socket object --/ @param data Pointer to the sequence of bytes to send --/ @param size Number of bytes to send --/ @param remoteAddress Address of the receiver --/ @param remotePort Port of the receiver to send the data to --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function send (socket : sfUdpSocket_Ptr; data : Standard.System.Address; size : sfSize_t; remoteAddress : Sf.Network.IpAddress.sfIpAddress; remotePort : sfUint16) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Receive raw data from a remote peer with a UDP socket --/ --/ In blocking mode, this function will wait until some --/ bytes are actually received. --/ Be careful to use a buffer which is large enough for --/ the data that you intend to receive, if it is too small --/ then an error will be returned and *all* the data will --/ be lost. --/ --/ @param socket UDP socket object --/ @param data Pointer to the array to fill with the received bytes --/ @param size Maximum number of bytes that can be received --/ @param received This variable is filled with the actual number of bytes received --/ @param remoteAddress Address of the peer that sent the data --/ @param remotePort Port of the peer that sent the data --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function receive (socket : sfUdpSocket_Ptr; data : Standard.System.Address; size : sfSize_t; received : access sfSize_t; remoteAddress : access Sf.Network.IpAddress.sfIpAddress; remotePort : access sfUint16) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Send a formatted packet of data to a remote peer with a UDP socket --/ --/ Make sure that the packet size is not greater than --/ sfUdpSocket_maxDatagramSize(), otherwise this function will --/ fail and no data will be sent. --/ --/ @param socket UDP socket object --/ @param packet Packet to send --/ @param remoteAddress Address of the receiver --/ @param remotePort Port of the receiver to send the data to --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function sendPacket (socket : sfUdpSocket_Ptr; packet : sfPacket_Ptr; remoteAddress : Sf.Network.IpAddress.sfIpAddress; remotePort : sfUint16) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Receive a formatted packet of data from a remote peer with a UDP socket --/ --/ In blocking mode, this function will wait until the whole packet --/ has been received. --/ --/ @param packet Packet to fill with the received data --/ @param remoteAddress Address of the peer that sent the data --/ @param remotePort Port of the peer that sent the data --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function receivePacket (socket : sfUdpSocket_Ptr; packet : sfPacket_Ptr; remoteAddress : access Sf.Network.IpAddress.sfIpAddress; remotePort : access sfUint16) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Return the maximum number of bytes that can be --/ sent in a single UDP datagram --/ --/ @return The maximum size of a UDP datagram (message) --/ --////////////////////////////////////////////////////////// function maxDatagramSize return sfUint32; private pragma Import (C, create, "sfUdpSocket_create"); pragma Import (C, destroy, "sfUdpSocket_destroy"); pragma Import (C, setBlocking, "sfUdpSocket_setBlocking"); pragma Import (C, isBlocking, "sfUdpSocket_isBlocking"); pragma Import (C, getLocalPort, "sfUdpSocket_getLocalPort"); pragma Import (C, bind, "sfUdpSocket_bind"); pragma Import (C, unbind, "sfUdpSocket_unbind"); pragma Import (C, send, "sfUdpSocket_send"); pragma Import (C, receive, "sfUdpSocket_receive"); pragma Import (C, sendPacket, "sfUdpSocket_sendPacket"); pragma Import (C, receivePacket, "sfUdpSocket_receivePacket"); pragma Import (C, maxDatagramSize, "sfUdpSocket_maxDatagramSize"); end Sf.Network.UdpSocket;
true
--////////////////////////////////////////////////////////// -- SFML - Simple and Fast Multimedia Library -- Copyright (C) 2007-2015 PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- This software is provided 'as-is', without any express or implied warranty. -- In no event will the authors be held liable for any damages arising from the use of this software. -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it freely, -- subject to the following restrictions: -- 1. The origin of this software must not be misrepresented; -- you must not claim that you wrote the original software. -- If you use this software in a product, an acknowledgment -- in the product documentation would be appreciated but is not required. -- 2. Altered source versions must be plainly marked as such, -- and must not be misrepresented as being the original software. -- 3. This notice may not be removed or altered from any source distribution. --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// with Sf.Network.IpAddress; with Sf.Network.SocketStatus; package Sf.Network.UdpSocket is --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////// --/ @brief Create a new UDP socket --/ --/ @return A new sfUdpSocket object --/ --////////////////////////////////////////////////////////// function create return sfUdpSocket_Ptr; --////////////////////////////////////////////////////////// --/ @brief Destroy a UDP socket --/ --/ @param socket UDP socket to destroy --/ --////////////////////////////////////////////////////////// procedure destroy (socket : sfUdpSocket_Ptr); --////////////////////////////////////////////////////////// --/ @brief Set the blocking state of a UDP listener --/ --/ In blocking mode, calls will not return until they have --/ completed their task. For example, a call to --/ sfUDPSocket_receive in blocking mode won't return until --/ new data was actually received. --/ In non-blocking mode, calls will always return immediately, --/ using the return code to signal whether there was data --/ available or not. --/ By default, all sockets are blocking. --/ --/ @param socket UDP socket object --/ @param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking --/ --////////////////////////////////////////////////////////// procedure setBlocking (socket : sfUdpSocket_Ptr; blocking : sfBool); --////////////////////////////////////////////////////////// --/ @brief Tell whether a UDP socket is in blocking or non-blocking mode --/ --/ @param socket UDP socket object --/ --/ @return sfTrue if the socket is blocking, sfFalse otherwise --/ --////////////////////////////////////////////////////////// function isBlocking (socket : sfUdpSocket_Ptr) return sfBool; --////////////////////////////////////////////////////////// --/ @brief Get the port to which a UDP socket is bound locally --/ --/ If the socket is not bound to a port, this function --/ returns 0. --/ --/ @param socket UDP socket object --/ --/ @return Port to which the socket is bound --/ --////////////////////////////////////////////////////////// function getLocalPort (socket : sfUdpSocket_Ptr) return sfUint16; --////////////////////////////////////////////////////////// --/ @brief Bind a UDP socket to a specific port --/ --/ Binding the socket to a port is necessary for being --/ able to receive data on that port. --/ You can use the special value 0 to tell the --/ system to automatically pick an available port, and then --/ call sfUdpSocket_getLocalPort to retrieve the chosen port. --/ --/ If there is no specific address to listen to, pass sfIpAddress_Any --/ --/ @param socket UDP socket object --/ @param port Port to bind the socket to --/ @param address Address of the interface to bind to --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function bind (socket : sfUdpSocket_Ptr; port : sfUint16; address : Sf.Network.IpAddress.sfIpAddress) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Unbind a UDP socket from the local port to which it is bound --/ --/ The port that the socket was previously using is immediately --/ available after this function is called. If the --/ socket is not bound to a port, this function has no effect. --/ --/ @param socket UDP socket object --/ --////////////////////////////////////////////////////////// procedure unbind (socket : sfUdpSocket_Ptr); --////////////////////////////////////////////////////////// --/ @brief Send raw data to a remote peer with a UDP socket --/ --/ Make sure that @a size is not greater than --/ sfUdpSocket_maxDatagramSize(), otherwise this function will --/ fail and no data will be sent. --/ --/ @param socket UDP socket object --/ @param data Pointer to the sequence of bytes to send --/ @param size Number of bytes to send --/ @param remoteAddress Address of the receiver --/ @param remotePort Port of the receiver to send the data to --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function send (socket : sfUdpSocket_Ptr; data : Standard.System.Address; size : sfSize_t; remoteAddress : Sf.Network.IpAddress.sfIpAddress; remotePort : sfUint16) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Receive raw data from a remote peer with a UDP socket --/ --/ In blocking mode, this function will wait until some --/ bytes are actually received. --/ Be careful to use a buffer which is large enough for --/ the data that you intend to receive, if it is too small --/ then an error will be returned and *all* the data will --/ be lost. --/ --/ @param socket UDP socket object --/ @param data Pointer to the array to fill with the received bytes --/ @param size Maximum number of bytes that can be received --/ @param received This variable is filled with the actual number of bytes received --/ @param remoteAddress Address of the peer that sent the data --/ @param remotePort Port of the peer that sent the data --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function receive (socket : sfUdpSocket_Ptr; data : Standard.System.Address; size : sfSize_t; received : access sfSize_t; remoteAddress : access Sf.Network.IpAddress.sfIpAddress; remotePort : access sfUint16) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Send a formatted packet of data to a remote peer with a UDP socket --/ --/ Make sure that the packet size is not greater than --/ sfUdpSocket_maxDatagramSize(), otherwise this function will --/ fail and no data will be sent. --/ --/ @param socket UDP socket object --/ @param packet Packet to send --/ @param remoteAddress Address of the receiver --/ @param remotePort Port of the receiver to send the data to --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function sendPacket (socket : sfUdpSocket_Ptr; packet : sfPacket_Ptr; remoteAddress : Sf.Network.IpAddress.sfIpAddress; remotePort : sfUint16) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Receive a formatted packet of data from a remote peer with a UDP socket --/ --/ In blocking mode, this function will wait until the whole packet --/ has been received. --/ --/ @param packet Packet to fill with the received data --/ @param remoteAddress Address of the peer that sent the data --/ @param remotePort Port of the peer that sent the data --/ --/ @return Status code --/ --////////////////////////////////////////////////////////// function receivePacket (socket : sfUdpSocket_Ptr; packet : sfPacket_Ptr; remoteAddress : access Sf.Network.IpAddress.sfIpAddress; remotePort : access sfUint16) return Sf.Network.SocketStatus.sfSocketStatus; --////////////////////////////////////////////////////////// --/ @brief Return the maximum number of bytes that can be --/ sent in a single UDP datagram --/ --/ @return The maximum size of a UDP datagram (message) --/ --////////////////////////////////////////////////////////// function maxDatagramSize return sfUint32; private pragma Import (C, create, "sfUdpSocket_create"); pragma Import (C, destroy, "sfUdpSocket_destroy"); pragma Import (C, setBlocking, "sfUdpSocket_setBlocking"); pragma Import (C, isBlocking, "sfUdpSocket_isBlocking"); pragma Import (C, getLocalPort, "sfUdpSocket_getLocalPort"); pragma Import (C, bind, "sfUdpSocket_bind"); pragma Import (C, unbind, "sfUdpSocket_unbind"); pragma Import (C, send, "sfUdpSocket_send"); pragma Import (C, receive, "sfUdpSocket_receive"); pragma Import (C, sendPacket, "sfUdpSocket_sendPacket"); pragma Import (C, receivePacket, "sfUdpSocket_receivePacket"); pragma Import (C, maxDatagramSize, "sfUdpSocket_maxDatagramSize"); end Sf.Network.UdpSocket;
[ { "context": " --\n-- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com> --\n-- Al", "end": 824, "score": 0.9998884201049805, "start": 811, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com> --\n-- All rights reserved. ", "end": 844, "score": 0.9999321103096008, "start": 826, "tag": "EMAIL", "value": "vgodunko@gmail.com" } ]
source/amf/mof/amf-elements.ads
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.CMOF.Classes; with AMF.CMOF.Properties; limited with AMF.Extents; with League.Holders; package AMF.Elements is pragma Preelaborate; type Abstract_Element is limited interface; type Element_Access is access all Abstract_Element'Class; ---------------------- -- MOF Operations -- ---------------------- not overriding function Get_Meta_Class (Self : not null access constant Abstract_Element) return AMF.CMOF.Classes.CMOF_Class_Access is abstract; -- Returns the Class that describes this element. not overriding function Container (Self : not null access constant Abstract_Element) return AMF.Elements.Element_Access is abstract; -- Returns the parent container of this element if any. Return null if -- there is no containing element. not overriding function Get (Self : not null access constant Abstract_Element; Property : not null AMF.CMOF.Properties.CMOF_Property_Access) return League.Holders.Holder is abstract; -- Gets the value of the given property. If the Property has multiplicity -- upper bound of 1, get() returns the value of the Property. If Property -- has multiplicity upper bound >1, get() returns a ReflectiveCollection -- containing the values of the Property. If there are no values, the -- ReflectiveCollection returned is empty. -- -- Exception: throws IllegalArgumentException if Property is not a member -- of the Class from class(). not overriding procedure Set (Self : not null access Abstract_Element; Property : not null AMF.CMOF.Properties.CMOF_Property_Access; Value : League.Holders.Holder) is abstract; -- If the Property has multiplicity upper bound = 1, set() atomically -- updates the value of the Property to the object parameter. If Property -- has multiplicity upper bound >1, the Object must be a kind of -- ReflectiveCollection. The behavior is identical to the following -- operations performed atomically: -- -- ReflectiveSequence list = element.get(property); -- list.clear(); -- list.addAll((ReflectiveCollection) object); -- -- There is no return value. Exception: throws IllegalArgumentException if -- Property is not a member of the Class from getMetaClass(). -- -- Exception: throws ClassCastException if the Property’s type -- isInstance(element) returns false and Property has multi-plicity upper -- bound = 1. -- -- Exception: throws ClassCastException if Element is not a -- ReflectiveCollection and Property has multiplicity upper bound > 1. -- -- Exception: throws IllegalArgumentException if element is null, Property -- is of type Class, and the multiplicity upper bound > 1. ---------------------- -- AMF Extensions -- ---------------------- not overriding function Extent (Self : not null access constant Abstract_Element) return AMF.Extents.Extent_Access is abstract; -- Returns extents which contains element. end AMF.Elements;
25523
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, <NAME> <<EMAIL>> -- -- 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.CMOF.Classes; with AMF.CMOF.Properties; limited with AMF.Extents; with League.Holders; package AMF.Elements is pragma Preelaborate; type Abstract_Element is limited interface; type Element_Access is access all Abstract_Element'Class; ---------------------- -- MOF Operations -- ---------------------- not overriding function Get_Meta_Class (Self : not null access constant Abstract_Element) return AMF.CMOF.Classes.CMOF_Class_Access is abstract; -- Returns the Class that describes this element. not overriding function Container (Self : not null access constant Abstract_Element) return AMF.Elements.Element_Access is abstract; -- Returns the parent container of this element if any. Return null if -- there is no containing element. not overriding function Get (Self : not null access constant Abstract_Element; Property : not null AMF.CMOF.Properties.CMOF_Property_Access) return League.Holders.Holder is abstract; -- Gets the value of the given property. If the Property has multiplicity -- upper bound of 1, get() returns the value of the Property. If Property -- has multiplicity upper bound >1, get() returns a ReflectiveCollection -- containing the values of the Property. If there are no values, the -- ReflectiveCollection returned is empty. -- -- Exception: throws IllegalArgumentException if Property is not a member -- of the Class from class(). not overriding procedure Set (Self : not null access Abstract_Element; Property : not null AMF.CMOF.Properties.CMOF_Property_Access; Value : League.Holders.Holder) is abstract; -- If the Property has multiplicity upper bound = 1, set() atomically -- updates the value of the Property to the object parameter. If Property -- has multiplicity upper bound >1, the Object must be a kind of -- ReflectiveCollection. The behavior is identical to the following -- operations performed atomically: -- -- ReflectiveSequence list = element.get(property); -- list.clear(); -- list.addAll((ReflectiveCollection) object); -- -- There is no return value. Exception: throws IllegalArgumentException if -- Property is not a member of the Class from getMetaClass(). -- -- Exception: throws ClassCastException if the Property’s type -- isInstance(element) returns false and Property has multi-plicity upper -- bound = 1. -- -- Exception: throws ClassCastException if Element is not a -- ReflectiveCollection and Property has multiplicity upper bound > 1. -- -- Exception: throws IllegalArgumentException if element is null, Property -- is of type Class, and the multiplicity upper bound > 1. ---------------------- -- AMF Extensions -- ---------------------- not overriding function Extent (Self : not null access constant Abstract_Element) return AMF.Extents.Extent_Access is abstract; -- Returns extents which contains element. end AMF.Elements;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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.CMOF.Classes; with AMF.CMOF.Properties; limited with AMF.Extents; with League.Holders; package AMF.Elements is pragma Preelaborate; type Abstract_Element is limited interface; type Element_Access is access all Abstract_Element'Class; ---------------------- -- MOF Operations -- ---------------------- not overriding function Get_Meta_Class (Self : not null access constant Abstract_Element) return AMF.CMOF.Classes.CMOF_Class_Access is abstract; -- Returns the Class that describes this element. not overriding function Container (Self : not null access constant Abstract_Element) return AMF.Elements.Element_Access is abstract; -- Returns the parent container of this element if any. Return null if -- there is no containing element. not overriding function Get (Self : not null access constant Abstract_Element; Property : not null AMF.CMOF.Properties.CMOF_Property_Access) return League.Holders.Holder is abstract; -- Gets the value of the given property. If the Property has multiplicity -- upper bound of 1, get() returns the value of the Property. If Property -- has multiplicity upper bound >1, get() returns a ReflectiveCollection -- containing the values of the Property. If there are no values, the -- ReflectiveCollection returned is empty. -- -- Exception: throws IllegalArgumentException if Property is not a member -- of the Class from class(). not overriding procedure Set (Self : not null access Abstract_Element; Property : not null AMF.CMOF.Properties.CMOF_Property_Access; Value : League.Holders.Holder) is abstract; -- If the Property has multiplicity upper bound = 1, set() atomically -- updates the value of the Property to the object parameter. If Property -- has multiplicity upper bound >1, the Object must be a kind of -- ReflectiveCollection. The behavior is identical to the following -- operations performed atomically: -- -- ReflectiveSequence list = element.get(property); -- list.clear(); -- list.addAll((ReflectiveCollection) object); -- -- There is no return value. Exception: throws IllegalArgumentException if -- Property is not a member of the Class from getMetaClass(). -- -- Exception: throws ClassCastException if the Property’s type -- isInstance(element) returns false and Property has multi-plicity upper -- bound = 1. -- -- Exception: throws ClassCastException if Element is not a -- ReflectiveCollection and Property has multiplicity upper bound > 1. -- -- Exception: throws IllegalArgumentException if element is null, Property -- is of type Class, and the multiplicity upper bound > 1. ---------------------- -- AMF Extensions -- ---------------------- not overriding function Extent (Self : not null access constant Abstract_Element) return AMF.Extents.Extent_Access is abstract; -- Returns extents which contains element. end AMF.Elements;
[ { "context": ".Datasets -- Datasets\n-- Copyright (C) 2013, 2018 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 160, "score": 0.9998763203620911, "start": 145, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "ight (C) 2013, 2018 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 191, "score": 0.9998822212219238, "start": 176, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "8 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 218, "score": 0.9999254941940308, "start": 193, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
src/base/beans/util-beans-objects-datasets.ads
RREE/ada-util
60
----------------------------------------------------------------------- -- Util.Beans.Objects.Datasets -- Datasets -- Copyright (C) 2013, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Hash; with Ada.Finalization; with Ada.Containers.Indefinite_Hashed_Maps; with Util.Beans.Basic; -- == Datasets == -- The `Datasets` package implements the `Dataset` list bean which -- defines a set of objects organized in rows and columns. The `Dataset` -- implements the `List_Bean` interface and allows to iterate over its rows. -- Each row defines a `Bean` instance and allows to access each column value. -- Each column is associated with a unique name. The row `Bean` allows to -- get or set the column by using the column name. package Util.Beans.Objects.Datasets is Invalid_State : exception; -- An array of objects. type Object_Array is array (Positive range <>) of Object; type Dataset is new Util.Beans.Basic.List_Bean with private; -- Get the number of elements in the list. overriding function Get_Count (From : in Dataset) return Natural; -- Set the current row index. Valid row indexes start at 1. overriding procedure Set_Row_Index (From : in out Dataset; Index : in Natural); -- Get the element at the current row index. overriding function Get_Row (From : in Dataset) return Util.Beans.Objects.Object; -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. overriding function Get_Value (From : in Dataset; Name : in String) return Util.Beans.Objects.Object; -- Append a row in the dataset and call the fill procedure to populate -- the row content. procedure Append (Into : in out Dataset; Fill : not null access procedure (Data : in out Object_Array)); -- Add a column to the dataset. If the position is not specified, -- the column count is incremented and the name associated with the last column. -- Raises Invalid_State exception if the dataset contains some rows, procedure Add_Column (Into : in out Dataset; Name : in String; Pos : in Natural := 0); -- Clear the content of the dataset. procedure Clear (Set : in out Dataset); private type Object_Array_Access is access all Object_Array; type Dataset_Array is array (Positive range <>) of Object_Array_Access; type Dataset_Array_Access is access all Dataset_Array; package Dataset_Map is new Ada.Containers.Indefinite_Hashed_Maps (Key_Type => String, Element_Type => Positive, Hash => Ada.Strings.Hash, Equivalent_Keys => "=", "=" => "="); type Row is new Util.Beans.Basic.Bean with record Data : Object_Array_Access; Map : access Dataset_Map.Map; end record; -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. overriding function Get_Value (From : in Row; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. -- If the name cannot be found, the method should raise the No_Value -- exception. overriding procedure Set_Value (From : in out Row; Name : in String; Value : in Util.Beans.Objects.Object); type Dataset is new Ada.Finalization.Controlled and Util.Beans.Basic.List_Bean with record Data : Dataset_Array_Access; Count : Natural := 0; Columns : Natural := 0; Map : aliased Dataset_Map.Map; Current : aliased Row; Current_Pos : Natural := 0; Row : Util.Beans.Objects.Object; end record; -- Initialize the dataset and the row bean instance. overriding procedure Initialize (Set : in out Dataset); -- Release the dataset storage. overriding procedure Finalize (Set : in out Dataset); end Util.Beans.Objects.Datasets;
27400
----------------------------------------------------------------------- -- Util.Beans.Objects.Datasets -- Datasets -- Copyright (C) 2013, 2018 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Hash; with Ada.Finalization; with Ada.Containers.Indefinite_Hashed_Maps; with Util.Beans.Basic; -- == Datasets == -- The `Datasets` package implements the `Dataset` list bean which -- defines a set of objects organized in rows and columns. The `Dataset` -- implements the `List_Bean` interface and allows to iterate over its rows. -- Each row defines a `Bean` instance and allows to access each column value. -- Each column is associated with a unique name. The row `Bean` allows to -- get or set the column by using the column name. package Util.Beans.Objects.Datasets is Invalid_State : exception; -- An array of objects. type Object_Array is array (Positive range <>) of Object; type Dataset is new Util.Beans.Basic.List_Bean with private; -- Get the number of elements in the list. overriding function Get_Count (From : in Dataset) return Natural; -- Set the current row index. Valid row indexes start at 1. overriding procedure Set_Row_Index (From : in out Dataset; Index : in Natural); -- Get the element at the current row index. overriding function Get_Row (From : in Dataset) return Util.Beans.Objects.Object; -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. overriding function Get_Value (From : in Dataset; Name : in String) return Util.Beans.Objects.Object; -- Append a row in the dataset and call the fill procedure to populate -- the row content. procedure Append (Into : in out Dataset; Fill : not null access procedure (Data : in out Object_Array)); -- Add a column to the dataset. If the position is not specified, -- the column count is incremented and the name associated with the last column. -- Raises Invalid_State exception if the dataset contains some rows, procedure Add_Column (Into : in out Dataset; Name : in String; Pos : in Natural := 0); -- Clear the content of the dataset. procedure Clear (Set : in out Dataset); private type Object_Array_Access is access all Object_Array; type Dataset_Array is array (Positive range <>) of Object_Array_Access; type Dataset_Array_Access is access all Dataset_Array; package Dataset_Map is new Ada.Containers.Indefinite_Hashed_Maps (Key_Type => String, Element_Type => Positive, Hash => Ada.Strings.Hash, Equivalent_Keys => "=", "=" => "="); type Row is new Util.Beans.Basic.Bean with record Data : Object_Array_Access; Map : access Dataset_Map.Map; end record; -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. overriding function Get_Value (From : in Row; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. -- If the name cannot be found, the method should raise the No_Value -- exception. overriding procedure Set_Value (From : in out Row; Name : in String; Value : in Util.Beans.Objects.Object); type Dataset is new Ada.Finalization.Controlled and Util.Beans.Basic.List_Bean with record Data : Dataset_Array_Access; Count : Natural := 0; Columns : Natural := 0; Map : aliased Dataset_Map.Map; Current : aliased Row; Current_Pos : Natural := 0; Row : Util.Beans.Objects.Object; end record; -- Initialize the dataset and the row bean instance. overriding procedure Initialize (Set : in out Dataset); -- Release the dataset storage. overriding procedure Finalize (Set : in out Dataset); end Util.Beans.Objects.Datasets;
true
----------------------------------------------------------------------- -- Util.Beans.Objects.Datasets -- Datasets -- Copyright (C) 2013, 2018 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Hash; with Ada.Finalization; with Ada.Containers.Indefinite_Hashed_Maps; with Util.Beans.Basic; -- == Datasets == -- The `Datasets` package implements the `Dataset` list bean which -- defines a set of objects organized in rows and columns. The `Dataset` -- implements the `List_Bean` interface and allows to iterate over its rows. -- Each row defines a `Bean` instance and allows to access each column value. -- Each column is associated with a unique name. The row `Bean` allows to -- get or set the column by using the column name. package Util.Beans.Objects.Datasets is Invalid_State : exception; -- An array of objects. type Object_Array is array (Positive range <>) of Object; type Dataset is new Util.Beans.Basic.List_Bean with private; -- Get the number of elements in the list. overriding function Get_Count (From : in Dataset) return Natural; -- Set the current row index. Valid row indexes start at 1. overriding procedure Set_Row_Index (From : in out Dataset; Index : in Natural); -- Get the element at the current row index. overriding function Get_Row (From : in Dataset) return Util.Beans.Objects.Object; -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. overriding function Get_Value (From : in Dataset; Name : in String) return Util.Beans.Objects.Object; -- Append a row in the dataset and call the fill procedure to populate -- the row content. procedure Append (Into : in out Dataset; Fill : not null access procedure (Data : in out Object_Array)); -- Add a column to the dataset. If the position is not specified, -- the column count is incremented and the name associated with the last column. -- Raises Invalid_State exception if the dataset contains some rows, procedure Add_Column (Into : in out Dataset; Name : in String; Pos : in Natural := 0); -- Clear the content of the dataset. procedure Clear (Set : in out Dataset); private type Object_Array_Access is access all Object_Array; type Dataset_Array is array (Positive range <>) of Object_Array_Access; type Dataset_Array_Access is access all Dataset_Array; package Dataset_Map is new Ada.Containers.Indefinite_Hashed_Maps (Key_Type => String, Element_Type => Positive, Hash => Ada.Strings.Hash, Equivalent_Keys => "=", "=" => "="); type Row is new Util.Beans.Basic.Bean with record Data : Object_Array_Access; Map : access Dataset_Map.Map; end record; -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. overriding function Get_Value (From : in Row; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. -- If the name cannot be found, the method should raise the No_Value -- exception. overriding procedure Set_Value (From : in out Row; Name : in String; Value : in Util.Beans.Objects.Object); type Dataset is new Ada.Finalization.Controlled and Util.Beans.Basic.List_Bean with record Data : Dataset_Array_Access; Count : Natural := 0; Columns : Natural := 0; Map : aliased Dataset_Map.Map; Current : aliased Row; Current_Pos : Natural := 0; Row : Util.Beans.Objects.Object; end record; -- Initialize the dataset and the row bean instance. overriding procedure Initialize (Set : in out Dataset); -- Release the dataset storage. overriding procedure Finalize (Set : in out Dataset); end Util.Beans.Objects.Datasets;
[ { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --\n-- All rig", "end": 829, "score": 0.999886691570282, "start": 816, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> --\n-- All rights reserved. ", "end": 849, "score": 0.9999321699142456, "start": 831, "tag": "EMAIL", "value": "vgodunko@gmail.com" } ]
source/sql/sql-databases.ads
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ pragma Ada_2012; private with Ada.Finalization; with League.Strings; private with Matreshka.Internals.SQL_Drivers.Dummy; with SQL.Options; with SQL.Queries; package SQL.Databases is type SQL_Database is tagged limited private; function Create (Driver : League.Strings.Universal_String; Options : SQL.Options.SQL_Options) return SQL_Database; procedure Open (Self : in out SQL_Database'Class); function Open (Self : in out SQL_Database'Class) return Boolean; procedure Close (Self : in out SQL_Database'Class); -- Closes the database connection, freeing any resources acquired, and -- invalidating any existing QSqlQuery objects that are used with the -- database. procedure Commit (Self : in out SQL_Database'Class); procedure Rollback (Self : in out SQL_Database'Class); procedure Transaction (Self : in out SQL_Database'Class); function Error_Message (Self : SQL_Database'Class) return League.Strings.Universal_String; function Query (Self : in out SQL_Database'Class) return SQL.Queries.SQL_Query; -- Creates SQL_Query object to execute statements in the specified -- database. function Query (Self : in out SQL_Database'Class; Query : League.Strings.Universal_String) return SQL.Queries.SQL_Query; -- Creates SQL_Query object to execute statements in the specified -- database and prepare specified statement for execution. private type SQL_Database is new Ada.Finalization.Limited_Controlled with record Data : Matreshka.Internals.SQL_Drivers.Database_Access := Matreshka.Internals.SQL_Drivers.Dummy.Empty_Database'Access; Options : SQL.Options.SQL_Options; end record; -- overriding procedure Adjust (Self : in out SQL_Database); -- Increments reference counter of shared object. overriding procedure Finalize (Self : in out SQL_Database); -- Decrements reference counter of shared object. end SQL.Databases;
13347
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ pragma Ada_2012; private with Ada.Finalization; with League.Strings; private with Matreshka.Internals.SQL_Drivers.Dummy; with SQL.Options; with SQL.Queries; package SQL.Databases is type SQL_Database is tagged limited private; function Create (Driver : League.Strings.Universal_String; Options : SQL.Options.SQL_Options) return SQL_Database; procedure Open (Self : in out SQL_Database'Class); function Open (Self : in out SQL_Database'Class) return Boolean; procedure Close (Self : in out SQL_Database'Class); -- Closes the database connection, freeing any resources acquired, and -- invalidating any existing QSqlQuery objects that are used with the -- database. procedure Commit (Self : in out SQL_Database'Class); procedure Rollback (Self : in out SQL_Database'Class); procedure Transaction (Self : in out SQL_Database'Class); function Error_Message (Self : SQL_Database'Class) return League.Strings.Universal_String; function Query (Self : in out SQL_Database'Class) return SQL.Queries.SQL_Query; -- Creates SQL_Query object to execute statements in the specified -- database. function Query (Self : in out SQL_Database'Class; Query : League.Strings.Universal_String) return SQL.Queries.SQL_Query; -- Creates SQL_Query object to execute statements in the specified -- database and prepare specified statement for execution. private type SQL_Database is new Ada.Finalization.Limited_Controlled with record Data : Matreshka.Internals.SQL_Drivers.Database_Access := Matreshka.Internals.SQL_Drivers.Dummy.Empty_Database'Access; Options : SQL.Options.SQL_Options; end record; -- overriding procedure Adjust (Self : in out SQL_Database); -- Increments reference counter of shared object. overriding procedure Finalize (Self : in out SQL_Database); -- Decrements reference counter of shared object. end SQL.Databases;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ pragma Ada_2012; private with Ada.Finalization; with League.Strings; private with Matreshka.Internals.SQL_Drivers.Dummy; with SQL.Options; with SQL.Queries; package SQL.Databases is type SQL_Database is tagged limited private; function Create (Driver : League.Strings.Universal_String; Options : SQL.Options.SQL_Options) return SQL_Database; procedure Open (Self : in out SQL_Database'Class); function Open (Self : in out SQL_Database'Class) return Boolean; procedure Close (Self : in out SQL_Database'Class); -- Closes the database connection, freeing any resources acquired, and -- invalidating any existing QSqlQuery objects that are used with the -- database. procedure Commit (Self : in out SQL_Database'Class); procedure Rollback (Self : in out SQL_Database'Class); procedure Transaction (Self : in out SQL_Database'Class); function Error_Message (Self : SQL_Database'Class) return League.Strings.Universal_String; function Query (Self : in out SQL_Database'Class) return SQL.Queries.SQL_Query; -- Creates SQL_Query object to execute statements in the specified -- database. function Query (Self : in out SQL_Database'Class; Query : League.Strings.Universal_String) return SQL.Queries.SQL_Query; -- Creates SQL_Query object to execute statements in the specified -- database and prepare specified statement for execution. private type SQL_Database is new Ada.Finalization.Limited_Controlled with record Data : Matreshka.Internals.SQL_Drivers.Database_Access := Matreshka.Internals.SQL_Drivers.Dummy.Empty_Database'Access; Options : SQL.Options.SQL_Options; end record; -- overriding procedure Adjust (Self : in out SQL_Database); -- Increments reference counter of shared object. overriding procedure Finalize (Self : in out SQL_Database); -- Decrements reference counter of shared object. end SQL.Databases;
[ { "context": "bj);\n -- GStreamer\n -- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>\n -- * 200", "end": 2108, "score": 0.9998776912689209, "start": 2093, "tag": "NAME", "value": "Erik Walthinsen" }, { "context": "r\n -- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>\n -- * 2000 Wim Taymans <wim.", "end": 2127, "score": 0.9999338984489441, "start": 2110, "tag": "EMAIL", "value": "omega@cse.ogi.edu" }, { "context": "<omega@cse.ogi.edu>\n -- * 2000 Wim Taymans <wim.taymans@chello.be>\n -- * ", "end": 2171, "score": 0.9998736381530762, "start": 2160, "tag": "NAME", "value": "Wim Taymans" }, { "context": ".edu>\n -- * 2000 Wim Taymans <wim.taymans@chello.be>\n -- * 2005 Andy Wingo <wingo", "end": 2194, "score": 0.9999349117279053, "start": 2173, "tag": "EMAIL", "value": "wim.taymans@chello.be" }, { "context": ".taymans@chello.be>\n -- * 2005 Andy Wingo <wingo@pobox.com>\n -- *\n -- * gstghostpad.h: Pr", "end": 2237, "score": 0.9998790621757507, "start": 2227, "tag": "NAME", "value": "Andy Wingo" }, { "context": "lo.be>\n -- * 2005 Andy Wingo <wingo@pobox.com>\n -- *\n -- * gstghostpad.h: Proxy pads\n -- *\n ", "end": 2254, "score": 0.9999333024024963, "start": 2239, "tag": "EMAIL", "value": "wingo@pobox.com" } ]
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_gstghostpad_h.ads
persan/A-gst
1
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.gstreamer_0_10_gst_gstpad_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h; with System; with glib; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h; with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstghostpad_h is -- unsupported macro: GST_TYPE_PROXY_PAD (gst_proxy_pad_get_type ()) -- arg-macro: function GST_IS_PROXY_PAD (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PROXY_PAD); -- arg-macro: function GST_IS_PROXY_PAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PROXY_PAD); -- arg-macro: function GST_PROXY_PAD (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PROXY_PAD, GstProxyPad); -- arg-macro: function GST_PROXY_PAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PROXY_PAD, GstProxyPadClass); -- unsupported macro: GST_TYPE_GHOST_PAD (gst_ghost_pad_get_type ()) -- arg-macro: function GST_IS_GHOST_PAD (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GHOST_PAD); -- arg-macro: function GST_IS_GHOST_PAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GHOST_PAD); -- arg-macro: function GST_GHOST_PAD (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GHOST_PAD, GstGhostPad); -- arg-macro: function GST_GHOST_PAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GHOST_PAD, GstGhostPadClass); -- arg-macro: function GST_GHOST_PAD_CAST (obj) -- return (GstGhostPad*)(obj); -- GStreamer -- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> -- * 2000 Wim Taymans <wim.taymans@chello.be> -- * 2005 Andy Wingo <wingo@pobox.com> -- * -- * gstghostpad.h: Proxy pads -- * -- * 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. -- type GstProxyPad; --subtype GstProxyPad is u_GstProxyPad; -- gst/gstghostpad.h:40 -- skipped empty struct u_GstProxyPadPrivate -- skipped empty struct GstProxyPadPrivate type GstProxyPadClass; type u_GstProxyPadClass_u_gst_reserved_array is array (0 .. 0) of System.Address; --subtype GstProxyPadClass is u_GstProxyPadClass; -- gst/gstghostpad.h:42 type GstProxyPad is record pad : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:46 priv : System.Address; -- gst/gstghostpad.h:49 end record; pragma Convention (C_Pass_By_Copy, GstProxyPad); -- gst/gstghostpad.h:44 --< private > type GstProxyPadClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadClass; -- gst/gstghostpad.h:54 u_gst_reserved : u_GstProxyPadClass_u_gst_reserved_array; -- gst/gstghostpad.h:57 end record; pragma Convention (C_Pass_By_Copy, GstProxyPadClass); -- gst/gstghostpad.h:52 --< private > function gst_proxy_pad_get_type return GLIB.GType; -- gst/gstghostpad.h:60 pragma Import (C, gst_proxy_pad_get_type, "gst_proxy_pad_get_type"); function gst_proxy_pad_get_internal (pad : access GstProxyPad) return access GstProxyPad; -- gst/gstghostpad.h:62 pragma Import (C, gst_proxy_pad_get_internal, "gst_proxy_pad_get_internal"); function gst_proxy_pad_query_type_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQueryType; -- gst/gstghostpad.h:65 pragma Import (C, gst_proxy_pad_query_type_default, "gst_proxy_pad_query_type_default"); function gst_proxy_pad_event_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/gstghostpad.h:66 pragma Import (C, gst_proxy_pad_event_default, "gst_proxy_pad_event_default"); function gst_proxy_pad_query_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery) return GLIB.gboolean; -- gst/gstghostpad.h:67 pragma Import (C, gst_proxy_pad_query_default, "gst_proxy_pad_query_default"); function gst_proxy_pad_iterate_internal_links_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h.GstIterator; -- gst/gstghostpad.h:68 pragma Import (C, gst_proxy_pad_iterate_internal_links_default, "gst_proxy_pad_iterate_internal_links_default"); function gst_proxy_pad_bufferalloc_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; offset : GLIB.guint64; size : GLIB.guint; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; buf : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/gstghostpad.h:69 pragma Import (C, gst_proxy_pad_bufferalloc_default, "gst_proxy_pad_bufferalloc_default"); function gst_proxy_pad_chain_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; buffer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/gstghostpad.h:70 pragma Import (C, gst_proxy_pad_chain_default, "gst_proxy_pad_chain_default"); function gst_proxy_pad_chain_list_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; list : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/gstghostpad.h:71 pragma Import (C, gst_proxy_pad_chain_list_default, "gst_proxy_pad_chain_list_default"); function gst_proxy_pad_getrange_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; offset : GLIB.guint64; size : GLIB.guint; buffer : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/gstghostpad.h:72 pragma Import (C, gst_proxy_pad_getrange_default, "gst_proxy_pad_getrange_default"); function gst_proxy_pad_checkgetrange_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return GLIB.gboolean; -- gst/gstghostpad.h:73 pragma Import (C, gst_proxy_pad_checkgetrange_default, "gst_proxy_pad_checkgetrange_default"); function gst_proxy_pad_getcaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/gstghostpad.h:74 pragma Import (C, gst_proxy_pad_getcaps_default, "gst_proxy_pad_getcaps_default"); function gst_proxy_pad_acceptcaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/gstghostpad.h:75 pragma Import (C, gst_proxy_pad_acceptcaps_default, "gst_proxy_pad_acceptcaps_default"); procedure gst_proxy_pad_fixatecaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps); -- gst/gstghostpad.h:76 pragma Import (C, gst_proxy_pad_fixatecaps_default, "gst_proxy_pad_fixatecaps_default"); function gst_proxy_pad_setcaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/gstghostpad.h:77 pragma Import (C, gst_proxy_pad_setcaps_default, "gst_proxy_pad_setcaps_default"); procedure gst_proxy_pad_unlink_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad); -- gst/gstghostpad.h:78 pragma Import (C, gst_proxy_pad_unlink_default, "gst_proxy_pad_unlink_default"); --* -- * GstGhostPad: -- * -- * Opaque #GstGhostPad structure. -- type GstGhostPad; --subtype GstGhostPad is u_GstGhostPad; -- gst/gstghostpad.h:92 -- skipped empty struct u_GstGhostPadPrivate -- skipped empty struct GstGhostPadPrivate type GstGhostPadClass; type u_GstGhostPadClass_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstGhostPadClass is u_GstGhostPadClass; -- gst/gstghostpad.h:94 type GstGhostPad is record pad : aliased GstProxyPad; -- gst/gstghostpad.h:98 priv : System.Address; -- gst/gstghostpad.h:101 end record; pragma Convention (C_Pass_By_Copy, GstGhostPad); -- gst/gstghostpad.h:96 --< private > type GstGhostPadClass is record parent_class : aliased GstProxyPadClass; -- gst/gstghostpad.h:106 u_gst_reserved : u_GstGhostPadClass_u_gst_reserved_array; -- gst/gstghostpad.h:109 end record; pragma Convention (C_Pass_By_Copy, GstGhostPadClass); -- gst/gstghostpad.h:104 --< private > function gst_ghost_pad_get_type return GLIB.GType; -- gst/gstghostpad.h:113 pragma Import (C, gst_ghost_pad_get_type, "gst_ghost_pad_get_type"); function gst_ghost_pad_new (name : access GLIB.gchar; target : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:115 pragma Import (C, gst_ghost_pad_new, "gst_ghost_pad_new"); function gst_ghost_pad_new_no_target (name : access GLIB.gchar; dir : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:116 pragma Import (C, gst_ghost_pad_new_no_target, "gst_ghost_pad_new_no_target"); function gst_ghost_pad_new_from_template (name : access GLIB.gchar; target : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; templ : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h.GstPadTemplate) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:118 pragma Import (C, gst_ghost_pad_new_from_template, "gst_ghost_pad_new_from_template"); function gst_ghost_pad_new_no_target_from_template (name : access GLIB.gchar; templ : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h.GstPadTemplate) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:119 pragma Import (C, gst_ghost_pad_new_no_target_from_template, "gst_ghost_pad_new_no_target_from_template"); function gst_ghost_pad_get_target (gpad : access GstGhostPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:121 pragma Import (C, gst_ghost_pad_get_target, "gst_ghost_pad_get_target"); function gst_ghost_pad_set_target (gpad : access GstGhostPad; newtarget : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return GLIB.gboolean; -- gst/gstghostpad.h:122 pragma Import (C, gst_ghost_pad_set_target, "gst_ghost_pad_set_target"); function gst_ghost_pad_construct (gpad : access GstGhostPad) return GLIB.gboolean; -- gst/gstghostpad.h:124 pragma Import (C, gst_ghost_pad_construct, "gst_ghost_pad_construct"); function gst_ghost_pad_setcaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/gstghostpad.h:126 pragma Import (C, gst_ghost_pad_setcaps_default, "gst_ghost_pad_setcaps_default"); procedure gst_ghost_pad_unlink_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad); -- gst/gstghostpad.h:127 pragma Import (C, gst_ghost_pad_unlink_default, "gst_ghost_pad_unlink_default"); function gst_ghost_pad_link_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; peer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadLinkReturn; -- gst/gstghostpad.h:128 pragma Import (C, gst_ghost_pad_link_default, "gst_ghost_pad_link_default"); function gst_ghost_pad_activate_pull_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; active : GLIB.gboolean) return GLIB.gboolean; -- gst/gstghostpad.h:129 pragma Import (C, gst_ghost_pad_activate_pull_default, "gst_ghost_pad_activate_pull_default"); function gst_ghost_pad_activate_push_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; active : GLIB.gboolean) return GLIB.gboolean; -- gst/gstghostpad.h:130 pragma Import (C, gst_ghost_pad_activate_push_default, "gst_ghost_pad_activate_push_default"); function gst_ghost_pad_internal_activate_push_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; active : GLIB.gboolean) return GLIB.gboolean; -- gst/gstghostpad.h:132 pragma Import (C, gst_ghost_pad_internal_activate_push_default, "gst_ghost_pad_internal_activate_push_default"); function gst_ghost_pad_internal_activate_pull_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; active : GLIB.gboolean) return GLIB.gboolean; -- gst/gstghostpad.h:133 pragma Import (C, gst_ghost_pad_internal_activate_pull_default, "gst_ghost_pad_internal_activate_pull_default"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstghostpad_h;
20635
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.gstreamer_0_10_gst_gstpad_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h; with System; with glib; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h; with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstghostpad_h is -- unsupported macro: GST_TYPE_PROXY_PAD (gst_proxy_pad_get_type ()) -- arg-macro: function GST_IS_PROXY_PAD (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PROXY_PAD); -- arg-macro: function GST_IS_PROXY_PAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PROXY_PAD); -- arg-macro: function GST_PROXY_PAD (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PROXY_PAD, GstProxyPad); -- arg-macro: function GST_PROXY_PAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PROXY_PAD, GstProxyPadClass); -- unsupported macro: GST_TYPE_GHOST_PAD (gst_ghost_pad_get_type ()) -- arg-macro: function GST_IS_GHOST_PAD (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GHOST_PAD); -- arg-macro: function GST_IS_GHOST_PAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GHOST_PAD); -- arg-macro: function GST_GHOST_PAD (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GHOST_PAD, GstGhostPad); -- arg-macro: function GST_GHOST_PAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GHOST_PAD, GstGhostPadClass); -- arg-macro: function GST_GHOST_PAD_CAST (obj) -- return (GstGhostPad*)(obj); -- GStreamer -- * Copyright (C) 1999,2000 <NAME> <<EMAIL>> -- * 2000 <NAME> <<EMAIL>> -- * 2005 <NAME> <<EMAIL>> -- * -- * gstghostpad.h: Proxy pads -- * -- * 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. -- type GstProxyPad; --subtype GstProxyPad is u_GstProxyPad; -- gst/gstghostpad.h:40 -- skipped empty struct u_GstProxyPadPrivate -- skipped empty struct GstProxyPadPrivate type GstProxyPadClass; type u_GstProxyPadClass_u_gst_reserved_array is array (0 .. 0) of System.Address; --subtype GstProxyPadClass is u_GstProxyPadClass; -- gst/gstghostpad.h:42 type GstProxyPad is record pad : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:46 priv : System.Address; -- gst/gstghostpad.h:49 end record; pragma Convention (C_Pass_By_Copy, GstProxyPad); -- gst/gstghostpad.h:44 --< private > type GstProxyPadClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadClass; -- gst/gstghostpad.h:54 u_gst_reserved : u_GstProxyPadClass_u_gst_reserved_array; -- gst/gstghostpad.h:57 end record; pragma Convention (C_Pass_By_Copy, GstProxyPadClass); -- gst/gstghostpad.h:52 --< private > function gst_proxy_pad_get_type return GLIB.GType; -- gst/gstghostpad.h:60 pragma Import (C, gst_proxy_pad_get_type, "gst_proxy_pad_get_type"); function gst_proxy_pad_get_internal (pad : access GstProxyPad) return access GstProxyPad; -- gst/gstghostpad.h:62 pragma Import (C, gst_proxy_pad_get_internal, "gst_proxy_pad_get_internal"); function gst_proxy_pad_query_type_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQueryType; -- gst/gstghostpad.h:65 pragma Import (C, gst_proxy_pad_query_type_default, "gst_proxy_pad_query_type_default"); function gst_proxy_pad_event_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/gstghostpad.h:66 pragma Import (C, gst_proxy_pad_event_default, "gst_proxy_pad_event_default"); function gst_proxy_pad_query_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery) return GLIB.gboolean; -- gst/gstghostpad.h:67 pragma Import (C, gst_proxy_pad_query_default, "gst_proxy_pad_query_default"); function gst_proxy_pad_iterate_internal_links_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h.GstIterator; -- gst/gstghostpad.h:68 pragma Import (C, gst_proxy_pad_iterate_internal_links_default, "gst_proxy_pad_iterate_internal_links_default"); function gst_proxy_pad_bufferalloc_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; offset : GLIB.guint64; size : GLIB.guint; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; buf : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/gstghostpad.h:69 pragma Import (C, gst_proxy_pad_bufferalloc_default, "gst_proxy_pad_bufferalloc_default"); function gst_proxy_pad_chain_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; buffer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/gstghostpad.h:70 pragma Import (C, gst_proxy_pad_chain_default, "gst_proxy_pad_chain_default"); function gst_proxy_pad_chain_list_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; list : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/gstghostpad.h:71 pragma Import (C, gst_proxy_pad_chain_list_default, "gst_proxy_pad_chain_list_default"); function gst_proxy_pad_getrange_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; offset : GLIB.guint64; size : GLIB.guint; buffer : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/gstghostpad.h:72 pragma Import (C, gst_proxy_pad_getrange_default, "gst_proxy_pad_getrange_default"); function gst_proxy_pad_checkgetrange_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return GLIB.gboolean; -- gst/gstghostpad.h:73 pragma Import (C, gst_proxy_pad_checkgetrange_default, "gst_proxy_pad_checkgetrange_default"); function gst_proxy_pad_getcaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/gstghostpad.h:74 pragma Import (C, gst_proxy_pad_getcaps_default, "gst_proxy_pad_getcaps_default"); function gst_proxy_pad_acceptcaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/gstghostpad.h:75 pragma Import (C, gst_proxy_pad_acceptcaps_default, "gst_proxy_pad_acceptcaps_default"); procedure gst_proxy_pad_fixatecaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps); -- gst/gstghostpad.h:76 pragma Import (C, gst_proxy_pad_fixatecaps_default, "gst_proxy_pad_fixatecaps_default"); function gst_proxy_pad_setcaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/gstghostpad.h:77 pragma Import (C, gst_proxy_pad_setcaps_default, "gst_proxy_pad_setcaps_default"); procedure gst_proxy_pad_unlink_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad); -- gst/gstghostpad.h:78 pragma Import (C, gst_proxy_pad_unlink_default, "gst_proxy_pad_unlink_default"); --* -- * GstGhostPad: -- * -- * Opaque #GstGhostPad structure. -- type GstGhostPad; --subtype GstGhostPad is u_GstGhostPad; -- gst/gstghostpad.h:92 -- skipped empty struct u_GstGhostPadPrivate -- skipped empty struct GstGhostPadPrivate type GstGhostPadClass; type u_GstGhostPadClass_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstGhostPadClass is u_GstGhostPadClass; -- gst/gstghostpad.h:94 type GstGhostPad is record pad : aliased GstProxyPad; -- gst/gstghostpad.h:98 priv : System.Address; -- gst/gstghostpad.h:101 end record; pragma Convention (C_Pass_By_Copy, GstGhostPad); -- gst/gstghostpad.h:96 --< private > type GstGhostPadClass is record parent_class : aliased GstProxyPadClass; -- gst/gstghostpad.h:106 u_gst_reserved : u_GstGhostPadClass_u_gst_reserved_array; -- gst/gstghostpad.h:109 end record; pragma Convention (C_Pass_By_Copy, GstGhostPadClass); -- gst/gstghostpad.h:104 --< private > function gst_ghost_pad_get_type return GLIB.GType; -- gst/gstghostpad.h:113 pragma Import (C, gst_ghost_pad_get_type, "gst_ghost_pad_get_type"); function gst_ghost_pad_new (name : access GLIB.gchar; target : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:115 pragma Import (C, gst_ghost_pad_new, "gst_ghost_pad_new"); function gst_ghost_pad_new_no_target (name : access GLIB.gchar; dir : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:116 pragma Import (C, gst_ghost_pad_new_no_target, "gst_ghost_pad_new_no_target"); function gst_ghost_pad_new_from_template (name : access GLIB.gchar; target : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; templ : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h.GstPadTemplate) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:118 pragma Import (C, gst_ghost_pad_new_from_template, "gst_ghost_pad_new_from_template"); function gst_ghost_pad_new_no_target_from_template (name : access GLIB.gchar; templ : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h.GstPadTemplate) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:119 pragma Import (C, gst_ghost_pad_new_no_target_from_template, "gst_ghost_pad_new_no_target_from_template"); function gst_ghost_pad_get_target (gpad : access GstGhostPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:121 pragma Import (C, gst_ghost_pad_get_target, "gst_ghost_pad_get_target"); function gst_ghost_pad_set_target (gpad : access GstGhostPad; newtarget : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return GLIB.gboolean; -- gst/gstghostpad.h:122 pragma Import (C, gst_ghost_pad_set_target, "gst_ghost_pad_set_target"); function gst_ghost_pad_construct (gpad : access GstGhostPad) return GLIB.gboolean; -- gst/gstghostpad.h:124 pragma Import (C, gst_ghost_pad_construct, "gst_ghost_pad_construct"); function gst_ghost_pad_setcaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/gstghostpad.h:126 pragma Import (C, gst_ghost_pad_setcaps_default, "gst_ghost_pad_setcaps_default"); procedure gst_ghost_pad_unlink_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad); -- gst/gstghostpad.h:127 pragma Import (C, gst_ghost_pad_unlink_default, "gst_ghost_pad_unlink_default"); function gst_ghost_pad_link_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; peer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadLinkReturn; -- gst/gstghostpad.h:128 pragma Import (C, gst_ghost_pad_link_default, "gst_ghost_pad_link_default"); function gst_ghost_pad_activate_pull_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; active : GLIB.gboolean) return GLIB.gboolean; -- gst/gstghostpad.h:129 pragma Import (C, gst_ghost_pad_activate_pull_default, "gst_ghost_pad_activate_pull_default"); function gst_ghost_pad_activate_push_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; active : GLIB.gboolean) return GLIB.gboolean; -- gst/gstghostpad.h:130 pragma Import (C, gst_ghost_pad_activate_push_default, "gst_ghost_pad_activate_push_default"); function gst_ghost_pad_internal_activate_push_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; active : GLIB.gboolean) return GLIB.gboolean; -- gst/gstghostpad.h:132 pragma Import (C, gst_ghost_pad_internal_activate_push_default, "gst_ghost_pad_internal_activate_push_default"); function gst_ghost_pad_internal_activate_pull_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; active : GLIB.gboolean) return GLIB.gboolean; -- gst/gstghostpad.h:133 pragma Import (C, gst_ghost_pad_internal_activate_pull_default, "gst_ghost_pad_internal_activate_pull_default"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstghostpad_h;
true
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.gstreamer_0_10_gst_gstpad_h; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h; with System; with glib; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h; with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstghostpad_h is -- unsupported macro: GST_TYPE_PROXY_PAD (gst_proxy_pad_get_type ()) -- arg-macro: function GST_IS_PROXY_PAD (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PROXY_PAD); -- arg-macro: function GST_IS_PROXY_PAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PROXY_PAD); -- arg-macro: function GST_PROXY_PAD (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PROXY_PAD, GstProxyPad); -- arg-macro: function GST_PROXY_PAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PROXY_PAD, GstProxyPadClass); -- unsupported macro: GST_TYPE_GHOST_PAD (gst_ghost_pad_get_type ()) -- arg-macro: function GST_IS_GHOST_PAD (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GHOST_PAD); -- arg-macro: function GST_IS_GHOST_PAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GHOST_PAD); -- arg-macro: function GST_GHOST_PAD (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GHOST_PAD, GstGhostPad); -- arg-macro: function GST_GHOST_PAD_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GHOST_PAD, GstGhostPadClass); -- arg-macro: function GST_GHOST_PAD_CAST (obj) -- return (GstGhostPad*)(obj); -- GStreamer -- * Copyright (C) 1999,2000 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- * 2000 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- * 2005 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- * -- * gstghostpad.h: Proxy pads -- * -- * 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. -- type GstProxyPad; --subtype GstProxyPad is u_GstProxyPad; -- gst/gstghostpad.h:40 -- skipped empty struct u_GstProxyPadPrivate -- skipped empty struct GstProxyPadPrivate type GstProxyPadClass; type u_GstProxyPadClass_u_gst_reserved_array is array (0 .. 0) of System.Address; --subtype GstProxyPadClass is u_GstProxyPadClass; -- gst/gstghostpad.h:42 type GstProxyPad is record pad : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:46 priv : System.Address; -- gst/gstghostpad.h:49 end record; pragma Convention (C_Pass_By_Copy, GstProxyPad); -- gst/gstghostpad.h:44 --< private > type GstProxyPadClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadClass; -- gst/gstghostpad.h:54 u_gst_reserved : u_GstProxyPadClass_u_gst_reserved_array; -- gst/gstghostpad.h:57 end record; pragma Convention (C_Pass_By_Copy, GstProxyPadClass); -- gst/gstghostpad.h:52 --< private > function gst_proxy_pad_get_type return GLIB.GType; -- gst/gstghostpad.h:60 pragma Import (C, gst_proxy_pad_get_type, "gst_proxy_pad_get_type"); function gst_proxy_pad_get_internal (pad : access GstProxyPad) return access GstProxyPad; -- gst/gstghostpad.h:62 pragma Import (C, gst_proxy_pad_get_internal, "gst_proxy_pad_get_internal"); function gst_proxy_pad_query_type_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQueryType; -- gst/gstghostpad.h:65 pragma Import (C, gst_proxy_pad_query_type_default, "gst_proxy_pad_query_type_default"); function gst_proxy_pad_event_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; event : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstevent_h.GstEvent) return GLIB.gboolean; -- gst/gstghostpad.h:66 pragma Import (C, gst_proxy_pad_event_default, "gst_proxy_pad_event_default"); function gst_proxy_pad_query_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; query : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstQuery) return GLIB.gboolean; -- gst/gstghostpad.h:67 pragma Import (C, gst_proxy_pad_query_default, "gst_proxy_pad_query_default"); function gst_proxy_pad_iterate_internal_links_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstiterator_h.GstIterator; -- gst/gstghostpad.h:68 pragma Import (C, gst_proxy_pad_iterate_internal_links_default, "gst_proxy_pad_iterate_internal_links_default"); function gst_proxy_pad_bufferalloc_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; offset : GLIB.guint64; size : GLIB.guint; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; buf : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/gstghostpad.h:69 pragma Import (C, gst_proxy_pad_bufferalloc_default, "gst_proxy_pad_bufferalloc_default"); function gst_proxy_pad_chain_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; buffer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/gstghostpad.h:70 pragma Import (C, gst_proxy_pad_chain_default, "gst_proxy_pad_chain_default"); function gst_proxy_pad_chain_list_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; list : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/gstghostpad.h:71 pragma Import (C, gst_proxy_pad_chain_list_default, "gst_proxy_pad_chain_list_default"); function gst_proxy_pad_getrange_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; offset : GLIB.guint64; size : GLIB.guint; buffer : System.Address) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstFlowReturn; -- gst/gstghostpad.h:72 pragma Import (C, gst_proxy_pad_getrange_default, "gst_proxy_pad_getrange_default"); function gst_proxy_pad_checkgetrange_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return GLIB.gboolean; -- gst/gstghostpad.h:73 pragma Import (C, gst_proxy_pad_checkgetrange_default, "gst_proxy_pad_checkgetrange_default"); function gst_proxy_pad_getcaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps; -- gst/gstghostpad.h:74 pragma Import (C, gst_proxy_pad_getcaps_default, "gst_proxy_pad_getcaps_default"); function gst_proxy_pad_acceptcaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/gstghostpad.h:75 pragma Import (C, gst_proxy_pad_acceptcaps_default, "gst_proxy_pad_acceptcaps_default"); procedure gst_proxy_pad_fixatecaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps); -- gst/gstghostpad.h:76 pragma Import (C, gst_proxy_pad_fixatecaps_default, "gst_proxy_pad_fixatecaps_default"); function gst_proxy_pad_setcaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/gstghostpad.h:77 pragma Import (C, gst_proxy_pad_setcaps_default, "gst_proxy_pad_setcaps_default"); procedure gst_proxy_pad_unlink_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad); -- gst/gstghostpad.h:78 pragma Import (C, gst_proxy_pad_unlink_default, "gst_proxy_pad_unlink_default"); --* -- * GstGhostPad: -- * -- * Opaque #GstGhostPad structure. -- type GstGhostPad; --subtype GstGhostPad is u_GstGhostPad; -- gst/gstghostpad.h:92 -- skipped empty struct u_GstGhostPadPrivate -- skipped empty struct GstGhostPadPrivate type GstGhostPadClass; type u_GstGhostPadClass_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstGhostPadClass is u_GstGhostPadClass; -- gst/gstghostpad.h:94 type GstGhostPad is record pad : aliased GstProxyPad; -- gst/gstghostpad.h:98 priv : System.Address; -- gst/gstghostpad.h:101 end record; pragma Convention (C_Pass_By_Copy, GstGhostPad); -- gst/gstghostpad.h:96 --< private > type GstGhostPadClass is record parent_class : aliased GstProxyPadClass; -- gst/gstghostpad.h:106 u_gst_reserved : u_GstGhostPadClass_u_gst_reserved_array; -- gst/gstghostpad.h:109 end record; pragma Convention (C_Pass_By_Copy, GstGhostPadClass); -- gst/gstghostpad.h:104 --< private > function gst_ghost_pad_get_type return GLIB.GType; -- gst/gstghostpad.h:113 pragma Import (C, gst_ghost_pad_get_type, "gst_ghost_pad_get_type"); function gst_ghost_pad_new (name : access GLIB.gchar; target : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:115 pragma Import (C, gst_ghost_pad_new, "gst_ghost_pad_new"); function gst_ghost_pad_new_no_target (name : access GLIB.gchar; dir : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadDirection) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:116 pragma Import (C, gst_ghost_pad_new_no_target, "gst_ghost_pad_new_no_target"); function gst_ghost_pad_new_from_template (name : access GLIB.gchar; target : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; templ : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h.GstPadTemplate) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:118 pragma Import (C, gst_ghost_pad_new_from_template, "gst_ghost_pad_new_from_template"); function gst_ghost_pad_new_no_target_from_template (name : access GLIB.gchar; templ : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpadtemplate_h.GstPadTemplate) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:119 pragma Import (C, gst_ghost_pad_new_no_target_from_template, "gst_ghost_pad_new_no_target_from_template"); function gst_ghost_pad_get_target (gpad : access GstGhostPad) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; -- gst/gstghostpad.h:121 pragma Import (C, gst_ghost_pad_get_target, "gst_ghost_pad_get_target"); function gst_ghost_pad_set_target (gpad : access GstGhostPad; newtarget : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return GLIB.gboolean; -- gst/gstghostpad.h:122 pragma Import (C, gst_ghost_pad_set_target, "gst_ghost_pad_set_target"); function gst_ghost_pad_construct (gpad : access GstGhostPad) return GLIB.gboolean; -- gst/gstghostpad.h:124 pragma Import (C, gst_ghost_pad_construct, "gst_ghost_pad_construct"); function gst_ghost_pad_setcaps_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; caps : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstcaps_h.GstCaps) return GLIB.gboolean; -- gst/gstghostpad.h:126 pragma Import (C, gst_ghost_pad_setcaps_default, "gst_ghost_pad_setcaps_default"); procedure gst_ghost_pad_unlink_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad); -- gst/gstghostpad.h:127 pragma Import (C, gst_ghost_pad_unlink_default, "gst_ghost_pad_unlink_default"); function gst_ghost_pad_link_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; peer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad) return GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPadLinkReturn; -- gst/gstghostpad.h:128 pragma Import (C, gst_ghost_pad_link_default, "gst_ghost_pad_link_default"); function gst_ghost_pad_activate_pull_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; active : GLIB.gboolean) return GLIB.gboolean; -- gst/gstghostpad.h:129 pragma Import (C, gst_ghost_pad_activate_pull_default, "gst_ghost_pad_activate_pull_default"); function gst_ghost_pad_activate_push_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; active : GLIB.gboolean) return GLIB.gboolean; -- gst/gstghostpad.h:130 pragma Import (C, gst_ghost_pad_activate_push_default, "gst_ghost_pad_activate_push_default"); function gst_ghost_pad_internal_activate_push_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; active : GLIB.gboolean) return GLIB.gboolean; -- gst/gstghostpad.h:132 pragma Import (C, gst_ghost_pad_internal_activate_push_default, "gst_ghost_pad_internal_activate_push_default"); function gst_ghost_pad_internal_activate_pull_default (pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad; active : GLIB.gboolean) return GLIB.gboolean; -- gst/gstghostpad.h:133 pragma Import (C, gst_ghost_pad_internal_activate_pull_default, "gst_ghost_pad_internal_activate_pull_default"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstghostpad_h;
[ { "context": "--------------------------\n-- Copyright (c) 2019, Daniel King\n-- All rights reserved.\n--\n-- Redistribution an", "end": 115, "score": 0.9997885227203369, "start": 104, "tag": "NAME", "value": "Daniel King" } ]
src/common/keccak-generic_parallel_cshake.adb
damaki/libkeccak
26
------------------------------------------------------------------------------- -- Copyright (c) 2019, Daniel King -- 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. -- * The name of the copyright holder may not 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 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 Keccak.Util; use Keccak.Util; package body Keccak.Generic_Parallel_CSHAKE is --------------------------- -- Process_Full_Blocks -- --------------------------- procedure Process_Full_Blocks (Ctx : in out Context; Block : in out Types.Byte_Array; Input : in Types.Byte_Array; Block_Offset : in out Natural) with Global => null, Pre => (Block_Offset < Block'Length and Block'First = 0 and Block'Length = Rate / 8 and State_Of (Ctx) = Updating), Post => (Block_Offset < Block'Length and State_Of (Ctx) = Updating); --------------------------- -- Process_Full_Blocks -- --------------------------- procedure Process_Full_Blocks (Ctx : in out Context; Block : in out Types.Byte_Array; Input : in Types.Byte_Array; Block_Offset : in out Natural) is use type XOF.States; Block_Length : constant Natural := Block'Length - Block_Offset; Input_Remaining : Natural := Input'Length; Input_Offset : Natural := 0; Length : Natural; Num_Full_Blocks : Natural; Pos : Types.Index_Number; begin if Block_Offset > 0 then -- Merge first bytes of Input with the last bytes currently in -- the block. if Input_Remaining < Block_Length then -- Not enough for a full block. Block (Block_Offset .. Block_Offset + Input_Remaining - 1) := Input (Input'First .. Input'First + Input_Remaining - 1); Input_Offset := Input'Length; Block_Offset := Block_Offset + Input_Remaining; Input_Remaining := 0; else -- We have enough for a full block Block (Block_Offset .. Block'Last) := Input (Input'First .. Input'First + Block_Length - 1); XOF.Update_All (Ctx.XOF_Ctx, Block); Input_Offset := Input_Offset + Block_Length; Input_Remaining := Input_Remaining - Block_Length; Block_Offset := 0; end if; end if; pragma Assert_And_Cut (Input_Offset + Input_Remaining = Input'Length and Block_Offset < Block'Length and Block'Length = Rate / 8 and State_Of (Ctx) = Updating and XOF.State_Of (Ctx.XOF_Ctx) = XOF.Updating and (if Input_Remaining > 0 then Block_Offset = 0)); -- Now process as many full blocks from Input as we can. Num_Full_Blocks := Input_Remaining / Block'Length; if Num_Full_Blocks > 0 then Pos := Input'First + Input_Offset; Length := Num_Full_Blocks * Block'Length; XOF.Update_All (Ctx.XOF_Ctx, Input (Pos .. Pos + Length - 1)); Input_Offset := Input_Offset + Length; Input_Remaining := Input_Remaining - Length; end if; pragma Assert_And_Cut (Input_Offset + Input_Remaining = Input'Length and Block_Offset < Block'Length and Block'Length = Rate / 8 and State_Of (Ctx) = Updating and (if Input_Remaining > 0 then Block_Offset = 0) and Input_Remaining < Block'Length); -- Store any leftover bytes in the block if Input_Remaining > 0 then Pos := Input'First + Input_Offset; Block (0 .. Input_Remaining - 1) := Input (Pos .. Input'Last); Block_Offset := Input_Remaining; end if; end Process_Full_Blocks; ------------ -- Init -- ------------ procedure Init (Ctx : out Context; Customization : in String; Function_Name : in String) is Rate_Bytes : constant Positive := Rate / 8; Block : Types.Byte_Array (0 .. Rate_Bytes - 1) := (others => 0); Block_Offset : Natural; begin XOF.Init (Ctx.XOF_Ctx); -- We need to make sure that the data length for each call to -- XOF.Update_Separate is a multiple of the rate in order to keep the XOF -- in the "Updating" state. This requires packing the encoded -- rate, customization string, and function name into a block which is -- the length of the rate. -- -- +------+---------------+---------------+ -- | rate | Function_Name | Customization | -- +------+---------------+---------------+ -- |<-------------->| -- Rate Block_Offset := 0; Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => Left_Encode_NIST (Rate_Bytes), Block_Offset => Block_Offset); Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => Left_Encode_NIST_Bit_Length (Function_Name'Length), Block_Offset => Block_Offset); Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => To_Byte_Array (Function_Name), Block_Offset => Block_Offset); Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => Left_Encode_NIST_Bit_Length (Customization'Length), Block_Offset => Block_Offset); Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => To_Byte_Array (Customization), Block_Offset => Block_Offset); if Block_Offset > 0 then -- Need to add padding zeroes to leftover data Block (Block_Offset .. Block'Last) := (others => 0); XOF.Update_All (Ctx.XOF_Ctx, Block); end if; end Init; ----------------------- -- Update_Separate -- ----------------------- procedure Update_Separate (Ctx : in out Context; Data : in Types.Byte_Array) is begin XOF.Update_Separate (Ctx.XOF_Ctx, Data); end Update_Separate; ----------------------- -- Extract_Separate -- ----------------------- procedure Extract_Separate (Ctx : in out Context; Data : out Types.Byte_Array) is begin XOF.Extract_Separate (Ctx.XOF_Ctx, Data); end Extract_Separate; end Keccak.Generic_Parallel_CSHAKE;
4230
------------------------------------------------------------------------------- -- Copyright (c) 2019, <NAME> -- 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. -- * The name of the copyright holder may not 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 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 Keccak.Util; use Keccak.Util; package body Keccak.Generic_Parallel_CSHAKE is --------------------------- -- Process_Full_Blocks -- --------------------------- procedure Process_Full_Blocks (Ctx : in out Context; Block : in out Types.Byte_Array; Input : in Types.Byte_Array; Block_Offset : in out Natural) with Global => null, Pre => (Block_Offset < Block'Length and Block'First = 0 and Block'Length = Rate / 8 and State_Of (Ctx) = Updating), Post => (Block_Offset < Block'Length and State_Of (Ctx) = Updating); --------------------------- -- Process_Full_Blocks -- --------------------------- procedure Process_Full_Blocks (Ctx : in out Context; Block : in out Types.Byte_Array; Input : in Types.Byte_Array; Block_Offset : in out Natural) is use type XOF.States; Block_Length : constant Natural := Block'Length - Block_Offset; Input_Remaining : Natural := Input'Length; Input_Offset : Natural := 0; Length : Natural; Num_Full_Blocks : Natural; Pos : Types.Index_Number; begin if Block_Offset > 0 then -- Merge first bytes of Input with the last bytes currently in -- the block. if Input_Remaining < Block_Length then -- Not enough for a full block. Block (Block_Offset .. Block_Offset + Input_Remaining - 1) := Input (Input'First .. Input'First + Input_Remaining - 1); Input_Offset := Input'Length; Block_Offset := Block_Offset + Input_Remaining; Input_Remaining := 0; else -- We have enough for a full block Block (Block_Offset .. Block'Last) := Input (Input'First .. Input'First + Block_Length - 1); XOF.Update_All (Ctx.XOF_Ctx, Block); Input_Offset := Input_Offset + Block_Length; Input_Remaining := Input_Remaining - Block_Length; Block_Offset := 0; end if; end if; pragma Assert_And_Cut (Input_Offset + Input_Remaining = Input'Length and Block_Offset < Block'Length and Block'Length = Rate / 8 and State_Of (Ctx) = Updating and XOF.State_Of (Ctx.XOF_Ctx) = XOF.Updating and (if Input_Remaining > 0 then Block_Offset = 0)); -- Now process as many full blocks from Input as we can. Num_Full_Blocks := Input_Remaining / Block'Length; if Num_Full_Blocks > 0 then Pos := Input'First + Input_Offset; Length := Num_Full_Blocks * Block'Length; XOF.Update_All (Ctx.XOF_Ctx, Input (Pos .. Pos + Length - 1)); Input_Offset := Input_Offset + Length; Input_Remaining := Input_Remaining - Length; end if; pragma Assert_And_Cut (Input_Offset + Input_Remaining = Input'Length and Block_Offset < Block'Length and Block'Length = Rate / 8 and State_Of (Ctx) = Updating and (if Input_Remaining > 0 then Block_Offset = 0) and Input_Remaining < Block'Length); -- Store any leftover bytes in the block if Input_Remaining > 0 then Pos := Input'First + Input_Offset; Block (0 .. Input_Remaining - 1) := Input (Pos .. Input'Last); Block_Offset := Input_Remaining; end if; end Process_Full_Blocks; ------------ -- Init -- ------------ procedure Init (Ctx : out Context; Customization : in String; Function_Name : in String) is Rate_Bytes : constant Positive := Rate / 8; Block : Types.Byte_Array (0 .. Rate_Bytes - 1) := (others => 0); Block_Offset : Natural; begin XOF.Init (Ctx.XOF_Ctx); -- We need to make sure that the data length for each call to -- XOF.Update_Separate is a multiple of the rate in order to keep the XOF -- in the "Updating" state. This requires packing the encoded -- rate, customization string, and function name into a block which is -- the length of the rate. -- -- +------+---------------+---------------+ -- | rate | Function_Name | Customization | -- +------+---------------+---------------+ -- |<-------------->| -- Rate Block_Offset := 0; Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => Left_Encode_NIST (Rate_Bytes), Block_Offset => Block_Offset); Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => Left_Encode_NIST_Bit_Length (Function_Name'Length), Block_Offset => Block_Offset); Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => To_Byte_Array (Function_Name), Block_Offset => Block_Offset); Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => Left_Encode_NIST_Bit_Length (Customization'Length), Block_Offset => Block_Offset); Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => To_Byte_Array (Customization), Block_Offset => Block_Offset); if Block_Offset > 0 then -- Need to add padding zeroes to leftover data Block (Block_Offset .. Block'Last) := (others => 0); XOF.Update_All (Ctx.XOF_Ctx, Block); end if; end Init; ----------------------- -- Update_Separate -- ----------------------- procedure Update_Separate (Ctx : in out Context; Data : in Types.Byte_Array) is begin XOF.Update_Separate (Ctx.XOF_Ctx, Data); end Update_Separate; ----------------------- -- Extract_Separate -- ----------------------- procedure Extract_Separate (Ctx : in out Context; Data : out Types.Byte_Array) is begin XOF.Extract_Separate (Ctx.XOF_Ctx, Data); end Extract_Separate; end Keccak.Generic_Parallel_CSHAKE;
true
------------------------------------------------------------------------------- -- Copyright (c) 2019, PI:NAME:<NAME>END_PI -- 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. -- * The name of the copyright holder may not 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 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 Keccak.Util; use Keccak.Util; package body Keccak.Generic_Parallel_CSHAKE is --------------------------- -- Process_Full_Blocks -- --------------------------- procedure Process_Full_Blocks (Ctx : in out Context; Block : in out Types.Byte_Array; Input : in Types.Byte_Array; Block_Offset : in out Natural) with Global => null, Pre => (Block_Offset < Block'Length and Block'First = 0 and Block'Length = Rate / 8 and State_Of (Ctx) = Updating), Post => (Block_Offset < Block'Length and State_Of (Ctx) = Updating); --------------------------- -- Process_Full_Blocks -- --------------------------- procedure Process_Full_Blocks (Ctx : in out Context; Block : in out Types.Byte_Array; Input : in Types.Byte_Array; Block_Offset : in out Natural) is use type XOF.States; Block_Length : constant Natural := Block'Length - Block_Offset; Input_Remaining : Natural := Input'Length; Input_Offset : Natural := 0; Length : Natural; Num_Full_Blocks : Natural; Pos : Types.Index_Number; begin if Block_Offset > 0 then -- Merge first bytes of Input with the last bytes currently in -- the block. if Input_Remaining < Block_Length then -- Not enough for a full block. Block (Block_Offset .. Block_Offset + Input_Remaining - 1) := Input (Input'First .. Input'First + Input_Remaining - 1); Input_Offset := Input'Length; Block_Offset := Block_Offset + Input_Remaining; Input_Remaining := 0; else -- We have enough for a full block Block (Block_Offset .. Block'Last) := Input (Input'First .. Input'First + Block_Length - 1); XOF.Update_All (Ctx.XOF_Ctx, Block); Input_Offset := Input_Offset + Block_Length; Input_Remaining := Input_Remaining - Block_Length; Block_Offset := 0; end if; end if; pragma Assert_And_Cut (Input_Offset + Input_Remaining = Input'Length and Block_Offset < Block'Length and Block'Length = Rate / 8 and State_Of (Ctx) = Updating and XOF.State_Of (Ctx.XOF_Ctx) = XOF.Updating and (if Input_Remaining > 0 then Block_Offset = 0)); -- Now process as many full blocks from Input as we can. Num_Full_Blocks := Input_Remaining / Block'Length; if Num_Full_Blocks > 0 then Pos := Input'First + Input_Offset; Length := Num_Full_Blocks * Block'Length; XOF.Update_All (Ctx.XOF_Ctx, Input (Pos .. Pos + Length - 1)); Input_Offset := Input_Offset + Length; Input_Remaining := Input_Remaining - Length; end if; pragma Assert_And_Cut (Input_Offset + Input_Remaining = Input'Length and Block_Offset < Block'Length and Block'Length = Rate / 8 and State_Of (Ctx) = Updating and (if Input_Remaining > 0 then Block_Offset = 0) and Input_Remaining < Block'Length); -- Store any leftover bytes in the block if Input_Remaining > 0 then Pos := Input'First + Input_Offset; Block (0 .. Input_Remaining - 1) := Input (Pos .. Input'Last); Block_Offset := Input_Remaining; end if; end Process_Full_Blocks; ------------ -- Init -- ------------ procedure Init (Ctx : out Context; Customization : in String; Function_Name : in String) is Rate_Bytes : constant Positive := Rate / 8; Block : Types.Byte_Array (0 .. Rate_Bytes - 1) := (others => 0); Block_Offset : Natural; begin XOF.Init (Ctx.XOF_Ctx); -- We need to make sure that the data length for each call to -- XOF.Update_Separate is a multiple of the rate in order to keep the XOF -- in the "Updating" state. This requires packing the encoded -- rate, customization string, and function name into a block which is -- the length of the rate. -- -- +------+---------------+---------------+ -- | rate | Function_Name | Customization | -- +------+---------------+---------------+ -- |<-------------->| -- Rate Block_Offset := 0; Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => Left_Encode_NIST (Rate_Bytes), Block_Offset => Block_Offset); Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => Left_Encode_NIST_Bit_Length (Function_Name'Length), Block_Offset => Block_Offset); Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => To_Byte_Array (Function_Name), Block_Offset => Block_Offset); Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => Left_Encode_NIST_Bit_Length (Customization'Length), Block_Offset => Block_Offset); Process_Full_Blocks (Ctx => Ctx, Block => Block, Input => To_Byte_Array (Customization), Block_Offset => Block_Offset); if Block_Offset > 0 then -- Need to add padding zeroes to leftover data Block (Block_Offset .. Block'Last) := (others => 0); XOF.Update_All (Ctx.XOF_Ctx, Block); end if; end Init; ----------------------- -- Update_Separate -- ----------------------- procedure Update_Separate (Ctx : in out Context; Data : in Types.Byte_Array) is begin XOF.Update_Separate (Ctx.XOF_Ctx, Data); end Update_Separate; ----------------------- -- Extract_Separate -- ----------------------- procedure Extract_Separate (Ctx : in out Context; Data : out Types.Byte_Array) is begin XOF.Extract_Separate (Ctx.XOF_Ctx, Data); end Extract_Separate; end Keccak.Generic_Parallel_CSHAKE;
[ { "context": "-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 35, "score": 0.9998562932014465, "start": 23, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 55, "score": 0.9999315738677979, "start": 37, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
source/slim-messages-vers.ads
reznikmm/slimp
0
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with League.Strings; package Slim.Messages.vers is type Vers_Message is new Message with private; not overriding procedure Set_Version (Self : in out Vers_Message; Value : League.Strings.Universal_String); private subtype Byte is Ada.Streams.Stream_Element; type Vers_Message is new Message with record Version : League.Strings.Universal_String; end record; overriding function Read (Data : not null access League.Stream_Element_Vectors.Stream_Element_Vector) return Vers_Message; overriding procedure Write (Self : Vers_Message; Tag : out Message_Tag; Data : out League.Stream_Element_Vectors.Stream_Element_Vector); overriding procedure Visit (Self : not null access Vers_Message; Visiter : in out Slim.Message_Visiters.Visiter'Class); end Slim.Messages.vers;
27775
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with League.Strings; package Slim.Messages.vers is type Vers_Message is new Message with private; not overriding procedure Set_Version (Self : in out Vers_Message; Value : League.Strings.Universal_String); private subtype Byte is Ada.Streams.Stream_Element; type Vers_Message is new Message with record Version : League.Strings.Universal_String; end record; overriding function Read (Data : not null access League.Stream_Element_Vectors.Stream_Element_Vector) return Vers_Message; overriding procedure Write (Self : Vers_Message; Tag : out Message_Tag; Data : out League.Stream_Element_Vectors.Stream_Element_Vector); overriding procedure Visit (Self : not null access Vers_Message; Visiter : in out Slim.Message_Visiters.Visiter'Class); end Slim.Messages.vers;
true
-- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with League.Strings; package Slim.Messages.vers is type Vers_Message is new Message with private; not overriding procedure Set_Version (Self : in out Vers_Message; Value : League.Strings.Universal_String); private subtype Byte is Ada.Streams.Stream_Element; type Vers_Message is new Message with record Version : League.Strings.Universal_String; end record; overriding function Read (Data : not null access League.Stream_Element_Vectors.Stream_Element_Vector) return Vers_Message; overriding procedure Write (Self : Vers_Message; Tag : out Message_Tag; Data : out League.Stream_Element_Vectors.Stream_Element_Vector); overriding procedure Visit (Self : not null access Vers_Message; Visiter : in out Slim.Message_Visiters.Visiter'Class); end Slim.Messages.vers;
[ { "context": "-------------------------------------\n-- Copyright Miletus 2015\n-- Permission is hereby granted, free of cha", "end": 243, "score": 0.9966737627983093, "start": 236, "tag": "NAME", "value": "Miletus" } ]
Milesian_calendar.ads
Louis-Aime/Milesian_calendar_Ada
0
-- Package Milesian_calendar -- Definitions and basic operation on the Milesian calendar -- with respect to Julian Day defined in Julian package. ---------------------------------------------------------------------------- -- Copyright Miletus 2015 -- 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: -- 1. The above copyright notice and this permission notice shall be included -- in all copies or substantial portions of the Software. -- 2. Changes with respect to any former version shall be documented. -- -- The software is provided "as is", without warranty of any kind, -- express of implied, including but not limited to the warranties of -- merchantability, fitness for a particular purpose and noninfringement. -- In no event shall the authors of 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. -- Inquiries: www.calendriermilesien.org ------------------------------------------------------------------------------- with Scaliger; use Scaliger; -- Defines Julian_Day and General date (i.e. Day 1..31, Month 1..12, Year). package Milesian_calendar is Type Milesian_date is new General_date; -- the function names are similar to names of conversion functions in php function JD_to_Milesian (jd : Julian_Day) return Milesian_date ; -- given an integer Julian day, compute the corresponding Milesian date function Milesian_to_JD (md : Milesian_date) return Julian_Day ; -- given a date in Milesian, compute the Julian day end Milesian_calendar;
17835
-- Package Milesian_calendar -- Definitions and basic operation on the Milesian calendar -- with respect to Julian Day defined in Julian package. ---------------------------------------------------------------------------- -- Copyright <NAME> 2015 -- 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: -- 1. The above copyright notice and this permission notice shall be included -- in all copies or substantial portions of the Software. -- 2. Changes with respect to any former version shall be documented. -- -- The software is provided "as is", without warranty of any kind, -- express of implied, including but not limited to the warranties of -- merchantability, fitness for a particular purpose and noninfringement. -- In no event shall the authors of 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. -- Inquiries: www.calendriermilesien.org ------------------------------------------------------------------------------- with Scaliger; use Scaliger; -- Defines Julian_Day and General date (i.e. Day 1..31, Month 1..12, Year). package Milesian_calendar is Type Milesian_date is new General_date; -- the function names are similar to names of conversion functions in php function JD_to_Milesian (jd : Julian_Day) return Milesian_date ; -- given an integer Julian day, compute the corresponding Milesian date function Milesian_to_JD (md : Milesian_date) return Julian_Day ; -- given a date in Milesian, compute the Julian day end Milesian_calendar;
true
-- Package Milesian_calendar -- Definitions and basic operation on the Milesian calendar -- with respect to Julian Day defined in Julian package. ---------------------------------------------------------------------------- -- Copyright PI:NAME:<NAME>END_PI 2015 -- 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: -- 1. The above copyright notice and this permission notice shall be included -- in all copies or substantial portions of the Software. -- 2. Changes with respect to any former version shall be documented. -- -- The software is provided "as is", without warranty of any kind, -- express of implied, including but not limited to the warranties of -- merchantability, fitness for a particular purpose and noninfringement. -- In no event shall the authors of 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. -- Inquiries: www.calendriermilesien.org ------------------------------------------------------------------------------- with Scaliger; use Scaliger; -- Defines Julian_Day and General date (i.e. Day 1..31, Month 1..12, Year). package Milesian_calendar is Type Milesian_date is new General_date; -- the function names are similar to names of conversion functions in php function JD_to_Milesian (jd : Julian_Day) return Milesian_date ; -- given an integer Julian day, compute the corresponding Milesian date function Milesian_to_JD (md : Milesian_date) return Julian_Day ; -- given a date in Milesian, compute the Julian day end Milesian_calendar;
[ { "context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 43, "score": 0.9998573660850525, "start": 33, "tag": "NAME", "value": "Max Reznik" }, { "context": "-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n------------", "end": 63, "score": 0.9999300241470337, "start": 45, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
source/nodes/program-nodes-membership_tests.adb
reznikmm/gela
0
-- SPDX-FileCopyrightText: 2019 Max Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Nodes.Membership_Tests is function Create (Expression : not null Program.Elements.Expressions.Expression_Access; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; In_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Choices : not null Program.Element_Vectors.Element_Vector_Access) return Membership_Test is begin return Result : Membership_Test := (Expression => Expression, Not_Token => Not_Token, In_Token => In_Token, Choices => Choices, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Expression : not null Program.Elements.Expressions .Expression_Access; Choices : not null Program.Element_Vectors .Element_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False; Has_Not : Boolean := False) return Implicit_Membership_Test is begin return Result : Implicit_Membership_Test := (Expression => Expression, Choices => Choices, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Has_Not => Has_Not, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Expression (Self : Base_Membership_Test) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Expression; end Expression; overriding function Choices (Self : Base_Membership_Test) return not null Program.Element_Vectors.Element_Vector_Access is begin return Self.Choices; end Choices; overriding function Not_Token (Self : Membership_Test) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Not_Token; end Not_Token; overriding function In_Token (Self : Membership_Test) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.In_Token; end In_Token; overriding function Has_Not (Self : Membership_Test) return Boolean is begin return Self.Not_Token.Assigned; end Has_Not; overriding function Is_Part_Of_Implicit (Self : Implicit_Membership_Test) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Membership_Test) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Membership_Test) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; overriding function Has_Not (Self : Implicit_Membership_Test) return Boolean is begin return Self.Has_Not; end Has_Not; procedure Initialize (Self : in out Base_Membership_Test'Class) is begin Set_Enclosing_Element (Self.Expression, Self'Unchecked_Access); for Item in Self.Choices.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Membership_Test (Self : Base_Membership_Test) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Membership_Test; overriding function Is_Expression (Self : Base_Membership_Test) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Expression; overriding procedure Visit (Self : not null access Base_Membership_Test; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Membership_Test (Self); end Visit; overriding function To_Membership_Test_Text (Self : in out Membership_Test) return Program.Elements.Membership_Tests.Membership_Test_Text_Access is begin return Self'Unchecked_Access; end To_Membership_Test_Text; overriding function To_Membership_Test_Text (Self : in out Implicit_Membership_Test) return Program.Elements.Membership_Tests.Membership_Test_Text_Access is pragma Unreferenced (Self); begin return null; end To_Membership_Test_Text; end Program.Nodes.Membership_Tests;
14679
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Nodes.Membership_Tests is function Create (Expression : not null Program.Elements.Expressions.Expression_Access; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; In_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Choices : not null Program.Element_Vectors.Element_Vector_Access) return Membership_Test is begin return Result : Membership_Test := (Expression => Expression, Not_Token => Not_Token, In_Token => In_Token, Choices => Choices, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Expression : not null Program.Elements.Expressions .Expression_Access; Choices : not null Program.Element_Vectors .Element_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False; Has_Not : Boolean := False) return Implicit_Membership_Test is begin return Result : Implicit_Membership_Test := (Expression => Expression, Choices => Choices, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Has_Not => Has_Not, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Expression (Self : Base_Membership_Test) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Expression; end Expression; overriding function Choices (Self : Base_Membership_Test) return not null Program.Element_Vectors.Element_Vector_Access is begin return Self.Choices; end Choices; overriding function Not_Token (Self : Membership_Test) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Not_Token; end Not_Token; overriding function In_Token (Self : Membership_Test) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.In_Token; end In_Token; overriding function Has_Not (Self : Membership_Test) return Boolean is begin return Self.Not_Token.Assigned; end Has_Not; overriding function Is_Part_Of_Implicit (Self : Implicit_Membership_Test) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Membership_Test) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Membership_Test) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; overriding function Has_Not (Self : Implicit_Membership_Test) return Boolean is begin return Self.Has_Not; end Has_Not; procedure Initialize (Self : in out Base_Membership_Test'Class) is begin Set_Enclosing_Element (Self.Expression, Self'Unchecked_Access); for Item in Self.Choices.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Membership_Test (Self : Base_Membership_Test) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Membership_Test; overriding function Is_Expression (Self : Base_Membership_Test) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Expression; overriding procedure Visit (Self : not null access Base_Membership_Test; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Membership_Test (Self); end Visit; overriding function To_Membership_Test_Text (Self : in out Membership_Test) return Program.Elements.Membership_Tests.Membership_Test_Text_Access is begin return Self'Unchecked_Access; end To_Membership_Test_Text; overriding function To_Membership_Test_Text (Self : in out Implicit_Membership_Test) return Program.Elements.Membership_Tests.Membership_Test_Text_Access is pragma Unreferenced (Self); begin return null; end To_Membership_Test_Text; end Program.Nodes.Membership_Tests;
true
-- SPDX-FileCopyrightText: 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- package body Program.Nodes.Membership_Tests is function Create (Expression : not null Program.Elements.Expressions.Expression_Access; Not_Token : Program.Lexical_Elements.Lexical_Element_Access; In_Token : not null Program.Lexical_Elements.Lexical_Element_Access; Choices : not null Program.Element_Vectors.Element_Vector_Access) return Membership_Test is begin return Result : Membership_Test := (Expression => Expression, Not_Token => Not_Token, In_Token => In_Token, Choices => Choices, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Expression : not null Program.Elements.Expressions .Expression_Access; Choices : not null Program.Element_Vectors .Element_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False; Has_Not : Boolean := False) return Implicit_Membership_Test is begin return Result : Implicit_Membership_Test := (Expression => Expression, Choices => Choices, Is_Part_Of_Implicit => Is_Part_Of_Implicit, Is_Part_Of_Inherited => Is_Part_Of_Inherited, Is_Part_Of_Instance => Is_Part_Of_Instance, Has_Not => Has_Not, Enclosing_Element => null) do Initialize (Result); end return; end Create; overriding function Expression (Self : Base_Membership_Test) return not null Program.Elements.Expressions.Expression_Access is begin return Self.Expression; end Expression; overriding function Choices (Self : Base_Membership_Test) return not null Program.Element_Vectors.Element_Vector_Access is begin return Self.Choices; end Choices; overriding function Not_Token (Self : Membership_Test) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Not_Token; end Not_Token; overriding function In_Token (Self : Membership_Test) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.In_Token; end In_Token; overriding function Has_Not (Self : Membership_Test) return Boolean is begin return Self.Not_Token.Assigned; end Has_Not; overriding function Is_Part_Of_Implicit (Self : Implicit_Membership_Test) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Membership_Test) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Membership_Test) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; overriding function Has_Not (Self : Implicit_Membership_Test) return Boolean is begin return Self.Has_Not; end Has_Not; procedure Initialize (Self : in out Base_Membership_Test'Class) is begin Set_Enclosing_Element (Self.Expression, Self'Unchecked_Access); for Item in Self.Choices.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Membership_Test (Self : Base_Membership_Test) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Membership_Test; overriding function Is_Expression (Self : Base_Membership_Test) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Expression; overriding procedure Visit (Self : not null access Base_Membership_Test; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Membership_Test (Self); end Visit; overriding function To_Membership_Test_Text (Self : in out Membership_Test) return Program.Elements.Membership_Tests.Membership_Test_Text_Access is begin return Self'Unchecked_Access; end To_Membership_Test_Text; overriding function To_Membership_Test_Text (Self : in out Implicit_Membership_Test) return Program.Elements.Membership_Tests.Membership_Test_Text_Access is pragma Unreferenced (Self); begin return null; end To_Membership_Test_Text; end Program.Nodes.Membership_Tests;
[ { "context": "--\n-- Copyright (C) 2021 Jeremy Grosser <jeremy@synack.me>\n--\n-- SPDX-License-Identifier", "end": 40, "score": 0.9998400807380676, "start": 26, "tag": "NAME", "value": "Jeremy Grosser" }, { "context": "--\n-- Copyright (C) 2021 Jeremy Grosser <jeremy@synack.me>\n--\n-- SPDX-License-Identifier: BSD-3-Clause\n--\n", "end": 58, "score": 0.9999332427978516, "start": 42, "tag": "EMAIL", "value": "jeremy@synack.me" } ]
rp2040_drivers/piezo.adb
JeremyGrosser/sensors
1
-- -- Copyright (C) 2021 Jeremy Grosser <jeremy@synack.me> -- -- SPDX-License-Identifier: BSD-3-Clause -- with RP.Device; with RP; use RP; package body Piezo is procedure Beep (This : Beeper; Duration : Milliseconds := 1_000; Frequency : Hertz := 440; Count : Positive := 1) is use RP.GPIO; use RP.PWM; Period : constant := 10_000; Half : constant := Period / 2; begin if This.Point_A /= null then Configure (This.Point_A.all, Output, Floating, RP.GPIO.PWM); end if; if This.Point_B /= null then Configure (This.Point_B.all, Output, Floating, RP.GPIO.PWM); end if; Set_Mode (This.Slice, Free_Running); Set_Frequency (This.Slice, Frequency * Period); Set_Interval (This.Slice, Period); Set_Invert (This.Slice, Channel_A => False, Channel_B => True); Set_Duty_Cycle (This.Slice, 0, 0); Enable (This.Slice); for I in 1 .. Count loop Set_Duty_Cycle (This.Slice, Half, Half); RP.Device.Timer.Delay_Milliseconds (Duration); Set_Duty_Cycle (This.Slice, 0, 0); if I /= Count then RP.Device.Timer.Delay_Milliseconds (Duration); end if; end loop; end Beep; end Piezo;
26871
-- -- Copyright (C) 2021 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: BSD-3-Clause -- with RP.Device; with RP; use RP; package body Piezo is procedure Beep (This : Beeper; Duration : Milliseconds := 1_000; Frequency : Hertz := 440; Count : Positive := 1) is use RP.GPIO; use RP.PWM; Period : constant := 10_000; Half : constant := Period / 2; begin if This.Point_A /= null then Configure (This.Point_A.all, Output, Floating, RP.GPIO.PWM); end if; if This.Point_B /= null then Configure (This.Point_B.all, Output, Floating, RP.GPIO.PWM); end if; Set_Mode (This.Slice, Free_Running); Set_Frequency (This.Slice, Frequency * Period); Set_Interval (This.Slice, Period); Set_Invert (This.Slice, Channel_A => False, Channel_B => True); Set_Duty_Cycle (This.Slice, 0, 0); Enable (This.Slice); for I in 1 .. Count loop Set_Duty_Cycle (This.Slice, Half, Half); RP.Device.Timer.Delay_Milliseconds (Duration); Set_Duty_Cycle (This.Slice, 0, 0); if I /= Count then RP.Device.Timer.Delay_Milliseconds (Duration); end if; end loop; end Beep; end Piezo;
true
-- -- Copyright (C) 2021 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: BSD-3-Clause -- with RP.Device; with RP; use RP; package body Piezo is procedure Beep (This : Beeper; Duration : Milliseconds := 1_000; Frequency : Hertz := 440; Count : Positive := 1) is use RP.GPIO; use RP.PWM; Period : constant := 10_000; Half : constant := Period / 2; begin if This.Point_A /= null then Configure (This.Point_A.all, Output, Floating, RP.GPIO.PWM); end if; if This.Point_B /= null then Configure (This.Point_B.all, Output, Floating, RP.GPIO.PWM); end if; Set_Mode (This.Slice, Free_Running); Set_Frequency (This.Slice, Frequency * Period); Set_Interval (This.Slice, Period); Set_Invert (This.Slice, Channel_A => False, Channel_B => True); Set_Duty_Cycle (This.Slice, 0, 0); Enable (This.Slice); for I in 1 .. Count loop Set_Duty_Cycle (This.Slice, Half, Half); RP.Device.Timer.Delay_Milliseconds (Duration); Set_Duty_Cycle (This.Slice, 0, 0); if I /= Count then RP.Device.Timer.Delay_Milliseconds (Duration); end if; end loop; end Beep; end Piezo;
[ { "context": "\";\n SCARON_NAME : aliased constant String := \"Scaron\";\n SIGMA_NAME : aliased constant String := \"", "end": 2663, "score": 0.9689173102378845, "start": 2657, "tag": "NAME", "value": "Scaron" }, { "context": "\";\n N210_NAME : aliased constant String := \"scaron\";\n SDOT_NAME : aliased constant String := \"", "end": 11669, "score": 0.8083436489105225, "start": 11663, "tag": "NAME", "value": "scaron" } ]
src/wiki-parsers-html-entities.ads
jquorning/ada-wiki
18
-- Generated by gen-ada-entities.pl latin1.ent symbol.ent special.ent private package Wiki.Parsers.Html.Entities is pragma Preelaborate; AELIG_NAME : aliased constant String := "AElig"; AACUTE_NAME : aliased constant String := "Aacute"; ACIRC_NAME : aliased constant String := "Acirc"; AGRAVE_NAME : aliased constant String := "Agrave"; ALPHA_NAME : aliased constant String := "Alpha"; ARING_NAME : aliased constant String := "Aring"; ATILDE_NAME : aliased constant String := "Atilde"; AUML_NAME : aliased constant String := "Auml"; BETA_NAME : aliased constant String := "Beta"; CCEDIL_NAME : aliased constant String := "Ccedil"; CHI_NAME : aliased constant String := "Chi"; DAGGER_NAME : aliased constant String := "Dagger"; DELTA_NAME : aliased constant String := "Delta"; ETH_NAME : aliased constant String := "ETH"; EACUTE_NAME : aliased constant String := "Eacute"; ECIRC_NAME : aliased constant String := "Ecirc"; EGRAVE_NAME : aliased constant String := "Egrave"; EPSILON_NAME : aliased constant String := "Epsilon"; ETA_NAME : aliased constant String := "Eta"; EUML_NAME : aliased constant String := "Euml"; GAMMA_NAME : aliased constant String := "Gamma"; IACUTE_NAME : aliased constant String := "Iacute"; ICIRC_NAME : aliased constant String := "Icirc"; IGRAVE_NAME : aliased constant String := "Igrave"; IOTA_NAME : aliased constant String := "Iota"; IUML_NAME : aliased constant String := "Iuml"; KAPPA_NAME : aliased constant String := "Kappa"; LAMBDA_NAME : aliased constant String := "Lambda"; MU_NAME : aliased constant String := "Mu"; NTILDE_NAME : aliased constant String := "Ntilde"; NU_NAME : aliased constant String := "Nu"; OELIG_NAME : aliased constant String := "OElig"; OACUTE_NAME : aliased constant String := "Oacute"; OCIRC_NAME : aliased constant String := "Ocirc"; OGRAVE_NAME : aliased constant String := "Ograve"; OMEGA_NAME : aliased constant String := "Omega"; OMICRON_NAME : aliased constant String := "Omicron"; OSLASH_NAME : aliased constant String := "Oslash"; OTILDE_NAME : aliased constant String := "Otilde"; OUML_NAME : aliased constant String := "Ouml"; PHI_NAME : aliased constant String := "Phi"; PI_NAME : aliased constant String := "Pi"; PRIME_NAME : aliased constant String := "Prime"; PSI_NAME : aliased constant String := "Psi"; RHO_NAME : aliased constant String := "Rho"; SCARON_NAME : aliased constant String := "Scaron"; SIGMA_NAME : aliased constant String := "Sigma"; THORN_NAME : aliased constant String := "THORN"; TAU_NAME : aliased constant String := "Tau"; THETA_NAME : aliased constant String := "Theta"; UACUTE_NAME : aliased constant String := "Uacute"; UCIRC_NAME : aliased constant String := "Ucirc"; UGRAVE_NAME : aliased constant String := "Ugrave"; UPSILON_NAME : aliased constant String := "Upsilon"; UUML_NAME : aliased constant String := "Uuml"; XI_NAME : aliased constant String := "Xi"; YACUTE_NAME : aliased constant String := "Yacute"; YUML_NAME : aliased constant String := "Yuml"; ZETA_NAME : aliased constant String := "Zeta"; N59_NAME : aliased constant String := "aacute"; N60_NAME : aliased constant String := "acirc"; ACUTE_NAME : aliased constant String := "acute"; N62_NAME : aliased constant String := "aelig"; N63_NAME : aliased constant String := "agrave"; ALEFSYM_NAME : aliased constant String := "alefsym"; N65_NAME : aliased constant String := "alpha"; AMP_NAME : aliased constant String := "amp"; AND_NAME : aliased constant String := "and"; ANG_NAME : aliased constant String := "ang"; APOS_NAME : aliased constant String := "apos"; N70_NAME : aliased constant String := "aring"; ASYMP_NAME : aliased constant String := "asymp"; N72_NAME : aliased constant String := "atilde"; N73_NAME : aliased constant String := "auml"; BDQUO_NAME : aliased constant String := "bdquo"; N75_NAME : aliased constant String := "beta"; BRVBAR_NAME : aliased constant String := "brvbar"; BULL_NAME : aliased constant String := "bull"; CAP_NAME : aliased constant String := "cap"; N79_NAME : aliased constant String := "ccedil"; CEDIL_NAME : aliased constant String := "cedil"; CENT_NAME : aliased constant String := "cent"; N82_NAME : aliased constant String := "chi"; CIRC_NAME : aliased constant String := "circ"; CLUBS_NAME : aliased constant String := "clubs"; CONG_NAME : aliased constant String := "cong"; COPY_NAME : aliased constant String := "copy"; CRARR_NAME : aliased constant String := "crarr"; CUP_NAME : aliased constant String := "cup"; CURREN_NAME : aliased constant String := "curren"; DARR_NAME : aliased constant String := "dArr"; N91_NAME : aliased constant String := "dagger"; N92_NAME : aliased constant String := "darr"; DEG_NAME : aliased constant String := "deg"; N94_NAME : aliased constant String := "delta"; DIAMS_NAME : aliased constant String := "diams"; DIVIDE_NAME : aliased constant String := "divide"; N97_NAME : aliased constant String := "eacute"; N98_NAME : aliased constant String := "ecirc"; N99_NAME : aliased constant String := "egrave"; EMPTY_NAME : aliased constant String := "empty"; EMSP_NAME : aliased constant String := "emsp"; ENSP_NAME : aliased constant String := "ensp"; N103_NAME : aliased constant String := "epsilon"; EQUIV_NAME : aliased constant String := "equiv"; N105_NAME : aliased constant String := "eta"; N106_NAME : aliased constant String := "eth"; N107_NAME : aliased constant String := "euml"; EURO_NAME : aliased constant String := "euro"; EXIST_NAME : aliased constant String := "exist"; FNOF_NAME : aliased constant String := "fnof"; FORALL_NAME : aliased constant String := "forall"; FRAC12_NAME : aliased constant String := "frac12"; FRAC14_NAME : aliased constant String := "frac14"; FRAC34_NAME : aliased constant String := "frac34"; FRASL_NAME : aliased constant String := "frasl"; N116_NAME : aliased constant String := "gamma"; GE_NAME : aliased constant String := "ge"; GT_NAME : aliased constant String := "gt"; HARR_NAME : aliased constant String := "hArr"; N120_NAME : aliased constant String := "harr"; HEARTS_NAME : aliased constant String := "hearts"; HELLIP_NAME : aliased constant String := "hellip"; N123_NAME : aliased constant String := "iacute"; N124_NAME : aliased constant String := "icirc"; IEXCL_NAME : aliased constant String := "iexcl"; N126_NAME : aliased constant String := "igrave"; IMAGE_NAME : aliased constant String := "image"; INFIN_NAME : aliased constant String := "infin"; INT_NAME : aliased constant String := "int"; N130_NAME : aliased constant String := "iota"; IQUEST_NAME : aliased constant String := "iquest"; ISIN_NAME : aliased constant String := "isin"; N133_NAME : aliased constant String := "iuml"; N134_NAME : aliased constant String := "kappa"; LARR_NAME : aliased constant String := "lArr"; N136_NAME : aliased constant String := "lambda"; LANG_NAME : aliased constant String := "lang"; LAQUO_NAME : aliased constant String := "laquo"; N139_NAME : aliased constant String := "larr"; LCEIL_NAME : aliased constant String := "lceil"; LDQUO_NAME : aliased constant String := "ldquo"; LE_NAME : aliased constant String := "le"; LFLOOR_NAME : aliased constant String := "lfloor"; LOWAST_NAME : aliased constant String := "lowast"; LOZ_NAME : aliased constant String := "loz"; LRM_NAME : aliased constant String := "lrm"; LSAQUO_NAME : aliased constant String := "lsaquo"; LSQUO_NAME : aliased constant String := "lsquo"; LT_NAME : aliased constant String := "lt"; MACR_NAME : aliased constant String := "macr"; MDASH_NAME : aliased constant String := "mdash"; MICRO_NAME : aliased constant String := "micro"; MIDDOT_NAME : aliased constant String := "middot"; MINUS_NAME : aliased constant String := "minus"; N155_NAME : aliased constant String := "mu"; NABLA_NAME : aliased constant String := "nabla"; NBSP_NAME : aliased constant String := "nbsp"; NDASH_NAME : aliased constant String := "ndash"; NE_NAME : aliased constant String := "ne"; NI_NAME : aliased constant String := "ni"; NOT_NAME : aliased constant String := "not"; NOTIN_NAME : aliased constant String := "notin"; NSUB_NAME : aliased constant String := "nsub"; N164_NAME : aliased constant String := "ntilde"; N165_NAME : aliased constant String := "nu"; N166_NAME : aliased constant String := "oacute"; N167_NAME : aliased constant String := "ocirc"; N168_NAME : aliased constant String := "oelig"; N169_NAME : aliased constant String := "ograve"; OLINE_NAME : aliased constant String := "oline"; N171_NAME : aliased constant String := "omega"; N172_NAME : aliased constant String := "omicron"; OPLUS_NAME : aliased constant String := "oplus"; OR_NAME : aliased constant String := "or"; ORDF_NAME : aliased constant String := "ordf"; ORDM_NAME : aliased constant String := "ordm"; N177_NAME : aliased constant String := "oslash"; N178_NAME : aliased constant String := "otilde"; OTIMES_NAME : aliased constant String := "otimes"; N180_NAME : aliased constant String := "ouml"; PARA_NAME : aliased constant String := "para"; PART_NAME : aliased constant String := "part"; PERMIL_NAME : aliased constant String := "permil"; PERP_NAME : aliased constant String := "perp"; N185_NAME : aliased constant String := "phi"; N186_NAME : aliased constant String := "pi"; PIV_NAME : aliased constant String := "piv"; PLUSMN_NAME : aliased constant String := "plusmn"; POUND_NAME : aliased constant String := "pound"; N190_NAME : aliased constant String := "prime"; PROD_NAME : aliased constant String := "prod"; PROP_NAME : aliased constant String := "prop"; N193_NAME : aliased constant String := "psi"; QUOT_NAME : aliased constant String := "quot"; RARR_NAME : aliased constant String := "rArr"; RADIC_NAME : aliased constant String := "radic"; RANG_NAME : aliased constant String := "rang"; RAQUO_NAME : aliased constant String := "raquo"; N199_NAME : aliased constant String := "rarr"; RCEIL_NAME : aliased constant String := "rceil"; RDQUO_NAME : aliased constant String := "rdquo"; REAL_NAME : aliased constant String := "real"; REG_NAME : aliased constant String := "reg"; RFLOOR_NAME : aliased constant String := "rfloor"; N205_NAME : aliased constant String := "rho"; RLM_NAME : aliased constant String := "rlm"; RSAQUO_NAME : aliased constant String := "rsaquo"; RSQUO_NAME : aliased constant String := "rsquo"; SBQUO_NAME : aliased constant String := "sbquo"; N210_NAME : aliased constant String := "scaron"; SDOT_NAME : aliased constant String := "sdot"; SECT_NAME : aliased constant String := "sect"; SHY_NAME : aliased constant String := "shy"; N214_NAME : aliased constant String := "sigma"; SIGMAF_NAME : aliased constant String := "sigmaf"; SIM_NAME : aliased constant String := "sim"; SPADES_NAME : aliased constant String := "spades"; SUB_NAME : aliased constant String := "sub"; SUBE_NAME : aliased constant String := "sube"; SUM_NAME : aliased constant String := "sum"; SUP_NAME : aliased constant String := "sup"; SUP1_NAME : aliased constant String := "sup1"; SUP2_NAME : aliased constant String := "sup2"; SUP3_NAME : aliased constant String := "sup3"; SUPE_NAME : aliased constant String := "supe"; SZLIG_NAME : aliased constant String := "szlig"; N227_NAME : aliased constant String := "tau"; THERE4_NAME : aliased constant String := "there4"; N229_NAME : aliased constant String := "theta"; THETASYM_NAME : aliased constant String := "thetasym"; THINSP_NAME : aliased constant String := "thinsp"; N232_NAME : aliased constant String := "thorn"; TILDE_NAME : aliased constant String := "tilde"; TIMES_NAME : aliased constant String := "times"; TRADE_NAME : aliased constant String := "trade"; UARR_NAME : aliased constant String := "uArr"; N237_NAME : aliased constant String := "uacute"; N238_NAME : aliased constant String := "uarr"; N239_NAME : aliased constant String := "ucirc"; N240_NAME : aliased constant String := "ugrave"; UML_NAME : aliased constant String := "uml"; UPSIH_NAME : aliased constant String := "upsih"; N243_NAME : aliased constant String := "upsilon"; N244_NAME : aliased constant String := "uuml"; WEIERP_NAME : aliased constant String := "weierp"; N246_NAME : aliased constant String := "xi"; N247_NAME : aliased constant String := "yacute"; YEN_NAME : aliased constant String := "yen"; N249_NAME : aliased constant String := "yuml"; N250_NAME : aliased constant String := "zeta"; ZWJ_NAME : aliased constant String := "zwj"; ZWNJ_NAME : aliased constant String := "zwnj"; type String_Access is access constant String; type Keyword_Array is array (Positive range 1 .. 253) of String_Access; type Char_Array is array (Positive range 1 .. 253) of Wide_Wide_Character; Keywords : constant Keyword_Array := ( AELIG_NAME'Access, AACUTE_NAME'Access, ACIRC_NAME'Access, AGRAVE_NAME'Access, ALPHA_NAME'Access, ARING_NAME'Access, ATILDE_NAME'Access, AUML_NAME'Access, BETA_NAME'Access, CCEDIL_NAME'Access, CHI_NAME'Access, DAGGER_NAME'Access, DELTA_NAME'Access, ETH_NAME'Access, EACUTE_NAME'Access, ECIRC_NAME'Access, EGRAVE_NAME'Access, EPSILON_NAME'Access, ETA_NAME'Access, EUML_NAME'Access, GAMMA_NAME'Access, IACUTE_NAME'Access, ICIRC_NAME'Access, IGRAVE_NAME'Access, IOTA_NAME'Access, IUML_NAME'Access, KAPPA_NAME'Access, LAMBDA_NAME'Access, MU_NAME'Access, NTILDE_NAME'Access, NU_NAME'Access, OELIG_NAME'Access, OACUTE_NAME'Access, OCIRC_NAME'Access, OGRAVE_NAME'Access, OMEGA_NAME'Access, OMICRON_NAME'Access, OSLASH_NAME'Access, OTILDE_NAME'Access, OUML_NAME'Access, PHI_NAME'Access, PI_NAME'Access, PRIME_NAME'Access, PSI_NAME'Access, RHO_NAME'Access, SCARON_NAME'Access, SIGMA_NAME'Access, THORN_NAME'Access, TAU_NAME'Access, THETA_NAME'Access, UACUTE_NAME'Access, UCIRC_NAME'Access, UGRAVE_NAME'Access, UPSILON_NAME'Access, UUML_NAME'Access, XI_NAME'Access, YACUTE_NAME'Access, YUML_NAME'Access, ZETA_NAME'Access, N59_NAME'Access, N60_NAME'Access, ACUTE_NAME'Access, N62_NAME'Access, N63_NAME'Access, ALEFSYM_NAME'Access, N65_NAME'Access, AMP_NAME'Access, AND_NAME'Access, ANG_NAME'Access, APOS_NAME'Access, N70_NAME'Access, ASYMP_NAME'Access, N72_NAME'Access, N73_NAME'Access, BDQUO_NAME'Access, N75_NAME'Access, BRVBAR_NAME'Access, BULL_NAME'Access, CAP_NAME'Access, N79_NAME'Access, CEDIL_NAME'Access, CENT_NAME'Access, N82_NAME'Access, CIRC_NAME'Access, CLUBS_NAME'Access, CONG_NAME'Access, COPY_NAME'Access, CRARR_NAME'Access, CUP_NAME'Access, CURREN_NAME'Access, DARR_NAME'Access, N91_NAME'Access, N92_NAME'Access, DEG_NAME'Access, N94_NAME'Access, DIAMS_NAME'Access, DIVIDE_NAME'Access, N97_NAME'Access, N98_NAME'Access, N99_NAME'Access, EMPTY_NAME'Access, EMSP_NAME'Access, ENSP_NAME'Access, N103_NAME'Access, EQUIV_NAME'Access, N105_NAME'Access, N106_NAME'Access, N107_NAME'Access, EURO_NAME'Access, EXIST_NAME'Access, FNOF_NAME'Access, FORALL_NAME'Access, FRAC12_NAME'Access, FRAC14_NAME'Access, FRAC34_NAME'Access, FRASL_NAME'Access, N116_NAME'Access, GE_NAME'Access, GT_NAME'Access, HARR_NAME'Access, N120_NAME'Access, HEARTS_NAME'Access, HELLIP_NAME'Access, N123_NAME'Access, N124_NAME'Access, IEXCL_NAME'Access, N126_NAME'Access, IMAGE_NAME'Access, INFIN_NAME'Access, INT_NAME'Access, N130_NAME'Access, IQUEST_NAME'Access, ISIN_NAME'Access, N133_NAME'Access, N134_NAME'Access, LARR_NAME'Access, N136_NAME'Access, LANG_NAME'Access, LAQUO_NAME'Access, N139_NAME'Access, LCEIL_NAME'Access, LDQUO_NAME'Access, LE_NAME'Access, LFLOOR_NAME'Access, LOWAST_NAME'Access, LOZ_NAME'Access, LRM_NAME'Access, LSAQUO_NAME'Access, LSQUO_NAME'Access, LT_NAME'Access, MACR_NAME'Access, MDASH_NAME'Access, MICRO_NAME'Access, MIDDOT_NAME'Access, MINUS_NAME'Access, N155_NAME'Access, NABLA_NAME'Access, NBSP_NAME'Access, NDASH_NAME'Access, NE_NAME'Access, NI_NAME'Access, NOT_NAME'Access, NOTIN_NAME'Access, NSUB_NAME'Access, N164_NAME'Access, N165_NAME'Access, N166_NAME'Access, N167_NAME'Access, N168_NAME'Access, N169_NAME'Access, OLINE_NAME'Access, N171_NAME'Access, N172_NAME'Access, OPLUS_NAME'Access, OR_NAME'Access, ORDF_NAME'Access, ORDM_NAME'Access, N177_NAME'Access, N178_NAME'Access, OTIMES_NAME'Access, N180_NAME'Access, PARA_NAME'Access, PART_NAME'Access, PERMIL_NAME'Access, PERP_NAME'Access, N185_NAME'Access, N186_NAME'Access, PIV_NAME'Access, PLUSMN_NAME'Access, POUND_NAME'Access, N190_NAME'Access, PROD_NAME'Access, PROP_NAME'Access, N193_NAME'Access, QUOT_NAME'Access, RARR_NAME'Access, RADIC_NAME'Access, RANG_NAME'Access, RAQUO_NAME'Access, N199_NAME'Access, RCEIL_NAME'Access, RDQUO_NAME'Access, REAL_NAME'Access, REG_NAME'Access, RFLOOR_NAME'Access, N205_NAME'Access, RLM_NAME'Access, RSAQUO_NAME'Access, RSQUO_NAME'Access, SBQUO_NAME'Access, N210_NAME'Access, SDOT_NAME'Access, SECT_NAME'Access, SHY_NAME'Access, N214_NAME'Access, SIGMAF_NAME'Access, SIM_NAME'Access, SPADES_NAME'Access, SUB_NAME'Access, SUBE_NAME'Access, SUM_NAME'Access, SUP_NAME'Access, SUP1_NAME'Access, SUP2_NAME'Access, SUP3_NAME'Access, SUPE_NAME'Access, SZLIG_NAME'Access, N227_NAME'Access, THERE4_NAME'Access, N229_NAME'Access, THETASYM_NAME'Access, THINSP_NAME'Access, N232_NAME'Access, TILDE_NAME'Access, TIMES_NAME'Access, TRADE_NAME'Access, UARR_NAME'Access, N237_NAME'Access, N238_NAME'Access, N239_NAME'Access, N240_NAME'Access, UML_NAME'Access, UPSIH_NAME'Access, N243_NAME'Access, N244_NAME'Access, WEIERP_NAME'Access, N246_NAME'Access, N247_NAME'Access, YEN_NAME'Access, N249_NAME'Access, N250_NAME'Access, ZWJ_NAME'Access, ZWNJ_NAME'Access); Mapping : constant Char_Array := ( Wide_Wide_Character'Val (198), Wide_Wide_Character'Val (193), Wide_Wide_Character'Val (194), Wide_Wide_Character'Val (192), Wide_Wide_Character'Val (913), Wide_Wide_Character'Val (197), Wide_Wide_Character'Val (195), Wide_Wide_Character'Val (196), Wide_Wide_Character'Val (914), Wide_Wide_Character'Val (199), Wide_Wide_Character'Val (935), Wide_Wide_Character'Val (8225), Wide_Wide_Character'Val (916), Wide_Wide_Character'Val (208), Wide_Wide_Character'Val (201), Wide_Wide_Character'Val (202), Wide_Wide_Character'Val (200), Wide_Wide_Character'Val (917), Wide_Wide_Character'Val (919), Wide_Wide_Character'Val (203), Wide_Wide_Character'Val (915), Wide_Wide_Character'Val (205), Wide_Wide_Character'Val (206), Wide_Wide_Character'Val (204), Wide_Wide_Character'Val (921), Wide_Wide_Character'Val (207), Wide_Wide_Character'Val (922), Wide_Wide_Character'Val (923), Wide_Wide_Character'Val (924), Wide_Wide_Character'Val (209), Wide_Wide_Character'Val (925), Wide_Wide_Character'Val (338), Wide_Wide_Character'Val (211), Wide_Wide_Character'Val (212), Wide_Wide_Character'Val (210), Wide_Wide_Character'Val (937), Wide_Wide_Character'Val (927), Wide_Wide_Character'Val (216), Wide_Wide_Character'Val (213), Wide_Wide_Character'Val (214), Wide_Wide_Character'Val (934), Wide_Wide_Character'Val (928), Wide_Wide_Character'Val (8243), Wide_Wide_Character'Val (936), Wide_Wide_Character'Val (929), Wide_Wide_Character'Val (352), Wide_Wide_Character'Val (931), Wide_Wide_Character'Val (222), Wide_Wide_Character'Val (932), Wide_Wide_Character'Val (920), Wide_Wide_Character'Val (218), Wide_Wide_Character'Val (219), Wide_Wide_Character'Val (217), Wide_Wide_Character'Val (933), Wide_Wide_Character'Val (220), Wide_Wide_Character'Val (926), Wide_Wide_Character'Val (221), Wide_Wide_Character'Val (376), Wide_Wide_Character'Val (918), Wide_Wide_Character'Val (225), Wide_Wide_Character'Val (226), Wide_Wide_Character'Val (180), Wide_Wide_Character'Val (230), Wide_Wide_Character'Val (224), Wide_Wide_Character'Val (8501), Wide_Wide_Character'Val (945), Wide_Wide_Character'Val (38), Wide_Wide_Character'Val (8743), Wide_Wide_Character'Val (8736), Wide_Wide_Character'Val (39), Wide_Wide_Character'Val (229), Wide_Wide_Character'Val (8776), Wide_Wide_Character'Val (227), Wide_Wide_Character'Val (228), Wide_Wide_Character'Val (8222), Wide_Wide_Character'Val (946), Wide_Wide_Character'Val (166), Wide_Wide_Character'Val (8226), Wide_Wide_Character'Val (8745), Wide_Wide_Character'Val (231), Wide_Wide_Character'Val (184), Wide_Wide_Character'Val (162), Wide_Wide_Character'Val (967), Wide_Wide_Character'Val (710), Wide_Wide_Character'Val (9827), Wide_Wide_Character'Val (8773), Wide_Wide_Character'Val (169), Wide_Wide_Character'Val (8629), Wide_Wide_Character'Val (8746), Wide_Wide_Character'Val (164), Wide_Wide_Character'Val (8659), Wide_Wide_Character'Val (8224), Wide_Wide_Character'Val (8595), Wide_Wide_Character'Val (176), Wide_Wide_Character'Val (948), Wide_Wide_Character'Val (9830), Wide_Wide_Character'Val (247), Wide_Wide_Character'Val (233), Wide_Wide_Character'Val (234), Wide_Wide_Character'Val (232), Wide_Wide_Character'Val (8709), Wide_Wide_Character'Val (8195), Wide_Wide_Character'Val (8194), Wide_Wide_Character'Val (949), Wide_Wide_Character'Val (8801), Wide_Wide_Character'Val (951), Wide_Wide_Character'Val (240), Wide_Wide_Character'Val (235), Wide_Wide_Character'Val (8364), Wide_Wide_Character'Val (8707), Wide_Wide_Character'Val (402), Wide_Wide_Character'Val (8704), Wide_Wide_Character'Val (189), Wide_Wide_Character'Val (188), Wide_Wide_Character'Val (190), Wide_Wide_Character'Val (8260), Wide_Wide_Character'Val (947), Wide_Wide_Character'Val (8805), Wide_Wide_Character'Val (62), Wide_Wide_Character'Val (8660), Wide_Wide_Character'Val (8596), Wide_Wide_Character'Val (9829), Wide_Wide_Character'Val (8230), Wide_Wide_Character'Val (237), Wide_Wide_Character'Val (238), Wide_Wide_Character'Val (161), Wide_Wide_Character'Val (236), Wide_Wide_Character'Val (8465), Wide_Wide_Character'Val (8734), Wide_Wide_Character'Val (8747), Wide_Wide_Character'Val (953), Wide_Wide_Character'Val (191), Wide_Wide_Character'Val (8712), Wide_Wide_Character'Val (239), Wide_Wide_Character'Val (954), Wide_Wide_Character'Val (8656), Wide_Wide_Character'Val (955), Wide_Wide_Character'Val (9001), Wide_Wide_Character'Val (171), Wide_Wide_Character'Val (8592), Wide_Wide_Character'Val (8968), Wide_Wide_Character'Val (8220), Wide_Wide_Character'Val (8804), Wide_Wide_Character'Val (8970), Wide_Wide_Character'Val (8727), Wide_Wide_Character'Val (9674), Wide_Wide_Character'Val (8206), Wide_Wide_Character'Val (8249), Wide_Wide_Character'Val (8216), Wide_Wide_Character'Val (60), Wide_Wide_Character'Val (175), Wide_Wide_Character'Val (8212), Wide_Wide_Character'Val (181), Wide_Wide_Character'Val (183), Wide_Wide_Character'Val (8722), Wide_Wide_Character'Val (956), Wide_Wide_Character'Val (8711), Wide_Wide_Character'Val (160), Wide_Wide_Character'Val (8211), Wide_Wide_Character'Val (8800), Wide_Wide_Character'Val (8715), Wide_Wide_Character'Val (172), Wide_Wide_Character'Val (8713), Wide_Wide_Character'Val (8836), Wide_Wide_Character'Val (241), Wide_Wide_Character'Val (957), Wide_Wide_Character'Val (243), Wide_Wide_Character'Val (244), Wide_Wide_Character'Val (339), Wide_Wide_Character'Val (242), Wide_Wide_Character'Val (8254), Wide_Wide_Character'Val (969), Wide_Wide_Character'Val (959), Wide_Wide_Character'Val (8853), Wide_Wide_Character'Val (8744), Wide_Wide_Character'Val (170), Wide_Wide_Character'Val (186), Wide_Wide_Character'Val (248), Wide_Wide_Character'Val (245), Wide_Wide_Character'Val (8855), Wide_Wide_Character'Val (246), Wide_Wide_Character'Val (182), Wide_Wide_Character'Val (8706), Wide_Wide_Character'Val (8240), Wide_Wide_Character'Val (8869), Wide_Wide_Character'Val (966), Wide_Wide_Character'Val (960), Wide_Wide_Character'Val (982), Wide_Wide_Character'Val (177), Wide_Wide_Character'Val (163), Wide_Wide_Character'Val (8242), Wide_Wide_Character'Val (8719), Wide_Wide_Character'Val (8733), Wide_Wide_Character'Val (968), Wide_Wide_Character'Val (34), Wide_Wide_Character'Val (8658), Wide_Wide_Character'Val (8730), Wide_Wide_Character'Val (9002), Wide_Wide_Character'Val (187), Wide_Wide_Character'Val (8594), Wide_Wide_Character'Val (8969), Wide_Wide_Character'Val (8221), Wide_Wide_Character'Val (8476), Wide_Wide_Character'Val (174), Wide_Wide_Character'Val (8971), Wide_Wide_Character'Val (961), Wide_Wide_Character'Val (8207), Wide_Wide_Character'Val (8250), Wide_Wide_Character'Val (8217), Wide_Wide_Character'Val (8218), Wide_Wide_Character'Val (353), Wide_Wide_Character'Val (8901), Wide_Wide_Character'Val (167), Wide_Wide_Character'Val (173), Wide_Wide_Character'Val (963), Wide_Wide_Character'Val (962), Wide_Wide_Character'Val (8764), Wide_Wide_Character'Val (9824), Wide_Wide_Character'Val (8834), Wide_Wide_Character'Val (8838), Wide_Wide_Character'Val (8721), Wide_Wide_Character'Val (8835), Wide_Wide_Character'Val (185), Wide_Wide_Character'Val (178), Wide_Wide_Character'Val (179), Wide_Wide_Character'Val (8839), Wide_Wide_Character'Val (223), Wide_Wide_Character'Val (964), Wide_Wide_Character'Val (8756), Wide_Wide_Character'Val (952), Wide_Wide_Character'Val (977), Wide_Wide_Character'Val (8201), Wide_Wide_Character'Val (254), Wide_Wide_Character'Val (732), Wide_Wide_Character'Val (215), Wide_Wide_Character'Val (8482), Wide_Wide_Character'Val (8657), Wide_Wide_Character'Val (250), Wide_Wide_Character'Val (8593), Wide_Wide_Character'Val (251), Wide_Wide_Character'Val (249), Wide_Wide_Character'Val (168), Wide_Wide_Character'Val (978), Wide_Wide_Character'Val (965), Wide_Wide_Character'Val (252), Wide_Wide_Character'Val (8472), Wide_Wide_Character'Val (958), Wide_Wide_Character'Val (253), Wide_Wide_Character'Val (165), Wide_Wide_Character'Val (255), Wide_Wide_Character'Val (950), Wide_Wide_Character'Val (8205), Wide_Wide_Character'Val (8204)); end Wiki.Parsers.Html.Entities;
11338
-- Generated by gen-ada-entities.pl latin1.ent symbol.ent special.ent private package Wiki.Parsers.Html.Entities is pragma Preelaborate; AELIG_NAME : aliased constant String := "AElig"; AACUTE_NAME : aliased constant String := "Aacute"; ACIRC_NAME : aliased constant String := "Acirc"; AGRAVE_NAME : aliased constant String := "Agrave"; ALPHA_NAME : aliased constant String := "Alpha"; ARING_NAME : aliased constant String := "Aring"; ATILDE_NAME : aliased constant String := "Atilde"; AUML_NAME : aliased constant String := "Auml"; BETA_NAME : aliased constant String := "Beta"; CCEDIL_NAME : aliased constant String := "Ccedil"; CHI_NAME : aliased constant String := "Chi"; DAGGER_NAME : aliased constant String := "Dagger"; DELTA_NAME : aliased constant String := "Delta"; ETH_NAME : aliased constant String := "ETH"; EACUTE_NAME : aliased constant String := "Eacute"; ECIRC_NAME : aliased constant String := "Ecirc"; EGRAVE_NAME : aliased constant String := "Egrave"; EPSILON_NAME : aliased constant String := "Epsilon"; ETA_NAME : aliased constant String := "Eta"; EUML_NAME : aliased constant String := "Euml"; GAMMA_NAME : aliased constant String := "Gamma"; IACUTE_NAME : aliased constant String := "Iacute"; ICIRC_NAME : aliased constant String := "Icirc"; IGRAVE_NAME : aliased constant String := "Igrave"; IOTA_NAME : aliased constant String := "Iota"; IUML_NAME : aliased constant String := "Iuml"; KAPPA_NAME : aliased constant String := "Kappa"; LAMBDA_NAME : aliased constant String := "Lambda"; MU_NAME : aliased constant String := "Mu"; NTILDE_NAME : aliased constant String := "Ntilde"; NU_NAME : aliased constant String := "Nu"; OELIG_NAME : aliased constant String := "OElig"; OACUTE_NAME : aliased constant String := "Oacute"; OCIRC_NAME : aliased constant String := "Ocirc"; OGRAVE_NAME : aliased constant String := "Ograve"; OMEGA_NAME : aliased constant String := "Omega"; OMICRON_NAME : aliased constant String := "Omicron"; OSLASH_NAME : aliased constant String := "Oslash"; OTILDE_NAME : aliased constant String := "Otilde"; OUML_NAME : aliased constant String := "Ouml"; PHI_NAME : aliased constant String := "Phi"; PI_NAME : aliased constant String := "Pi"; PRIME_NAME : aliased constant String := "Prime"; PSI_NAME : aliased constant String := "Psi"; RHO_NAME : aliased constant String := "Rho"; SCARON_NAME : aliased constant String := "<NAME>"; SIGMA_NAME : aliased constant String := "Sigma"; THORN_NAME : aliased constant String := "THORN"; TAU_NAME : aliased constant String := "Tau"; THETA_NAME : aliased constant String := "Theta"; UACUTE_NAME : aliased constant String := "Uacute"; UCIRC_NAME : aliased constant String := "Ucirc"; UGRAVE_NAME : aliased constant String := "Ugrave"; UPSILON_NAME : aliased constant String := "Upsilon"; UUML_NAME : aliased constant String := "Uuml"; XI_NAME : aliased constant String := "Xi"; YACUTE_NAME : aliased constant String := "Yacute"; YUML_NAME : aliased constant String := "Yuml"; ZETA_NAME : aliased constant String := "Zeta"; N59_NAME : aliased constant String := "aacute"; N60_NAME : aliased constant String := "acirc"; ACUTE_NAME : aliased constant String := "acute"; N62_NAME : aliased constant String := "aelig"; N63_NAME : aliased constant String := "agrave"; ALEFSYM_NAME : aliased constant String := "alefsym"; N65_NAME : aliased constant String := "alpha"; AMP_NAME : aliased constant String := "amp"; AND_NAME : aliased constant String := "and"; ANG_NAME : aliased constant String := "ang"; APOS_NAME : aliased constant String := "apos"; N70_NAME : aliased constant String := "aring"; ASYMP_NAME : aliased constant String := "asymp"; N72_NAME : aliased constant String := "atilde"; N73_NAME : aliased constant String := "auml"; BDQUO_NAME : aliased constant String := "bdquo"; N75_NAME : aliased constant String := "beta"; BRVBAR_NAME : aliased constant String := "brvbar"; BULL_NAME : aliased constant String := "bull"; CAP_NAME : aliased constant String := "cap"; N79_NAME : aliased constant String := "ccedil"; CEDIL_NAME : aliased constant String := "cedil"; CENT_NAME : aliased constant String := "cent"; N82_NAME : aliased constant String := "chi"; CIRC_NAME : aliased constant String := "circ"; CLUBS_NAME : aliased constant String := "clubs"; CONG_NAME : aliased constant String := "cong"; COPY_NAME : aliased constant String := "copy"; CRARR_NAME : aliased constant String := "crarr"; CUP_NAME : aliased constant String := "cup"; CURREN_NAME : aliased constant String := "curren"; DARR_NAME : aliased constant String := "dArr"; N91_NAME : aliased constant String := "dagger"; N92_NAME : aliased constant String := "darr"; DEG_NAME : aliased constant String := "deg"; N94_NAME : aliased constant String := "delta"; DIAMS_NAME : aliased constant String := "diams"; DIVIDE_NAME : aliased constant String := "divide"; N97_NAME : aliased constant String := "eacute"; N98_NAME : aliased constant String := "ecirc"; N99_NAME : aliased constant String := "egrave"; EMPTY_NAME : aliased constant String := "empty"; EMSP_NAME : aliased constant String := "emsp"; ENSP_NAME : aliased constant String := "ensp"; N103_NAME : aliased constant String := "epsilon"; EQUIV_NAME : aliased constant String := "equiv"; N105_NAME : aliased constant String := "eta"; N106_NAME : aliased constant String := "eth"; N107_NAME : aliased constant String := "euml"; EURO_NAME : aliased constant String := "euro"; EXIST_NAME : aliased constant String := "exist"; FNOF_NAME : aliased constant String := "fnof"; FORALL_NAME : aliased constant String := "forall"; FRAC12_NAME : aliased constant String := "frac12"; FRAC14_NAME : aliased constant String := "frac14"; FRAC34_NAME : aliased constant String := "frac34"; FRASL_NAME : aliased constant String := "frasl"; N116_NAME : aliased constant String := "gamma"; GE_NAME : aliased constant String := "ge"; GT_NAME : aliased constant String := "gt"; HARR_NAME : aliased constant String := "hArr"; N120_NAME : aliased constant String := "harr"; HEARTS_NAME : aliased constant String := "hearts"; HELLIP_NAME : aliased constant String := "hellip"; N123_NAME : aliased constant String := "iacute"; N124_NAME : aliased constant String := "icirc"; IEXCL_NAME : aliased constant String := "iexcl"; N126_NAME : aliased constant String := "igrave"; IMAGE_NAME : aliased constant String := "image"; INFIN_NAME : aliased constant String := "infin"; INT_NAME : aliased constant String := "int"; N130_NAME : aliased constant String := "iota"; IQUEST_NAME : aliased constant String := "iquest"; ISIN_NAME : aliased constant String := "isin"; N133_NAME : aliased constant String := "iuml"; N134_NAME : aliased constant String := "kappa"; LARR_NAME : aliased constant String := "lArr"; N136_NAME : aliased constant String := "lambda"; LANG_NAME : aliased constant String := "lang"; LAQUO_NAME : aliased constant String := "laquo"; N139_NAME : aliased constant String := "larr"; LCEIL_NAME : aliased constant String := "lceil"; LDQUO_NAME : aliased constant String := "ldquo"; LE_NAME : aliased constant String := "le"; LFLOOR_NAME : aliased constant String := "lfloor"; LOWAST_NAME : aliased constant String := "lowast"; LOZ_NAME : aliased constant String := "loz"; LRM_NAME : aliased constant String := "lrm"; LSAQUO_NAME : aliased constant String := "lsaquo"; LSQUO_NAME : aliased constant String := "lsquo"; LT_NAME : aliased constant String := "lt"; MACR_NAME : aliased constant String := "macr"; MDASH_NAME : aliased constant String := "mdash"; MICRO_NAME : aliased constant String := "micro"; MIDDOT_NAME : aliased constant String := "middot"; MINUS_NAME : aliased constant String := "minus"; N155_NAME : aliased constant String := "mu"; NABLA_NAME : aliased constant String := "nabla"; NBSP_NAME : aliased constant String := "nbsp"; NDASH_NAME : aliased constant String := "ndash"; NE_NAME : aliased constant String := "ne"; NI_NAME : aliased constant String := "ni"; NOT_NAME : aliased constant String := "not"; NOTIN_NAME : aliased constant String := "notin"; NSUB_NAME : aliased constant String := "nsub"; N164_NAME : aliased constant String := "ntilde"; N165_NAME : aliased constant String := "nu"; N166_NAME : aliased constant String := "oacute"; N167_NAME : aliased constant String := "ocirc"; N168_NAME : aliased constant String := "oelig"; N169_NAME : aliased constant String := "ograve"; OLINE_NAME : aliased constant String := "oline"; N171_NAME : aliased constant String := "omega"; N172_NAME : aliased constant String := "omicron"; OPLUS_NAME : aliased constant String := "oplus"; OR_NAME : aliased constant String := "or"; ORDF_NAME : aliased constant String := "ordf"; ORDM_NAME : aliased constant String := "ordm"; N177_NAME : aliased constant String := "oslash"; N178_NAME : aliased constant String := "otilde"; OTIMES_NAME : aliased constant String := "otimes"; N180_NAME : aliased constant String := "ouml"; PARA_NAME : aliased constant String := "para"; PART_NAME : aliased constant String := "part"; PERMIL_NAME : aliased constant String := "permil"; PERP_NAME : aliased constant String := "perp"; N185_NAME : aliased constant String := "phi"; N186_NAME : aliased constant String := "pi"; PIV_NAME : aliased constant String := "piv"; PLUSMN_NAME : aliased constant String := "plusmn"; POUND_NAME : aliased constant String := "pound"; N190_NAME : aliased constant String := "prime"; PROD_NAME : aliased constant String := "prod"; PROP_NAME : aliased constant String := "prop"; N193_NAME : aliased constant String := "psi"; QUOT_NAME : aliased constant String := "quot"; RARR_NAME : aliased constant String := "rArr"; RADIC_NAME : aliased constant String := "radic"; RANG_NAME : aliased constant String := "rang"; RAQUO_NAME : aliased constant String := "raquo"; N199_NAME : aliased constant String := "rarr"; RCEIL_NAME : aliased constant String := "rceil"; RDQUO_NAME : aliased constant String := "rdquo"; REAL_NAME : aliased constant String := "real"; REG_NAME : aliased constant String := "reg"; RFLOOR_NAME : aliased constant String := "rfloor"; N205_NAME : aliased constant String := "rho"; RLM_NAME : aliased constant String := "rlm"; RSAQUO_NAME : aliased constant String := "rsaquo"; RSQUO_NAME : aliased constant String := "rsquo"; SBQUO_NAME : aliased constant String := "sbquo"; N210_NAME : aliased constant String := "<NAME>"; SDOT_NAME : aliased constant String := "sdot"; SECT_NAME : aliased constant String := "sect"; SHY_NAME : aliased constant String := "shy"; N214_NAME : aliased constant String := "sigma"; SIGMAF_NAME : aliased constant String := "sigmaf"; SIM_NAME : aliased constant String := "sim"; SPADES_NAME : aliased constant String := "spades"; SUB_NAME : aliased constant String := "sub"; SUBE_NAME : aliased constant String := "sube"; SUM_NAME : aliased constant String := "sum"; SUP_NAME : aliased constant String := "sup"; SUP1_NAME : aliased constant String := "sup1"; SUP2_NAME : aliased constant String := "sup2"; SUP3_NAME : aliased constant String := "sup3"; SUPE_NAME : aliased constant String := "supe"; SZLIG_NAME : aliased constant String := "szlig"; N227_NAME : aliased constant String := "tau"; THERE4_NAME : aliased constant String := "there4"; N229_NAME : aliased constant String := "theta"; THETASYM_NAME : aliased constant String := "thetasym"; THINSP_NAME : aliased constant String := "thinsp"; N232_NAME : aliased constant String := "thorn"; TILDE_NAME : aliased constant String := "tilde"; TIMES_NAME : aliased constant String := "times"; TRADE_NAME : aliased constant String := "trade"; UARR_NAME : aliased constant String := "uArr"; N237_NAME : aliased constant String := "uacute"; N238_NAME : aliased constant String := "uarr"; N239_NAME : aliased constant String := "ucirc"; N240_NAME : aliased constant String := "ugrave"; UML_NAME : aliased constant String := "uml"; UPSIH_NAME : aliased constant String := "upsih"; N243_NAME : aliased constant String := "upsilon"; N244_NAME : aliased constant String := "uuml"; WEIERP_NAME : aliased constant String := "weierp"; N246_NAME : aliased constant String := "xi"; N247_NAME : aliased constant String := "yacute"; YEN_NAME : aliased constant String := "yen"; N249_NAME : aliased constant String := "yuml"; N250_NAME : aliased constant String := "zeta"; ZWJ_NAME : aliased constant String := "zwj"; ZWNJ_NAME : aliased constant String := "zwnj"; type String_Access is access constant String; type Keyword_Array is array (Positive range 1 .. 253) of String_Access; type Char_Array is array (Positive range 1 .. 253) of Wide_Wide_Character; Keywords : constant Keyword_Array := ( AELIG_NAME'Access, AACUTE_NAME'Access, ACIRC_NAME'Access, AGRAVE_NAME'Access, ALPHA_NAME'Access, ARING_NAME'Access, ATILDE_NAME'Access, AUML_NAME'Access, BETA_NAME'Access, CCEDIL_NAME'Access, CHI_NAME'Access, DAGGER_NAME'Access, DELTA_NAME'Access, ETH_NAME'Access, EACUTE_NAME'Access, ECIRC_NAME'Access, EGRAVE_NAME'Access, EPSILON_NAME'Access, ETA_NAME'Access, EUML_NAME'Access, GAMMA_NAME'Access, IACUTE_NAME'Access, ICIRC_NAME'Access, IGRAVE_NAME'Access, IOTA_NAME'Access, IUML_NAME'Access, KAPPA_NAME'Access, LAMBDA_NAME'Access, MU_NAME'Access, NTILDE_NAME'Access, NU_NAME'Access, OELIG_NAME'Access, OACUTE_NAME'Access, OCIRC_NAME'Access, OGRAVE_NAME'Access, OMEGA_NAME'Access, OMICRON_NAME'Access, OSLASH_NAME'Access, OTILDE_NAME'Access, OUML_NAME'Access, PHI_NAME'Access, PI_NAME'Access, PRIME_NAME'Access, PSI_NAME'Access, RHO_NAME'Access, SCARON_NAME'Access, SIGMA_NAME'Access, THORN_NAME'Access, TAU_NAME'Access, THETA_NAME'Access, UACUTE_NAME'Access, UCIRC_NAME'Access, UGRAVE_NAME'Access, UPSILON_NAME'Access, UUML_NAME'Access, XI_NAME'Access, YACUTE_NAME'Access, YUML_NAME'Access, ZETA_NAME'Access, N59_NAME'Access, N60_NAME'Access, ACUTE_NAME'Access, N62_NAME'Access, N63_NAME'Access, ALEFSYM_NAME'Access, N65_NAME'Access, AMP_NAME'Access, AND_NAME'Access, ANG_NAME'Access, APOS_NAME'Access, N70_NAME'Access, ASYMP_NAME'Access, N72_NAME'Access, N73_NAME'Access, BDQUO_NAME'Access, N75_NAME'Access, BRVBAR_NAME'Access, BULL_NAME'Access, CAP_NAME'Access, N79_NAME'Access, CEDIL_NAME'Access, CENT_NAME'Access, N82_NAME'Access, CIRC_NAME'Access, CLUBS_NAME'Access, CONG_NAME'Access, COPY_NAME'Access, CRARR_NAME'Access, CUP_NAME'Access, CURREN_NAME'Access, DARR_NAME'Access, N91_NAME'Access, N92_NAME'Access, DEG_NAME'Access, N94_NAME'Access, DIAMS_NAME'Access, DIVIDE_NAME'Access, N97_NAME'Access, N98_NAME'Access, N99_NAME'Access, EMPTY_NAME'Access, EMSP_NAME'Access, ENSP_NAME'Access, N103_NAME'Access, EQUIV_NAME'Access, N105_NAME'Access, N106_NAME'Access, N107_NAME'Access, EURO_NAME'Access, EXIST_NAME'Access, FNOF_NAME'Access, FORALL_NAME'Access, FRAC12_NAME'Access, FRAC14_NAME'Access, FRAC34_NAME'Access, FRASL_NAME'Access, N116_NAME'Access, GE_NAME'Access, GT_NAME'Access, HARR_NAME'Access, N120_NAME'Access, HEARTS_NAME'Access, HELLIP_NAME'Access, N123_NAME'Access, N124_NAME'Access, IEXCL_NAME'Access, N126_NAME'Access, IMAGE_NAME'Access, INFIN_NAME'Access, INT_NAME'Access, N130_NAME'Access, IQUEST_NAME'Access, ISIN_NAME'Access, N133_NAME'Access, N134_NAME'Access, LARR_NAME'Access, N136_NAME'Access, LANG_NAME'Access, LAQUO_NAME'Access, N139_NAME'Access, LCEIL_NAME'Access, LDQUO_NAME'Access, LE_NAME'Access, LFLOOR_NAME'Access, LOWAST_NAME'Access, LOZ_NAME'Access, LRM_NAME'Access, LSAQUO_NAME'Access, LSQUO_NAME'Access, LT_NAME'Access, MACR_NAME'Access, MDASH_NAME'Access, MICRO_NAME'Access, MIDDOT_NAME'Access, MINUS_NAME'Access, N155_NAME'Access, NABLA_NAME'Access, NBSP_NAME'Access, NDASH_NAME'Access, NE_NAME'Access, NI_NAME'Access, NOT_NAME'Access, NOTIN_NAME'Access, NSUB_NAME'Access, N164_NAME'Access, N165_NAME'Access, N166_NAME'Access, N167_NAME'Access, N168_NAME'Access, N169_NAME'Access, OLINE_NAME'Access, N171_NAME'Access, N172_NAME'Access, OPLUS_NAME'Access, OR_NAME'Access, ORDF_NAME'Access, ORDM_NAME'Access, N177_NAME'Access, N178_NAME'Access, OTIMES_NAME'Access, N180_NAME'Access, PARA_NAME'Access, PART_NAME'Access, PERMIL_NAME'Access, PERP_NAME'Access, N185_NAME'Access, N186_NAME'Access, PIV_NAME'Access, PLUSMN_NAME'Access, POUND_NAME'Access, N190_NAME'Access, PROD_NAME'Access, PROP_NAME'Access, N193_NAME'Access, QUOT_NAME'Access, RARR_NAME'Access, RADIC_NAME'Access, RANG_NAME'Access, RAQUO_NAME'Access, N199_NAME'Access, RCEIL_NAME'Access, RDQUO_NAME'Access, REAL_NAME'Access, REG_NAME'Access, RFLOOR_NAME'Access, N205_NAME'Access, RLM_NAME'Access, RSAQUO_NAME'Access, RSQUO_NAME'Access, SBQUO_NAME'Access, N210_NAME'Access, SDOT_NAME'Access, SECT_NAME'Access, SHY_NAME'Access, N214_NAME'Access, SIGMAF_NAME'Access, SIM_NAME'Access, SPADES_NAME'Access, SUB_NAME'Access, SUBE_NAME'Access, SUM_NAME'Access, SUP_NAME'Access, SUP1_NAME'Access, SUP2_NAME'Access, SUP3_NAME'Access, SUPE_NAME'Access, SZLIG_NAME'Access, N227_NAME'Access, THERE4_NAME'Access, N229_NAME'Access, THETASYM_NAME'Access, THINSP_NAME'Access, N232_NAME'Access, TILDE_NAME'Access, TIMES_NAME'Access, TRADE_NAME'Access, UARR_NAME'Access, N237_NAME'Access, N238_NAME'Access, N239_NAME'Access, N240_NAME'Access, UML_NAME'Access, UPSIH_NAME'Access, N243_NAME'Access, N244_NAME'Access, WEIERP_NAME'Access, N246_NAME'Access, N247_NAME'Access, YEN_NAME'Access, N249_NAME'Access, N250_NAME'Access, ZWJ_NAME'Access, ZWNJ_NAME'Access); Mapping : constant Char_Array := ( Wide_Wide_Character'Val (198), Wide_Wide_Character'Val (193), Wide_Wide_Character'Val (194), Wide_Wide_Character'Val (192), Wide_Wide_Character'Val (913), Wide_Wide_Character'Val (197), Wide_Wide_Character'Val (195), Wide_Wide_Character'Val (196), Wide_Wide_Character'Val (914), Wide_Wide_Character'Val (199), Wide_Wide_Character'Val (935), Wide_Wide_Character'Val (8225), Wide_Wide_Character'Val (916), Wide_Wide_Character'Val (208), Wide_Wide_Character'Val (201), Wide_Wide_Character'Val (202), Wide_Wide_Character'Val (200), Wide_Wide_Character'Val (917), Wide_Wide_Character'Val (919), Wide_Wide_Character'Val (203), Wide_Wide_Character'Val (915), Wide_Wide_Character'Val (205), Wide_Wide_Character'Val (206), Wide_Wide_Character'Val (204), Wide_Wide_Character'Val (921), Wide_Wide_Character'Val (207), Wide_Wide_Character'Val (922), Wide_Wide_Character'Val (923), Wide_Wide_Character'Val (924), Wide_Wide_Character'Val (209), Wide_Wide_Character'Val (925), Wide_Wide_Character'Val (338), Wide_Wide_Character'Val (211), Wide_Wide_Character'Val (212), Wide_Wide_Character'Val (210), Wide_Wide_Character'Val (937), Wide_Wide_Character'Val (927), Wide_Wide_Character'Val (216), Wide_Wide_Character'Val (213), Wide_Wide_Character'Val (214), Wide_Wide_Character'Val (934), Wide_Wide_Character'Val (928), Wide_Wide_Character'Val (8243), Wide_Wide_Character'Val (936), Wide_Wide_Character'Val (929), Wide_Wide_Character'Val (352), Wide_Wide_Character'Val (931), Wide_Wide_Character'Val (222), Wide_Wide_Character'Val (932), Wide_Wide_Character'Val (920), Wide_Wide_Character'Val (218), Wide_Wide_Character'Val (219), Wide_Wide_Character'Val (217), Wide_Wide_Character'Val (933), Wide_Wide_Character'Val (220), Wide_Wide_Character'Val (926), Wide_Wide_Character'Val (221), Wide_Wide_Character'Val (376), Wide_Wide_Character'Val (918), Wide_Wide_Character'Val (225), Wide_Wide_Character'Val (226), Wide_Wide_Character'Val (180), Wide_Wide_Character'Val (230), Wide_Wide_Character'Val (224), Wide_Wide_Character'Val (8501), Wide_Wide_Character'Val (945), Wide_Wide_Character'Val (38), Wide_Wide_Character'Val (8743), Wide_Wide_Character'Val (8736), Wide_Wide_Character'Val (39), Wide_Wide_Character'Val (229), Wide_Wide_Character'Val (8776), Wide_Wide_Character'Val (227), Wide_Wide_Character'Val (228), Wide_Wide_Character'Val (8222), Wide_Wide_Character'Val (946), Wide_Wide_Character'Val (166), Wide_Wide_Character'Val (8226), Wide_Wide_Character'Val (8745), Wide_Wide_Character'Val (231), Wide_Wide_Character'Val (184), Wide_Wide_Character'Val (162), Wide_Wide_Character'Val (967), Wide_Wide_Character'Val (710), Wide_Wide_Character'Val (9827), Wide_Wide_Character'Val (8773), Wide_Wide_Character'Val (169), Wide_Wide_Character'Val (8629), Wide_Wide_Character'Val (8746), Wide_Wide_Character'Val (164), Wide_Wide_Character'Val (8659), Wide_Wide_Character'Val (8224), Wide_Wide_Character'Val (8595), Wide_Wide_Character'Val (176), Wide_Wide_Character'Val (948), Wide_Wide_Character'Val (9830), Wide_Wide_Character'Val (247), Wide_Wide_Character'Val (233), Wide_Wide_Character'Val (234), Wide_Wide_Character'Val (232), Wide_Wide_Character'Val (8709), Wide_Wide_Character'Val (8195), Wide_Wide_Character'Val (8194), Wide_Wide_Character'Val (949), Wide_Wide_Character'Val (8801), Wide_Wide_Character'Val (951), Wide_Wide_Character'Val (240), Wide_Wide_Character'Val (235), Wide_Wide_Character'Val (8364), Wide_Wide_Character'Val (8707), Wide_Wide_Character'Val (402), Wide_Wide_Character'Val (8704), Wide_Wide_Character'Val (189), Wide_Wide_Character'Val (188), Wide_Wide_Character'Val (190), Wide_Wide_Character'Val (8260), Wide_Wide_Character'Val (947), Wide_Wide_Character'Val (8805), Wide_Wide_Character'Val (62), Wide_Wide_Character'Val (8660), Wide_Wide_Character'Val (8596), Wide_Wide_Character'Val (9829), Wide_Wide_Character'Val (8230), Wide_Wide_Character'Val (237), Wide_Wide_Character'Val (238), Wide_Wide_Character'Val (161), Wide_Wide_Character'Val (236), Wide_Wide_Character'Val (8465), Wide_Wide_Character'Val (8734), Wide_Wide_Character'Val (8747), Wide_Wide_Character'Val (953), Wide_Wide_Character'Val (191), Wide_Wide_Character'Val (8712), Wide_Wide_Character'Val (239), Wide_Wide_Character'Val (954), Wide_Wide_Character'Val (8656), Wide_Wide_Character'Val (955), Wide_Wide_Character'Val (9001), Wide_Wide_Character'Val (171), Wide_Wide_Character'Val (8592), Wide_Wide_Character'Val (8968), Wide_Wide_Character'Val (8220), Wide_Wide_Character'Val (8804), Wide_Wide_Character'Val (8970), Wide_Wide_Character'Val (8727), Wide_Wide_Character'Val (9674), Wide_Wide_Character'Val (8206), Wide_Wide_Character'Val (8249), Wide_Wide_Character'Val (8216), Wide_Wide_Character'Val (60), Wide_Wide_Character'Val (175), Wide_Wide_Character'Val (8212), Wide_Wide_Character'Val (181), Wide_Wide_Character'Val (183), Wide_Wide_Character'Val (8722), Wide_Wide_Character'Val (956), Wide_Wide_Character'Val (8711), Wide_Wide_Character'Val (160), Wide_Wide_Character'Val (8211), Wide_Wide_Character'Val (8800), Wide_Wide_Character'Val (8715), Wide_Wide_Character'Val (172), Wide_Wide_Character'Val (8713), Wide_Wide_Character'Val (8836), Wide_Wide_Character'Val (241), Wide_Wide_Character'Val (957), Wide_Wide_Character'Val (243), Wide_Wide_Character'Val (244), Wide_Wide_Character'Val (339), Wide_Wide_Character'Val (242), Wide_Wide_Character'Val (8254), Wide_Wide_Character'Val (969), Wide_Wide_Character'Val (959), Wide_Wide_Character'Val (8853), Wide_Wide_Character'Val (8744), Wide_Wide_Character'Val (170), Wide_Wide_Character'Val (186), Wide_Wide_Character'Val (248), Wide_Wide_Character'Val (245), Wide_Wide_Character'Val (8855), Wide_Wide_Character'Val (246), Wide_Wide_Character'Val (182), Wide_Wide_Character'Val (8706), Wide_Wide_Character'Val (8240), Wide_Wide_Character'Val (8869), Wide_Wide_Character'Val (966), Wide_Wide_Character'Val (960), Wide_Wide_Character'Val (982), Wide_Wide_Character'Val (177), Wide_Wide_Character'Val (163), Wide_Wide_Character'Val (8242), Wide_Wide_Character'Val (8719), Wide_Wide_Character'Val (8733), Wide_Wide_Character'Val (968), Wide_Wide_Character'Val (34), Wide_Wide_Character'Val (8658), Wide_Wide_Character'Val (8730), Wide_Wide_Character'Val (9002), Wide_Wide_Character'Val (187), Wide_Wide_Character'Val (8594), Wide_Wide_Character'Val (8969), Wide_Wide_Character'Val (8221), Wide_Wide_Character'Val (8476), Wide_Wide_Character'Val (174), Wide_Wide_Character'Val (8971), Wide_Wide_Character'Val (961), Wide_Wide_Character'Val (8207), Wide_Wide_Character'Val (8250), Wide_Wide_Character'Val (8217), Wide_Wide_Character'Val (8218), Wide_Wide_Character'Val (353), Wide_Wide_Character'Val (8901), Wide_Wide_Character'Val (167), Wide_Wide_Character'Val (173), Wide_Wide_Character'Val (963), Wide_Wide_Character'Val (962), Wide_Wide_Character'Val (8764), Wide_Wide_Character'Val (9824), Wide_Wide_Character'Val (8834), Wide_Wide_Character'Val (8838), Wide_Wide_Character'Val (8721), Wide_Wide_Character'Val (8835), Wide_Wide_Character'Val (185), Wide_Wide_Character'Val (178), Wide_Wide_Character'Val (179), Wide_Wide_Character'Val (8839), Wide_Wide_Character'Val (223), Wide_Wide_Character'Val (964), Wide_Wide_Character'Val (8756), Wide_Wide_Character'Val (952), Wide_Wide_Character'Val (977), Wide_Wide_Character'Val (8201), Wide_Wide_Character'Val (254), Wide_Wide_Character'Val (732), Wide_Wide_Character'Val (215), Wide_Wide_Character'Val (8482), Wide_Wide_Character'Val (8657), Wide_Wide_Character'Val (250), Wide_Wide_Character'Val (8593), Wide_Wide_Character'Val (251), Wide_Wide_Character'Val (249), Wide_Wide_Character'Val (168), Wide_Wide_Character'Val (978), Wide_Wide_Character'Val (965), Wide_Wide_Character'Val (252), Wide_Wide_Character'Val (8472), Wide_Wide_Character'Val (958), Wide_Wide_Character'Val (253), Wide_Wide_Character'Val (165), Wide_Wide_Character'Val (255), Wide_Wide_Character'Val (950), Wide_Wide_Character'Val (8205), Wide_Wide_Character'Val (8204)); end Wiki.Parsers.Html.Entities;
true
-- Generated by gen-ada-entities.pl latin1.ent symbol.ent special.ent private package Wiki.Parsers.Html.Entities is pragma Preelaborate; AELIG_NAME : aliased constant String := "AElig"; AACUTE_NAME : aliased constant String := "Aacute"; ACIRC_NAME : aliased constant String := "Acirc"; AGRAVE_NAME : aliased constant String := "Agrave"; ALPHA_NAME : aliased constant String := "Alpha"; ARING_NAME : aliased constant String := "Aring"; ATILDE_NAME : aliased constant String := "Atilde"; AUML_NAME : aliased constant String := "Auml"; BETA_NAME : aliased constant String := "Beta"; CCEDIL_NAME : aliased constant String := "Ccedil"; CHI_NAME : aliased constant String := "Chi"; DAGGER_NAME : aliased constant String := "Dagger"; DELTA_NAME : aliased constant String := "Delta"; ETH_NAME : aliased constant String := "ETH"; EACUTE_NAME : aliased constant String := "Eacute"; ECIRC_NAME : aliased constant String := "Ecirc"; EGRAVE_NAME : aliased constant String := "Egrave"; EPSILON_NAME : aliased constant String := "Epsilon"; ETA_NAME : aliased constant String := "Eta"; EUML_NAME : aliased constant String := "Euml"; GAMMA_NAME : aliased constant String := "Gamma"; IACUTE_NAME : aliased constant String := "Iacute"; ICIRC_NAME : aliased constant String := "Icirc"; IGRAVE_NAME : aliased constant String := "Igrave"; IOTA_NAME : aliased constant String := "Iota"; IUML_NAME : aliased constant String := "Iuml"; KAPPA_NAME : aliased constant String := "Kappa"; LAMBDA_NAME : aliased constant String := "Lambda"; MU_NAME : aliased constant String := "Mu"; NTILDE_NAME : aliased constant String := "Ntilde"; NU_NAME : aliased constant String := "Nu"; OELIG_NAME : aliased constant String := "OElig"; OACUTE_NAME : aliased constant String := "Oacute"; OCIRC_NAME : aliased constant String := "Ocirc"; OGRAVE_NAME : aliased constant String := "Ograve"; OMEGA_NAME : aliased constant String := "Omega"; OMICRON_NAME : aliased constant String := "Omicron"; OSLASH_NAME : aliased constant String := "Oslash"; OTILDE_NAME : aliased constant String := "Otilde"; OUML_NAME : aliased constant String := "Ouml"; PHI_NAME : aliased constant String := "Phi"; PI_NAME : aliased constant String := "Pi"; PRIME_NAME : aliased constant String := "Prime"; PSI_NAME : aliased constant String := "Psi"; RHO_NAME : aliased constant String := "Rho"; SCARON_NAME : aliased constant String := "PI:NAME:<NAME>END_PI"; SIGMA_NAME : aliased constant String := "Sigma"; THORN_NAME : aliased constant String := "THORN"; TAU_NAME : aliased constant String := "Tau"; THETA_NAME : aliased constant String := "Theta"; UACUTE_NAME : aliased constant String := "Uacute"; UCIRC_NAME : aliased constant String := "Ucirc"; UGRAVE_NAME : aliased constant String := "Ugrave"; UPSILON_NAME : aliased constant String := "Upsilon"; UUML_NAME : aliased constant String := "Uuml"; XI_NAME : aliased constant String := "Xi"; YACUTE_NAME : aliased constant String := "Yacute"; YUML_NAME : aliased constant String := "Yuml"; ZETA_NAME : aliased constant String := "Zeta"; N59_NAME : aliased constant String := "aacute"; N60_NAME : aliased constant String := "acirc"; ACUTE_NAME : aliased constant String := "acute"; N62_NAME : aliased constant String := "aelig"; N63_NAME : aliased constant String := "agrave"; ALEFSYM_NAME : aliased constant String := "alefsym"; N65_NAME : aliased constant String := "alpha"; AMP_NAME : aliased constant String := "amp"; AND_NAME : aliased constant String := "and"; ANG_NAME : aliased constant String := "ang"; APOS_NAME : aliased constant String := "apos"; N70_NAME : aliased constant String := "aring"; ASYMP_NAME : aliased constant String := "asymp"; N72_NAME : aliased constant String := "atilde"; N73_NAME : aliased constant String := "auml"; BDQUO_NAME : aliased constant String := "bdquo"; N75_NAME : aliased constant String := "beta"; BRVBAR_NAME : aliased constant String := "brvbar"; BULL_NAME : aliased constant String := "bull"; CAP_NAME : aliased constant String := "cap"; N79_NAME : aliased constant String := "ccedil"; CEDIL_NAME : aliased constant String := "cedil"; CENT_NAME : aliased constant String := "cent"; N82_NAME : aliased constant String := "chi"; CIRC_NAME : aliased constant String := "circ"; CLUBS_NAME : aliased constant String := "clubs"; CONG_NAME : aliased constant String := "cong"; COPY_NAME : aliased constant String := "copy"; CRARR_NAME : aliased constant String := "crarr"; CUP_NAME : aliased constant String := "cup"; CURREN_NAME : aliased constant String := "curren"; DARR_NAME : aliased constant String := "dArr"; N91_NAME : aliased constant String := "dagger"; N92_NAME : aliased constant String := "darr"; DEG_NAME : aliased constant String := "deg"; N94_NAME : aliased constant String := "delta"; DIAMS_NAME : aliased constant String := "diams"; DIVIDE_NAME : aliased constant String := "divide"; N97_NAME : aliased constant String := "eacute"; N98_NAME : aliased constant String := "ecirc"; N99_NAME : aliased constant String := "egrave"; EMPTY_NAME : aliased constant String := "empty"; EMSP_NAME : aliased constant String := "emsp"; ENSP_NAME : aliased constant String := "ensp"; N103_NAME : aliased constant String := "epsilon"; EQUIV_NAME : aliased constant String := "equiv"; N105_NAME : aliased constant String := "eta"; N106_NAME : aliased constant String := "eth"; N107_NAME : aliased constant String := "euml"; EURO_NAME : aliased constant String := "euro"; EXIST_NAME : aliased constant String := "exist"; FNOF_NAME : aliased constant String := "fnof"; FORALL_NAME : aliased constant String := "forall"; FRAC12_NAME : aliased constant String := "frac12"; FRAC14_NAME : aliased constant String := "frac14"; FRAC34_NAME : aliased constant String := "frac34"; FRASL_NAME : aliased constant String := "frasl"; N116_NAME : aliased constant String := "gamma"; GE_NAME : aliased constant String := "ge"; GT_NAME : aliased constant String := "gt"; HARR_NAME : aliased constant String := "hArr"; N120_NAME : aliased constant String := "harr"; HEARTS_NAME : aliased constant String := "hearts"; HELLIP_NAME : aliased constant String := "hellip"; N123_NAME : aliased constant String := "iacute"; N124_NAME : aliased constant String := "icirc"; IEXCL_NAME : aliased constant String := "iexcl"; N126_NAME : aliased constant String := "igrave"; IMAGE_NAME : aliased constant String := "image"; INFIN_NAME : aliased constant String := "infin"; INT_NAME : aliased constant String := "int"; N130_NAME : aliased constant String := "iota"; IQUEST_NAME : aliased constant String := "iquest"; ISIN_NAME : aliased constant String := "isin"; N133_NAME : aliased constant String := "iuml"; N134_NAME : aliased constant String := "kappa"; LARR_NAME : aliased constant String := "lArr"; N136_NAME : aliased constant String := "lambda"; LANG_NAME : aliased constant String := "lang"; LAQUO_NAME : aliased constant String := "laquo"; N139_NAME : aliased constant String := "larr"; LCEIL_NAME : aliased constant String := "lceil"; LDQUO_NAME : aliased constant String := "ldquo"; LE_NAME : aliased constant String := "le"; LFLOOR_NAME : aliased constant String := "lfloor"; LOWAST_NAME : aliased constant String := "lowast"; LOZ_NAME : aliased constant String := "loz"; LRM_NAME : aliased constant String := "lrm"; LSAQUO_NAME : aliased constant String := "lsaquo"; LSQUO_NAME : aliased constant String := "lsquo"; LT_NAME : aliased constant String := "lt"; MACR_NAME : aliased constant String := "macr"; MDASH_NAME : aliased constant String := "mdash"; MICRO_NAME : aliased constant String := "micro"; MIDDOT_NAME : aliased constant String := "middot"; MINUS_NAME : aliased constant String := "minus"; N155_NAME : aliased constant String := "mu"; NABLA_NAME : aliased constant String := "nabla"; NBSP_NAME : aliased constant String := "nbsp"; NDASH_NAME : aliased constant String := "ndash"; NE_NAME : aliased constant String := "ne"; NI_NAME : aliased constant String := "ni"; NOT_NAME : aliased constant String := "not"; NOTIN_NAME : aliased constant String := "notin"; NSUB_NAME : aliased constant String := "nsub"; N164_NAME : aliased constant String := "ntilde"; N165_NAME : aliased constant String := "nu"; N166_NAME : aliased constant String := "oacute"; N167_NAME : aliased constant String := "ocirc"; N168_NAME : aliased constant String := "oelig"; N169_NAME : aliased constant String := "ograve"; OLINE_NAME : aliased constant String := "oline"; N171_NAME : aliased constant String := "omega"; N172_NAME : aliased constant String := "omicron"; OPLUS_NAME : aliased constant String := "oplus"; OR_NAME : aliased constant String := "or"; ORDF_NAME : aliased constant String := "ordf"; ORDM_NAME : aliased constant String := "ordm"; N177_NAME : aliased constant String := "oslash"; N178_NAME : aliased constant String := "otilde"; OTIMES_NAME : aliased constant String := "otimes"; N180_NAME : aliased constant String := "ouml"; PARA_NAME : aliased constant String := "para"; PART_NAME : aliased constant String := "part"; PERMIL_NAME : aliased constant String := "permil"; PERP_NAME : aliased constant String := "perp"; N185_NAME : aliased constant String := "phi"; N186_NAME : aliased constant String := "pi"; PIV_NAME : aliased constant String := "piv"; PLUSMN_NAME : aliased constant String := "plusmn"; POUND_NAME : aliased constant String := "pound"; N190_NAME : aliased constant String := "prime"; PROD_NAME : aliased constant String := "prod"; PROP_NAME : aliased constant String := "prop"; N193_NAME : aliased constant String := "psi"; QUOT_NAME : aliased constant String := "quot"; RARR_NAME : aliased constant String := "rArr"; RADIC_NAME : aliased constant String := "radic"; RANG_NAME : aliased constant String := "rang"; RAQUO_NAME : aliased constant String := "raquo"; N199_NAME : aliased constant String := "rarr"; RCEIL_NAME : aliased constant String := "rceil"; RDQUO_NAME : aliased constant String := "rdquo"; REAL_NAME : aliased constant String := "real"; REG_NAME : aliased constant String := "reg"; RFLOOR_NAME : aliased constant String := "rfloor"; N205_NAME : aliased constant String := "rho"; RLM_NAME : aliased constant String := "rlm"; RSAQUO_NAME : aliased constant String := "rsaquo"; RSQUO_NAME : aliased constant String := "rsquo"; SBQUO_NAME : aliased constant String := "sbquo"; N210_NAME : aliased constant String := "PI:NAME:<NAME>END_PI"; SDOT_NAME : aliased constant String := "sdot"; SECT_NAME : aliased constant String := "sect"; SHY_NAME : aliased constant String := "shy"; N214_NAME : aliased constant String := "sigma"; SIGMAF_NAME : aliased constant String := "sigmaf"; SIM_NAME : aliased constant String := "sim"; SPADES_NAME : aliased constant String := "spades"; SUB_NAME : aliased constant String := "sub"; SUBE_NAME : aliased constant String := "sube"; SUM_NAME : aliased constant String := "sum"; SUP_NAME : aliased constant String := "sup"; SUP1_NAME : aliased constant String := "sup1"; SUP2_NAME : aliased constant String := "sup2"; SUP3_NAME : aliased constant String := "sup3"; SUPE_NAME : aliased constant String := "supe"; SZLIG_NAME : aliased constant String := "szlig"; N227_NAME : aliased constant String := "tau"; THERE4_NAME : aliased constant String := "there4"; N229_NAME : aliased constant String := "theta"; THETASYM_NAME : aliased constant String := "thetasym"; THINSP_NAME : aliased constant String := "thinsp"; N232_NAME : aliased constant String := "thorn"; TILDE_NAME : aliased constant String := "tilde"; TIMES_NAME : aliased constant String := "times"; TRADE_NAME : aliased constant String := "trade"; UARR_NAME : aliased constant String := "uArr"; N237_NAME : aliased constant String := "uacute"; N238_NAME : aliased constant String := "uarr"; N239_NAME : aliased constant String := "ucirc"; N240_NAME : aliased constant String := "ugrave"; UML_NAME : aliased constant String := "uml"; UPSIH_NAME : aliased constant String := "upsih"; N243_NAME : aliased constant String := "upsilon"; N244_NAME : aliased constant String := "uuml"; WEIERP_NAME : aliased constant String := "weierp"; N246_NAME : aliased constant String := "xi"; N247_NAME : aliased constant String := "yacute"; YEN_NAME : aliased constant String := "yen"; N249_NAME : aliased constant String := "yuml"; N250_NAME : aliased constant String := "zeta"; ZWJ_NAME : aliased constant String := "zwj"; ZWNJ_NAME : aliased constant String := "zwnj"; type String_Access is access constant String; type Keyword_Array is array (Positive range 1 .. 253) of String_Access; type Char_Array is array (Positive range 1 .. 253) of Wide_Wide_Character; Keywords : constant Keyword_Array := ( AELIG_NAME'Access, AACUTE_NAME'Access, ACIRC_NAME'Access, AGRAVE_NAME'Access, ALPHA_NAME'Access, ARING_NAME'Access, ATILDE_NAME'Access, AUML_NAME'Access, BETA_NAME'Access, CCEDIL_NAME'Access, CHI_NAME'Access, DAGGER_NAME'Access, DELTA_NAME'Access, ETH_NAME'Access, EACUTE_NAME'Access, ECIRC_NAME'Access, EGRAVE_NAME'Access, EPSILON_NAME'Access, ETA_NAME'Access, EUML_NAME'Access, GAMMA_NAME'Access, IACUTE_NAME'Access, ICIRC_NAME'Access, IGRAVE_NAME'Access, IOTA_NAME'Access, IUML_NAME'Access, KAPPA_NAME'Access, LAMBDA_NAME'Access, MU_NAME'Access, NTILDE_NAME'Access, NU_NAME'Access, OELIG_NAME'Access, OACUTE_NAME'Access, OCIRC_NAME'Access, OGRAVE_NAME'Access, OMEGA_NAME'Access, OMICRON_NAME'Access, OSLASH_NAME'Access, OTILDE_NAME'Access, OUML_NAME'Access, PHI_NAME'Access, PI_NAME'Access, PRIME_NAME'Access, PSI_NAME'Access, RHO_NAME'Access, SCARON_NAME'Access, SIGMA_NAME'Access, THORN_NAME'Access, TAU_NAME'Access, THETA_NAME'Access, UACUTE_NAME'Access, UCIRC_NAME'Access, UGRAVE_NAME'Access, UPSILON_NAME'Access, UUML_NAME'Access, XI_NAME'Access, YACUTE_NAME'Access, YUML_NAME'Access, ZETA_NAME'Access, N59_NAME'Access, N60_NAME'Access, ACUTE_NAME'Access, N62_NAME'Access, N63_NAME'Access, ALEFSYM_NAME'Access, N65_NAME'Access, AMP_NAME'Access, AND_NAME'Access, ANG_NAME'Access, APOS_NAME'Access, N70_NAME'Access, ASYMP_NAME'Access, N72_NAME'Access, N73_NAME'Access, BDQUO_NAME'Access, N75_NAME'Access, BRVBAR_NAME'Access, BULL_NAME'Access, CAP_NAME'Access, N79_NAME'Access, CEDIL_NAME'Access, CENT_NAME'Access, N82_NAME'Access, CIRC_NAME'Access, CLUBS_NAME'Access, CONG_NAME'Access, COPY_NAME'Access, CRARR_NAME'Access, CUP_NAME'Access, CURREN_NAME'Access, DARR_NAME'Access, N91_NAME'Access, N92_NAME'Access, DEG_NAME'Access, N94_NAME'Access, DIAMS_NAME'Access, DIVIDE_NAME'Access, N97_NAME'Access, N98_NAME'Access, N99_NAME'Access, EMPTY_NAME'Access, EMSP_NAME'Access, ENSP_NAME'Access, N103_NAME'Access, EQUIV_NAME'Access, N105_NAME'Access, N106_NAME'Access, N107_NAME'Access, EURO_NAME'Access, EXIST_NAME'Access, FNOF_NAME'Access, FORALL_NAME'Access, FRAC12_NAME'Access, FRAC14_NAME'Access, FRAC34_NAME'Access, FRASL_NAME'Access, N116_NAME'Access, GE_NAME'Access, GT_NAME'Access, HARR_NAME'Access, N120_NAME'Access, HEARTS_NAME'Access, HELLIP_NAME'Access, N123_NAME'Access, N124_NAME'Access, IEXCL_NAME'Access, N126_NAME'Access, IMAGE_NAME'Access, INFIN_NAME'Access, INT_NAME'Access, N130_NAME'Access, IQUEST_NAME'Access, ISIN_NAME'Access, N133_NAME'Access, N134_NAME'Access, LARR_NAME'Access, N136_NAME'Access, LANG_NAME'Access, LAQUO_NAME'Access, N139_NAME'Access, LCEIL_NAME'Access, LDQUO_NAME'Access, LE_NAME'Access, LFLOOR_NAME'Access, LOWAST_NAME'Access, LOZ_NAME'Access, LRM_NAME'Access, LSAQUO_NAME'Access, LSQUO_NAME'Access, LT_NAME'Access, MACR_NAME'Access, MDASH_NAME'Access, MICRO_NAME'Access, MIDDOT_NAME'Access, MINUS_NAME'Access, N155_NAME'Access, NABLA_NAME'Access, NBSP_NAME'Access, NDASH_NAME'Access, NE_NAME'Access, NI_NAME'Access, NOT_NAME'Access, NOTIN_NAME'Access, NSUB_NAME'Access, N164_NAME'Access, N165_NAME'Access, N166_NAME'Access, N167_NAME'Access, N168_NAME'Access, N169_NAME'Access, OLINE_NAME'Access, N171_NAME'Access, N172_NAME'Access, OPLUS_NAME'Access, OR_NAME'Access, ORDF_NAME'Access, ORDM_NAME'Access, N177_NAME'Access, N178_NAME'Access, OTIMES_NAME'Access, N180_NAME'Access, PARA_NAME'Access, PART_NAME'Access, PERMIL_NAME'Access, PERP_NAME'Access, N185_NAME'Access, N186_NAME'Access, PIV_NAME'Access, PLUSMN_NAME'Access, POUND_NAME'Access, N190_NAME'Access, PROD_NAME'Access, PROP_NAME'Access, N193_NAME'Access, QUOT_NAME'Access, RARR_NAME'Access, RADIC_NAME'Access, RANG_NAME'Access, RAQUO_NAME'Access, N199_NAME'Access, RCEIL_NAME'Access, RDQUO_NAME'Access, REAL_NAME'Access, REG_NAME'Access, RFLOOR_NAME'Access, N205_NAME'Access, RLM_NAME'Access, RSAQUO_NAME'Access, RSQUO_NAME'Access, SBQUO_NAME'Access, N210_NAME'Access, SDOT_NAME'Access, SECT_NAME'Access, SHY_NAME'Access, N214_NAME'Access, SIGMAF_NAME'Access, SIM_NAME'Access, SPADES_NAME'Access, SUB_NAME'Access, SUBE_NAME'Access, SUM_NAME'Access, SUP_NAME'Access, SUP1_NAME'Access, SUP2_NAME'Access, SUP3_NAME'Access, SUPE_NAME'Access, SZLIG_NAME'Access, N227_NAME'Access, THERE4_NAME'Access, N229_NAME'Access, THETASYM_NAME'Access, THINSP_NAME'Access, N232_NAME'Access, TILDE_NAME'Access, TIMES_NAME'Access, TRADE_NAME'Access, UARR_NAME'Access, N237_NAME'Access, N238_NAME'Access, N239_NAME'Access, N240_NAME'Access, UML_NAME'Access, UPSIH_NAME'Access, N243_NAME'Access, N244_NAME'Access, WEIERP_NAME'Access, N246_NAME'Access, N247_NAME'Access, YEN_NAME'Access, N249_NAME'Access, N250_NAME'Access, ZWJ_NAME'Access, ZWNJ_NAME'Access); Mapping : constant Char_Array := ( Wide_Wide_Character'Val (198), Wide_Wide_Character'Val (193), Wide_Wide_Character'Val (194), Wide_Wide_Character'Val (192), Wide_Wide_Character'Val (913), Wide_Wide_Character'Val (197), Wide_Wide_Character'Val (195), Wide_Wide_Character'Val (196), Wide_Wide_Character'Val (914), Wide_Wide_Character'Val (199), Wide_Wide_Character'Val (935), Wide_Wide_Character'Val (8225), Wide_Wide_Character'Val (916), Wide_Wide_Character'Val (208), Wide_Wide_Character'Val (201), Wide_Wide_Character'Val (202), Wide_Wide_Character'Val (200), Wide_Wide_Character'Val (917), Wide_Wide_Character'Val (919), Wide_Wide_Character'Val (203), Wide_Wide_Character'Val (915), Wide_Wide_Character'Val (205), Wide_Wide_Character'Val (206), Wide_Wide_Character'Val (204), Wide_Wide_Character'Val (921), Wide_Wide_Character'Val (207), Wide_Wide_Character'Val (922), Wide_Wide_Character'Val (923), Wide_Wide_Character'Val (924), Wide_Wide_Character'Val (209), Wide_Wide_Character'Val (925), Wide_Wide_Character'Val (338), Wide_Wide_Character'Val (211), Wide_Wide_Character'Val (212), Wide_Wide_Character'Val (210), Wide_Wide_Character'Val (937), Wide_Wide_Character'Val (927), Wide_Wide_Character'Val (216), Wide_Wide_Character'Val (213), Wide_Wide_Character'Val (214), Wide_Wide_Character'Val (934), Wide_Wide_Character'Val (928), Wide_Wide_Character'Val (8243), Wide_Wide_Character'Val (936), Wide_Wide_Character'Val (929), Wide_Wide_Character'Val (352), Wide_Wide_Character'Val (931), Wide_Wide_Character'Val (222), Wide_Wide_Character'Val (932), Wide_Wide_Character'Val (920), Wide_Wide_Character'Val (218), Wide_Wide_Character'Val (219), Wide_Wide_Character'Val (217), Wide_Wide_Character'Val (933), Wide_Wide_Character'Val (220), Wide_Wide_Character'Val (926), Wide_Wide_Character'Val (221), Wide_Wide_Character'Val (376), Wide_Wide_Character'Val (918), Wide_Wide_Character'Val (225), Wide_Wide_Character'Val (226), Wide_Wide_Character'Val (180), Wide_Wide_Character'Val (230), Wide_Wide_Character'Val (224), Wide_Wide_Character'Val (8501), Wide_Wide_Character'Val (945), Wide_Wide_Character'Val (38), Wide_Wide_Character'Val (8743), Wide_Wide_Character'Val (8736), Wide_Wide_Character'Val (39), Wide_Wide_Character'Val (229), Wide_Wide_Character'Val (8776), Wide_Wide_Character'Val (227), Wide_Wide_Character'Val (228), Wide_Wide_Character'Val (8222), Wide_Wide_Character'Val (946), Wide_Wide_Character'Val (166), Wide_Wide_Character'Val (8226), Wide_Wide_Character'Val (8745), Wide_Wide_Character'Val (231), Wide_Wide_Character'Val (184), Wide_Wide_Character'Val (162), Wide_Wide_Character'Val (967), Wide_Wide_Character'Val (710), Wide_Wide_Character'Val (9827), Wide_Wide_Character'Val (8773), Wide_Wide_Character'Val (169), Wide_Wide_Character'Val (8629), Wide_Wide_Character'Val (8746), Wide_Wide_Character'Val (164), Wide_Wide_Character'Val (8659), Wide_Wide_Character'Val (8224), Wide_Wide_Character'Val (8595), Wide_Wide_Character'Val (176), Wide_Wide_Character'Val (948), Wide_Wide_Character'Val (9830), Wide_Wide_Character'Val (247), Wide_Wide_Character'Val (233), Wide_Wide_Character'Val (234), Wide_Wide_Character'Val (232), Wide_Wide_Character'Val (8709), Wide_Wide_Character'Val (8195), Wide_Wide_Character'Val (8194), Wide_Wide_Character'Val (949), Wide_Wide_Character'Val (8801), Wide_Wide_Character'Val (951), Wide_Wide_Character'Val (240), Wide_Wide_Character'Val (235), Wide_Wide_Character'Val (8364), Wide_Wide_Character'Val (8707), Wide_Wide_Character'Val (402), Wide_Wide_Character'Val (8704), Wide_Wide_Character'Val (189), Wide_Wide_Character'Val (188), Wide_Wide_Character'Val (190), Wide_Wide_Character'Val (8260), Wide_Wide_Character'Val (947), Wide_Wide_Character'Val (8805), Wide_Wide_Character'Val (62), Wide_Wide_Character'Val (8660), Wide_Wide_Character'Val (8596), Wide_Wide_Character'Val (9829), Wide_Wide_Character'Val (8230), Wide_Wide_Character'Val (237), Wide_Wide_Character'Val (238), Wide_Wide_Character'Val (161), Wide_Wide_Character'Val (236), Wide_Wide_Character'Val (8465), Wide_Wide_Character'Val (8734), Wide_Wide_Character'Val (8747), Wide_Wide_Character'Val (953), Wide_Wide_Character'Val (191), Wide_Wide_Character'Val (8712), Wide_Wide_Character'Val (239), Wide_Wide_Character'Val (954), Wide_Wide_Character'Val (8656), Wide_Wide_Character'Val (955), Wide_Wide_Character'Val (9001), Wide_Wide_Character'Val (171), Wide_Wide_Character'Val (8592), Wide_Wide_Character'Val (8968), Wide_Wide_Character'Val (8220), Wide_Wide_Character'Val (8804), Wide_Wide_Character'Val (8970), Wide_Wide_Character'Val (8727), Wide_Wide_Character'Val (9674), Wide_Wide_Character'Val (8206), Wide_Wide_Character'Val (8249), Wide_Wide_Character'Val (8216), Wide_Wide_Character'Val (60), Wide_Wide_Character'Val (175), Wide_Wide_Character'Val (8212), Wide_Wide_Character'Val (181), Wide_Wide_Character'Val (183), Wide_Wide_Character'Val (8722), Wide_Wide_Character'Val (956), Wide_Wide_Character'Val (8711), Wide_Wide_Character'Val (160), Wide_Wide_Character'Val (8211), Wide_Wide_Character'Val (8800), Wide_Wide_Character'Val (8715), Wide_Wide_Character'Val (172), Wide_Wide_Character'Val (8713), Wide_Wide_Character'Val (8836), Wide_Wide_Character'Val (241), Wide_Wide_Character'Val (957), Wide_Wide_Character'Val (243), Wide_Wide_Character'Val (244), Wide_Wide_Character'Val (339), Wide_Wide_Character'Val (242), Wide_Wide_Character'Val (8254), Wide_Wide_Character'Val (969), Wide_Wide_Character'Val (959), Wide_Wide_Character'Val (8853), Wide_Wide_Character'Val (8744), Wide_Wide_Character'Val (170), Wide_Wide_Character'Val (186), Wide_Wide_Character'Val (248), Wide_Wide_Character'Val (245), Wide_Wide_Character'Val (8855), Wide_Wide_Character'Val (246), Wide_Wide_Character'Val (182), Wide_Wide_Character'Val (8706), Wide_Wide_Character'Val (8240), Wide_Wide_Character'Val (8869), Wide_Wide_Character'Val (966), Wide_Wide_Character'Val (960), Wide_Wide_Character'Val (982), Wide_Wide_Character'Val (177), Wide_Wide_Character'Val (163), Wide_Wide_Character'Val (8242), Wide_Wide_Character'Val (8719), Wide_Wide_Character'Val (8733), Wide_Wide_Character'Val (968), Wide_Wide_Character'Val (34), Wide_Wide_Character'Val (8658), Wide_Wide_Character'Val (8730), Wide_Wide_Character'Val (9002), Wide_Wide_Character'Val (187), Wide_Wide_Character'Val (8594), Wide_Wide_Character'Val (8969), Wide_Wide_Character'Val (8221), Wide_Wide_Character'Val (8476), Wide_Wide_Character'Val (174), Wide_Wide_Character'Val (8971), Wide_Wide_Character'Val (961), Wide_Wide_Character'Val (8207), Wide_Wide_Character'Val (8250), Wide_Wide_Character'Val (8217), Wide_Wide_Character'Val (8218), Wide_Wide_Character'Val (353), Wide_Wide_Character'Val (8901), Wide_Wide_Character'Val (167), Wide_Wide_Character'Val (173), Wide_Wide_Character'Val (963), Wide_Wide_Character'Val (962), Wide_Wide_Character'Val (8764), Wide_Wide_Character'Val (9824), Wide_Wide_Character'Val (8834), Wide_Wide_Character'Val (8838), Wide_Wide_Character'Val (8721), Wide_Wide_Character'Val (8835), Wide_Wide_Character'Val (185), Wide_Wide_Character'Val (178), Wide_Wide_Character'Val (179), Wide_Wide_Character'Val (8839), Wide_Wide_Character'Val (223), Wide_Wide_Character'Val (964), Wide_Wide_Character'Val (8756), Wide_Wide_Character'Val (952), Wide_Wide_Character'Val (977), Wide_Wide_Character'Val (8201), Wide_Wide_Character'Val (254), Wide_Wide_Character'Val (732), Wide_Wide_Character'Val (215), Wide_Wide_Character'Val (8482), Wide_Wide_Character'Val (8657), Wide_Wide_Character'Val (250), Wide_Wide_Character'Val (8593), Wide_Wide_Character'Val (251), Wide_Wide_Character'Val (249), Wide_Wide_Character'Val (168), Wide_Wide_Character'Val (978), Wide_Wide_Character'Val (965), Wide_Wide_Character'Val (252), Wide_Wide_Character'Val (8472), Wide_Wide_Character'Val (958), Wide_Wide_Character'Val (253), Wide_Wide_Character'Val (165), Wide_Wide_Character'Val (255), Wide_Wide_Character'Val (950), Wide_Wide_Character'Val (8205), Wide_Wide_Character'Val (8204)); end Wiki.Parsers.Html.Entities;
[ { "context": "\n-- source at http://pastebin.com/ZhgRacMr\n--\n-- Baldrick on #ada provided an implementation of Murmur3.\n--", "end": 132, "score": 0.9803127646446228, "start": 124, "tag": "NAME", "value": "Baldrick" }, { "context": "enience functions.\n--\n-- license: asked on #ada (Baldrick, 2014-04-07): public domain\n\nwith Ada.Unchecked_C", "end": 294, "score": 0.9210233092308044, "start": 286, "tag": "NAME", "value": "Baldrick" } ]
benchmark/hashing.adb
skill-lang/skillAdaTestSuite
1
-- MURMUR3 -- -- taken from http://commons.ada.cx/Deterministic_Hashing -- source at http://pastebin.com/ZhgRacMr -- -- Baldrick on #ada provided an implementation of Murmur3. -- Generic_Murmur3 is the core logic, the rest are convenience functions. -- -- license: asked on #ada (Baldrick, 2014-04-07): public domain with Ada.Unchecked_Conversion; package body Hashing is use Ada.Containers; use System.Storage_Elements; use System; -- The hashes are all implemented using the storage array hash. pragma Assert (Storage_Element'Size = 8); -- We assume that a Storage_Element is essentially the same as an octet. pragma Assert (Hash_Type'Size = 32); -- Currently we only support hashing to a 32 bit value. pragma Assert (Default_Bit_Order = Low_Order_First); -- Currently we only support little-endian machines. The implementation may -- actually be OK for big-endian machines too, but this needs to be checked. function Rotate_Left (V : Hash_Type; N : Natural) return Hash_Type; pragma Import (Intrinsic, Rotate_Left); function Shift_Left (V : Hash_Type; N : Natural) return Hash_Type; pragma Import (Intrinsic, Shift_Left); function Shift_Right (V : Hash_Type; N : Natural) return Hash_Type; pragma Import (Intrinsic, Shift_Right); --------------------- -- Generic_Murmur3 -- --------------------- generic function Generic_Murmur3 (S : Storage_Array; Seed : Hash_Type) return Hash_Type; pragma Inline (Generic_Murmur3); -- This is MurmurHash3_x86_32. Making this generic is a trick that gives -- us a way of forcing the compiler to inline the code into any generics -- that use it. function Generic_Murmur3 (S : Storage_Array; Seed : Hash_Type) return Hash_Type is pragma Suppress (All_Checks); subtype Store4 is Storage_Array (1 .. 4); function FMix32 (H : Hash_Type) return Hash_Type; pragma Inline (FMix32); -- Finalization mix - force all bits of a hash block to avalanche. function FMix32 (H : Hash_Type) return Hash_Type is R : Hash_Type := H; begin R := R xor Shift_Right (R, 16); R := R * 16#85ebca6b#; R := R xor Shift_Right (R, 13); R := R * 16#c2b2ae35#; R := R xor Shift_Right (R, 16); return R; end FMix32; function Get_Block_32 is new Ada.Unchecked_Conversion (Store4, Hash_Type); C1 : constant Hash_Type := 16#cc9e2d51#; C2 : constant Hash_Type := 16#1b873593#; NBlocks : constant Storage_Count := S'Length / 4; H1 : Hash_Type := Seed; begin -- Body. for I in 0 .. NBlocks - 1 loop declare Offset : constant Storage_Count := 4 * I; First : constant Storage_Offset := S'First + Offset; Last : constant Storage_Offset := First + 3; K1 : Hash_Type := Get_Block_32 (S (First .. Last)); begin K1 := K1 * C1; K1 := Rotate_Left (K1, 15); K1 := K1 * C2; H1 := H1 xor K1; H1 := Rotate_Left (H1, 13); H1 := H1 * 5 + 16#e6546b64#; end; end loop; -- Tail. declare Offset : constant Storage_Count := 4 * NBlocks; Left : constant Storage_Count := S'Length - Offset; Base : constant Storage_Offset := S'First + Offset; K1 : Hash_Type := 0; begin if Left >= 3 then K1 := K1 xor Shift_Left (Storage_Element'Pos (S (Base + 2)), 16); end if; if Left >= 2 then K1 := K1 xor Shift_Left (Storage_Element'Pos (S (Base + 1)), 8); end if; if Left >= 1 then K1 := K1 xor Storage_Element'Pos (S (Base)); K1 := K1 * C1; K1 := Rotate_Left (K1, 15); K1 := K1 * C2; H1 := H1 xor K1; end if; end; -- Finalization. H1 := H1 xor S'Length; H1 := FMix32 (H1); return H1; end Generic_Murmur3; ------------- -- Murmur3 -- ------------- function Murmur3 is new Generic_Murmur3; ---------- -- Hash -- ---------- function Hash (S : Storage_Array; Seed : Hash_Type) return Hash_Type renames Murmur3; function Hash (A : Address; Seed : Hash_Type) return Hash_Type is subtype St is Storage_Array (1 .. Address'Object_Size / 8); function To_Storage is new Ada.Unchecked_Conversion (Address, St); begin return Hash (To_Storage (A), Seed); end Hash; ---------------------------- -- Anonymous_Pointer_Hash -- ---------------------------- function Anonymous_Pointer_Hash ( Pointer : access constant Any_Type; Seed : Hash_Type ) return Hash_Type is Addr : Address; begin if Pointer = null then Addr := Null_Address; else Addr := Pointer.all'Address; end if; return Hash (Addr, Seed); end Anonymous_Pointer_Hash; ---------------------- -- All_Pointer_Hash -- ---------------------- function All_Pointer_Hash ( Pointer : Any_Access; Seed : Hash_Type ) return Hash_Type is Addr : Address; begin if Pointer = null then Addr := Null_Address; else Addr := Pointer.all'Address; end if; return Hash (Addr, Seed); end All_Pointer_Hash; --------------------------- -- Constant_Pointer_Hash -- --------------------------- function Constant_Pointer_Hash ( Pointer : Any_Access; Seed : Hash_Type ) return Hash_Type is Addr : Address; begin if Pointer = null then Addr := Null_Address; else Addr := Pointer.all'Address; end if; return Hash (Addr, Seed); end Constant_Pointer_Hash; ------------------- -- Discrete_Hash -- ------------------- function Discrete_Hash ( Value : T; Seed : Hash_Type ) return Hash_Type is -- The problem here is that a T might not fill up a byte (or an integer -- number of bytes) - think of Boolean. To solve this, we create a null- -- initialized storage area on the stack that is large enough to store a -- T to. We then store Value to it, and hash the storage. subtype St_Type is Storage_Array (1 .. T'Object_Size / 8); St : aliased St_Type := (others => 0); -- The null-initialized storage. -- To store Value to St, we take a pointer to St, change it into a -- pointer to type T, and store Value through it. type St_Pointer is access all St_Type; for St_Pointer'Storage_Size use 0; type T_Pointer is access all T; for T_Pointer'Storage_Size use 0; function To_T is new Ada.Unchecked_Conversion (St_Pointer, T_Pointer); function M3 is new Generic_Murmur3; -- Instantiate our own copy of Murmur3 to make sure it gets inlined, as -- this leads to many simplifications due to the length of the storage -- being known. begin -- Store Value to the storage area. To_T (St'Access).all := Value; -- Hash the storage area. return M3 (St, Seed); end Discrete_Hash; ------------------ -- Pointer_Hash -- ------------------ function Pointer_Hash ( Pointer : Any_Access; Seed : Hash_Type ) return Hash_Type is Addr : Address; begin if Pointer = null then Addr := Null_Address; else Addr := Pointer.all'Address; end if; return Hash (Addr, Seed); end Pointer_Hash; end Hashing;
13463
-- MURMUR3 -- -- taken from http://commons.ada.cx/Deterministic_Hashing -- source at http://pastebin.com/ZhgRacMr -- -- <NAME> on #ada provided an implementation of Murmur3. -- Generic_Murmur3 is the core logic, the rest are convenience functions. -- -- license: asked on #ada (<NAME>, 2014-04-07): public domain with Ada.Unchecked_Conversion; package body Hashing is use Ada.Containers; use System.Storage_Elements; use System; -- The hashes are all implemented using the storage array hash. pragma Assert (Storage_Element'Size = 8); -- We assume that a Storage_Element is essentially the same as an octet. pragma Assert (Hash_Type'Size = 32); -- Currently we only support hashing to a 32 bit value. pragma Assert (Default_Bit_Order = Low_Order_First); -- Currently we only support little-endian machines. The implementation may -- actually be OK for big-endian machines too, but this needs to be checked. function Rotate_Left (V : Hash_Type; N : Natural) return Hash_Type; pragma Import (Intrinsic, Rotate_Left); function Shift_Left (V : Hash_Type; N : Natural) return Hash_Type; pragma Import (Intrinsic, Shift_Left); function Shift_Right (V : Hash_Type; N : Natural) return Hash_Type; pragma Import (Intrinsic, Shift_Right); --------------------- -- Generic_Murmur3 -- --------------------- generic function Generic_Murmur3 (S : Storage_Array; Seed : Hash_Type) return Hash_Type; pragma Inline (Generic_Murmur3); -- This is MurmurHash3_x86_32. Making this generic is a trick that gives -- us a way of forcing the compiler to inline the code into any generics -- that use it. function Generic_Murmur3 (S : Storage_Array; Seed : Hash_Type) return Hash_Type is pragma Suppress (All_Checks); subtype Store4 is Storage_Array (1 .. 4); function FMix32 (H : Hash_Type) return Hash_Type; pragma Inline (FMix32); -- Finalization mix - force all bits of a hash block to avalanche. function FMix32 (H : Hash_Type) return Hash_Type is R : Hash_Type := H; begin R := R xor Shift_Right (R, 16); R := R * 16#85ebca6b#; R := R xor Shift_Right (R, 13); R := R * 16#c2b2ae35#; R := R xor Shift_Right (R, 16); return R; end FMix32; function Get_Block_32 is new Ada.Unchecked_Conversion (Store4, Hash_Type); C1 : constant Hash_Type := 16#cc9e2d51#; C2 : constant Hash_Type := 16#1b873593#; NBlocks : constant Storage_Count := S'Length / 4; H1 : Hash_Type := Seed; begin -- Body. for I in 0 .. NBlocks - 1 loop declare Offset : constant Storage_Count := 4 * I; First : constant Storage_Offset := S'First + Offset; Last : constant Storage_Offset := First + 3; K1 : Hash_Type := Get_Block_32 (S (First .. Last)); begin K1 := K1 * C1; K1 := Rotate_Left (K1, 15); K1 := K1 * C2; H1 := H1 xor K1; H1 := Rotate_Left (H1, 13); H1 := H1 * 5 + 16#e6546b64#; end; end loop; -- Tail. declare Offset : constant Storage_Count := 4 * NBlocks; Left : constant Storage_Count := S'Length - Offset; Base : constant Storage_Offset := S'First + Offset; K1 : Hash_Type := 0; begin if Left >= 3 then K1 := K1 xor Shift_Left (Storage_Element'Pos (S (Base + 2)), 16); end if; if Left >= 2 then K1 := K1 xor Shift_Left (Storage_Element'Pos (S (Base + 1)), 8); end if; if Left >= 1 then K1 := K1 xor Storage_Element'Pos (S (Base)); K1 := K1 * C1; K1 := Rotate_Left (K1, 15); K1 := K1 * C2; H1 := H1 xor K1; end if; end; -- Finalization. H1 := H1 xor S'Length; H1 := FMix32 (H1); return H1; end Generic_Murmur3; ------------- -- Murmur3 -- ------------- function Murmur3 is new Generic_Murmur3; ---------- -- Hash -- ---------- function Hash (S : Storage_Array; Seed : Hash_Type) return Hash_Type renames Murmur3; function Hash (A : Address; Seed : Hash_Type) return Hash_Type is subtype St is Storage_Array (1 .. Address'Object_Size / 8); function To_Storage is new Ada.Unchecked_Conversion (Address, St); begin return Hash (To_Storage (A), Seed); end Hash; ---------------------------- -- Anonymous_Pointer_Hash -- ---------------------------- function Anonymous_Pointer_Hash ( Pointer : access constant Any_Type; Seed : Hash_Type ) return Hash_Type is Addr : Address; begin if Pointer = null then Addr := Null_Address; else Addr := Pointer.all'Address; end if; return Hash (Addr, Seed); end Anonymous_Pointer_Hash; ---------------------- -- All_Pointer_Hash -- ---------------------- function All_Pointer_Hash ( Pointer : Any_Access; Seed : Hash_Type ) return Hash_Type is Addr : Address; begin if Pointer = null then Addr := Null_Address; else Addr := Pointer.all'Address; end if; return Hash (Addr, Seed); end All_Pointer_Hash; --------------------------- -- Constant_Pointer_Hash -- --------------------------- function Constant_Pointer_Hash ( Pointer : Any_Access; Seed : Hash_Type ) return Hash_Type is Addr : Address; begin if Pointer = null then Addr := Null_Address; else Addr := Pointer.all'Address; end if; return Hash (Addr, Seed); end Constant_Pointer_Hash; ------------------- -- Discrete_Hash -- ------------------- function Discrete_Hash ( Value : T; Seed : Hash_Type ) return Hash_Type is -- The problem here is that a T might not fill up a byte (or an integer -- number of bytes) - think of Boolean. To solve this, we create a null- -- initialized storage area on the stack that is large enough to store a -- T to. We then store Value to it, and hash the storage. subtype St_Type is Storage_Array (1 .. T'Object_Size / 8); St : aliased St_Type := (others => 0); -- The null-initialized storage. -- To store Value to St, we take a pointer to St, change it into a -- pointer to type T, and store Value through it. type St_Pointer is access all St_Type; for St_Pointer'Storage_Size use 0; type T_Pointer is access all T; for T_Pointer'Storage_Size use 0; function To_T is new Ada.Unchecked_Conversion (St_Pointer, T_Pointer); function M3 is new Generic_Murmur3; -- Instantiate our own copy of Murmur3 to make sure it gets inlined, as -- this leads to many simplifications due to the length of the storage -- being known. begin -- Store Value to the storage area. To_T (St'Access).all := Value; -- Hash the storage area. return M3 (St, Seed); end Discrete_Hash; ------------------ -- Pointer_Hash -- ------------------ function Pointer_Hash ( Pointer : Any_Access; Seed : Hash_Type ) return Hash_Type is Addr : Address; begin if Pointer = null then Addr := Null_Address; else Addr := Pointer.all'Address; end if; return Hash (Addr, Seed); end Pointer_Hash; end Hashing;
true
-- MURMUR3 -- -- taken from http://commons.ada.cx/Deterministic_Hashing -- source at http://pastebin.com/ZhgRacMr -- -- PI:NAME:<NAME>END_PI on #ada provided an implementation of Murmur3. -- Generic_Murmur3 is the core logic, the rest are convenience functions. -- -- license: asked on #ada (PI:NAME:<NAME>END_PI, 2014-04-07): public domain with Ada.Unchecked_Conversion; package body Hashing is use Ada.Containers; use System.Storage_Elements; use System; -- The hashes are all implemented using the storage array hash. pragma Assert (Storage_Element'Size = 8); -- We assume that a Storage_Element is essentially the same as an octet. pragma Assert (Hash_Type'Size = 32); -- Currently we only support hashing to a 32 bit value. pragma Assert (Default_Bit_Order = Low_Order_First); -- Currently we only support little-endian machines. The implementation may -- actually be OK for big-endian machines too, but this needs to be checked. function Rotate_Left (V : Hash_Type; N : Natural) return Hash_Type; pragma Import (Intrinsic, Rotate_Left); function Shift_Left (V : Hash_Type; N : Natural) return Hash_Type; pragma Import (Intrinsic, Shift_Left); function Shift_Right (V : Hash_Type; N : Natural) return Hash_Type; pragma Import (Intrinsic, Shift_Right); --------------------- -- Generic_Murmur3 -- --------------------- generic function Generic_Murmur3 (S : Storage_Array; Seed : Hash_Type) return Hash_Type; pragma Inline (Generic_Murmur3); -- This is MurmurHash3_x86_32. Making this generic is a trick that gives -- us a way of forcing the compiler to inline the code into any generics -- that use it. function Generic_Murmur3 (S : Storage_Array; Seed : Hash_Type) return Hash_Type is pragma Suppress (All_Checks); subtype Store4 is Storage_Array (1 .. 4); function FMix32 (H : Hash_Type) return Hash_Type; pragma Inline (FMix32); -- Finalization mix - force all bits of a hash block to avalanche. function FMix32 (H : Hash_Type) return Hash_Type is R : Hash_Type := H; begin R := R xor Shift_Right (R, 16); R := R * 16#85ebca6b#; R := R xor Shift_Right (R, 13); R := R * 16#c2b2ae35#; R := R xor Shift_Right (R, 16); return R; end FMix32; function Get_Block_32 is new Ada.Unchecked_Conversion (Store4, Hash_Type); C1 : constant Hash_Type := 16#cc9e2d51#; C2 : constant Hash_Type := 16#1b873593#; NBlocks : constant Storage_Count := S'Length / 4; H1 : Hash_Type := Seed; begin -- Body. for I in 0 .. NBlocks - 1 loop declare Offset : constant Storage_Count := 4 * I; First : constant Storage_Offset := S'First + Offset; Last : constant Storage_Offset := First + 3; K1 : Hash_Type := Get_Block_32 (S (First .. Last)); begin K1 := K1 * C1; K1 := Rotate_Left (K1, 15); K1 := K1 * C2; H1 := H1 xor K1; H1 := Rotate_Left (H1, 13); H1 := H1 * 5 + 16#e6546b64#; end; end loop; -- Tail. declare Offset : constant Storage_Count := 4 * NBlocks; Left : constant Storage_Count := S'Length - Offset; Base : constant Storage_Offset := S'First + Offset; K1 : Hash_Type := 0; begin if Left >= 3 then K1 := K1 xor Shift_Left (Storage_Element'Pos (S (Base + 2)), 16); end if; if Left >= 2 then K1 := K1 xor Shift_Left (Storage_Element'Pos (S (Base + 1)), 8); end if; if Left >= 1 then K1 := K1 xor Storage_Element'Pos (S (Base)); K1 := K1 * C1; K1 := Rotate_Left (K1, 15); K1 := K1 * C2; H1 := H1 xor K1; end if; end; -- Finalization. H1 := H1 xor S'Length; H1 := FMix32 (H1); return H1; end Generic_Murmur3; ------------- -- Murmur3 -- ------------- function Murmur3 is new Generic_Murmur3; ---------- -- Hash -- ---------- function Hash (S : Storage_Array; Seed : Hash_Type) return Hash_Type renames Murmur3; function Hash (A : Address; Seed : Hash_Type) return Hash_Type is subtype St is Storage_Array (1 .. Address'Object_Size / 8); function To_Storage is new Ada.Unchecked_Conversion (Address, St); begin return Hash (To_Storage (A), Seed); end Hash; ---------------------------- -- Anonymous_Pointer_Hash -- ---------------------------- function Anonymous_Pointer_Hash ( Pointer : access constant Any_Type; Seed : Hash_Type ) return Hash_Type is Addr : Address; begin if Pointer = null then Addr := Null_Address; else Addr := Pointer.all'Address; end if; return Hash (Addr, Seed); end Anonymous_Pointer_Hash; ---------------------- -- All_Pointer_Hash -- ---------------------- function All_Pointer_Hash ( Pointer : Any_Access; Seed : Hash_Type ) return Hash_Type is Addr : Address; begin if Pointer = null then Addr := Null_Address; else Addr := Pointer.all'Address; end if; return Hash (Addr, Seed); end All_Pointer_Hash; --------------------------- -- Constant_Pointer_Hash -- --------------------------- function Constant_Pointer_Hash ( Pointer : Any_Access; Seed : Hash_Type ) return Hash_Type is Addr : Address; begin if Pointer = null then Addr := Null_Address; else Addr := Pointer.all'Address; end if; return Hash (Addr, Seed); end Constant_Pointer_Hash; ------------------- -- Discrete_Hash -- ------------------- function Discrete_Hash ( Value : T; Seed : Hash_Type ) return Hash_Type is -- The problem here is that a T might not fill up a byte (or an integer -- number of bytes) - think of Boolean. To solve this, we create a null- -- initialized storage area on the stack that is large enough to store a -- T to. We then store Value to it, and hash the storage. subtype St_Type is Storage_Array (1 .. T'Object_Size / 8); St : aliased St_Type := (others => 0); -- The null-initialized storage. -- To store Value to St, we take a pointer to St, change it into a -- pointer to type T, and store Value through it. type St_Pointer is access all St_Type; for St_Pointer'Storage_Size use 0; type T_Pointer is access all T; for T_Pointer'Storage_Size use 0; function To_T is new Ada.Unchecked_Conversion (St_Pointer, T_Pointer); function M3 is new Generic_Murmur3; -- Instantiate our own copy of Murmur3 to make sure it gets inlined, as -- this leads to many simplifications due to the length of the storage -- being known. begin -- Store Value to the storage area. To_T (St'Access).all := Value; -- Hash the storage area. return M3 (St, Seed); end Discrete_Hash; ------------------ -- Pointer_Hash -- ------------------ function Pointer_Hash ( Pointer : Any_Access; Seed : Hash_Type ) return Hash_Type is Addr : Address; begin if Pointer = null then Addr := Null_Address; else Addr := Pointer.all'Address; end if; return Hash (Addr, Seed); end Pointer_Hash; end Hashing;
[ { "context": "-- Copyright 2017 Jeff Foley. All rights reserved.\n-- Use of this source code ", "end": 28, "score": 0.9998558163642883, "start": 18, "tag": "NAME", "value": "Jeff Foley" } ]
resources/scripts/archive/archiveit.ads
devkw/Amass
0
-- Copyright 2017 Jeff Foley. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. name = "ArchiveIt" type = "archive" function start() setratelimit(1) end function vertical(ctx, domain) crawl(ctx, buildurl(domain)) end function resolved(ctx, name) crawl(ctx, buildurl(name)) end function buildurl(domain) return "https://wayback.archive-it.org/all/" .. os.date("%Y") .. "/" .. domain end
8625
-- Copyright 2017 <NAME>. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. name = "ArchiveIt" type = "archive" function start() setratelimit(1) end function vertical(ctx, domain) crawl(ctx, buildurl(domain)) end function resolved(ctx, name) crawl(ctx, buildurl(name)) end function buildurl(domain) return "https://wayback.archive-it.org/all/" .. os.date("%Y") .. "/" .. domain end
true
-- Copyright 2017 PI:NAME:<NAME>END_PI. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. name = "ArchiveIt" type = "archive" function start() setratelimit(1) end function vertical(ctx, domain) crawl(ctx, buildurl(domain)) end function resolved(ctx, name) crawl(ctx, buildurl(name)) end function buildurl(domain) return "https://wayback.archive-it.org/all/" .. os.date("%Y") .. "/" .. domain end
[ { "context": "-------\n-- Copyright (C) 2020 by Heisenbug Ltd. (gh+owm@heisenbug.eu)\n--\n-- This work is free. You can redistribute i", "end": 142, "score": 0.9999216794967651, "start": 123, "tag": "EMAIL", "value": "gh+owm@heisenbug.eu" } ]
src/open_weather_map-api-service.ads
Jellix/open_weather_map_api
1
-------------------------------------------------------------------------------- -- Copyright (C) 2020 by Heisenbug Ltd. (gh+owm@heisenbug.eu) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. -------------------------------------------------------------------------------- pragma License (Unrestricted); with Open_Weather_Map.API.Query; private with AWS.Parameters; -------------------------------------------------------------------------------- --% @summary --% Open_Weather_Map.API.Query -- --% @description --% Provides the abstract tagged type from which every concrete implementation --% of a specific API query object shall be derived. -------------------------------------------------------------------------------- private package Open_Weather_Map.API.Service is ----------------------------------------------------------------------------- -- Extended context type for API queries, and its primitive operations. -- -- This type actually "knows" something about the API, and is the type all -- API query types shall derive from. ----------------------------------------------------------------------------- type T is abstract new Query.T with private; ----------------------------------------------------------------------------- -- Initialize ----------------------------------------------------------------------------- procedure Initialize (Self : out T; Configuration : in GNATCOLL.JSON.JSON_Value; Connection : not null Client.T_Access; Max_Cache_Interval : in Ada.Real_Time.Time_Span := Default_Cache_Interval; For_API_Service : in API_Services); --% Sets up the context (and namely the proper URL for API calls) given the --% service name for the actual API. -- --% @param Self --% The object to be initialized. -- --% @param Configuration --% JSON value containing configuration data. -- --% @param Connection --% The HTTP connection to be used for the query object. If this value is --% null, a new connection will be created. -- --% @param Max_Cache_Interval --% Span of time a previous value will be stored before a new value will be --% requested from the server. -- --% @param For_API_Service --% The API service for which this query instance shall be initialized for. ----------------------------------------------------------------------------- -- Cache_Interval ----------------------------------------------------------------------------- function Cache_Interval (Self : in T) return Ada.Real_Time.Time_Span with Inline => True; --% Returns a previously set Cache_Interval for this Context. -- --% @param Self --% The object the cache interval shall be returned from. -- --% @return --% The preset cache interval for object Self. ----------------------------------------------------------------------------- -- Set_Cache_Interval ----------------------------------------------------------------------------- procedure Set_Cache_Interval (Self : in out T; Max_Cache_Interval : in Ada.Real_Time.Time_Span); --% Set a new cache interval for the object. -- --% @param Self --% The object for which a new cache interval shall be set. -- --% @param Max_Cache_Interval --% The new cache interval to be set. -- -- Once a value has been retrieved from the server, a new request will not -- be sent if the new request happens within Cache_Interval. This supports -- both rate limiting on queries as well as speed optimization to not -- retrieve new values that seldom change over time, anyway. -- -- The update interval on openweathermap.org seems to be about 10 minutes, -- but that doesn't even mean, there's a new measurement (in fact, this can -- take hours). ----------------------------------------------------------------------------- -- Service_URI ----------------------------------------------------------------------------- function Service_URI (This : in T) return String; --% Returns the URI for the context specific API (including parameters etc.). -- --% @param This --% The object the Service URI shall be retrieved from. -- --% @return --% The query specific service URI for the object. -- For security reasons, the API key parameter is not included here, only -- the query specific parameters. ----------------------------------------------------------------------------- -- Decode_Response ----------------------------------------------------------------------------- function Decode_Response (Self : in T; Root : in GNATCOLL.JSON.JSON_Value) return Data_Set is abstract; --% Decodes the Response and returns the context specific Data_Set. -- Called from within Query() with the received JSON data. -- This subroutine must be overridden by the concrete API context -- implementations to cater for the differences of the services' responses. -- --% @param Self --% The concerned object. -- --% @param Root --% The root object of the JSON tree received from the server. -- --% @return --% The Data_Set extracted from the JSON value given in Root. ----------------------------------------------------------------------------- -- Perform_Query ----------------------------------------------------------------------------- overriding procedure Perform_Query (Self : in out T; Current : in out Data_Set); --% Operation to fire and evaluate a query as defined by the actual type of --% Self. -- --% @param Self --% The query object for which a query shall be sent. -- --% @param Current --% The data set to be updated. private type T is abstract new Query.T with record Server_Connection : Client.T_Access; --% @field Server_Connection --% The HTTP client connection used to communicate with the server. Cache_Interval : Ada.Real_Time.Time_Span; --% @field Cache_Interval --% The span of time previously acquired values will be cached before a --% new query is sent to the server. Key : API_Key; --% @field Key --% The (secret) API key used to authenticate queries. Service : API_Services; --% @field Service --% The API service for this query. Parameters : AWS.Parameters.List; --% @field Parameters --% API specific query parameters. end record; ----------------------------------------------------------------------------- -- Cache_Interval ----------------------------------------------------------------------------- function Cache_Interval (Self : in T) return Ada.Real_Time.Time_Span is (Self.Cache_Interval); end Open_Weather_Map.API.Service;
8865
-------------------------------------------------------------------------------- -- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>) -- -- 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); with Open_Weather_Map.API.Query; private with AWS.Parameters; -------------------------------------------------------------------------------- --% @summary --% Open_Weather_Map.API.Query -- --% @description --% Provides the abstract tagged type from which every concrete implementation --% of a specific API query object shall be derived. -------------------------------------------------------------------------------- private package Open_Weather_Map.API.Service is ----------------------------------------------------------------------------- -- Extended context type for API queries, and its primitive operations. -- -- This type actually "knows" something about the API, and is the type all -- API query types shall derive from. ----------------------------------------------------------------------------- type T is abstract new Query.T with private; ----------------------------------------------------------------------------- -- Initialize ----------------------------------------------------------------------------- procedure Initialize (Self : out T; Configuration : in GNATCOLL.JSON.JSON_Value; Connection : not null Client.T_Access; Max_Cache_Interval : in Ada.Real_Time.Time_Span := Default_Cache_Interval; For_API_Service : in API_Services); --% Sets up the context (and namely the proper URL for API calls) given the --% service name for the actual API. -- --% @param Self --% The object to be initialized. -- --% @param Configuration --% JSON value containing configuration data. -- --% @param Connection --% The HTTP connection to be used for the query object. If this value is --% null, a new connection will be created. -- --% @param Max_Cache_Interval --% Span of time a previous value will be stored before a new value will be --% requested from the server. -- --% @param For_API_Service --% The API service for which this query instance shall be initialized for. ----------------------------------------------------------------------------- -- Cache_Interval ----------------------------------------------------------------------------- function Cache_Interval (Self : in T) return Ada.Real_Time.Time_Span with Inline => True; --% Returns a previously set Cache_Interval for this Context. -- --% @param Self --% The object the cache interval shall be returned from. -- --% @return --% The preset cache interval for object Self. ----------------------------------------------------------------------------- -- Set_Cache_Interval ----------------------------------------------------------------------------- procedure Set_Cache_Interval (Self : in out T; Max_Cache_Interval : in Ada.Real_Time.Time_Span); --% Set a new cache interval for the object. -- --% @param Self --% The object for which a new cache interval shall be set. -- --% @param Max_Cache_Interval --% The new cache interval to be set. -- -- Once a value has been retrieved from the server, a new request will not -- be sent if the new request happens within Cache_Interval. This supports -- both rate limiting on queries as well as speed optimization to not -- retrieve new values that seldom change over time, anyway. -- -- The update interval on openweathermap.org seems to be about 10 minutes, -- but that doesn't even mean, there's a new measurement (in fact, this can -- take hours). ----------------------------------------------------------------------------- -- Service_URI ----------------------------------------------------------------------------- function Service_URI (This : in T) return String; --% Returns the URI for the context specific API (including parameters etc.). -- --% @param This --% The object the Service URI shall be retrieved from. -- --% @return --% The query specific service URI for the object. -- For security reasons, the API key parameter is not included here, only -- the query specific parameters. ----------------------------------------------------------------------------- -- Decode_Response ----------------------------------------------------------------------------- function Decode_Response (Self : in T; Root : in GNATCOLL.JSON.JSON_Value) return Data_Set is abstract; --% Decodes the Response and returns the context specific Data_Set. -- Called from within Query() with the received JSON data. -- This subroutine must be overridden by the concrete API context -- implementations to cater for the differences of the services' responses. -- --% @param Self --% The concerned object. -- --% @param Root --% The root object of the JSON tree received from the server. -- --% @return --% The Data_Set extracted from the JSON value given in Root. ----------------------------------------------------------------------------- -- Perform_Query ----------------------------------------------------------------------------- overriding procedure Perform_Query (Self : in out T; Current : in out Data_Set); --% Operation to fire and evaluate a query as defined by the actual type of --% Self. -- --% @param Self --% The query object for which a query shall be sent. -- --% @param Current --% The data set to be updated. private type T is abstract new Query.T with record Server_Connection : Client.T_Access; --% @field Server_Connection --% The HTTP client connection used to communicate with the server. Cache_Interval : Ada.Real_Time.Time_Span; --% @field Cache_Interval --% The span of time previously acquired values will be cached before a --% new query is sent to the server. Key : API_Key; --% @field Key --% The (secret) API key used to authenticate queries. Service : API_Services; --% @field Service --% The API service for this query. Parameters : AWS.Parameters.List; --% @field Parameters --% API specific query parameters. end record; ----------------------------------------------------------------------------- -- Cache_Interval ----------------------------------------------------------------------------- function Cache_Interval (Self : in T) return Ada.Real_Time.Time_Span is (Self.Cache_Interval); end Open_Weather_Map.API.Service;
true
-------------------------------------------------------------------------------- -- Copyright (C) 2020 by Heisenbug Ltd. (PI:EMAIL:<EMAIL>END_PI) -- -- 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); with Open_Weather_Map.API.Query; private with AWS.Parameters; -------------------------------------------------------------------------------- --% @summary --% Open_Weather_Map.API.Query -- --% @description --% Provides the abstract tagged type from which every concrete implementation --% of a specific API query object shall be derived. -------------------------------------------------------------------------------- private package Open_Weather_Map.API.Service is ----------------------------------------------------------------------------- -- Extended context type for API queries, and its primitive operations. -- -- This type actually "knows" something about the API, and is the type all -- API query types shall derive from. ----------------------------------------------------------------------------- type T is abstract new Query.T with private; ----------------------------------------------------------------------------- -- Initialize ----------------------------------------------------------------------------- procedure Initialize (Self : out T; Configuration : in GNATCOLL.JSON.JSON_Value; Connection : not null Client.T_Access; Max_Cache_Interval : in Ada.Real_Time.Time_Span := Default_Cache_Interval; For_API_Service : in API_Services); --% Sets up the context (and namely the proper URL for API calls) given the --% service name for the actual API. -- --% @param Self --% The object to be initialized. -- --% @param Configuration --% JSON value containing configuration data. -- --% @param Connection --% The HTTP connection to be used for the query object. If this value is --% null, a new connection will be created. -- --% @param Max_Cache_Interval --% Span of time a previous value will be stored before a new value will be --% requested from the server. -- --% @param For_API_Service --% The API service for which this query instance shall be initialized for. ----------------------------------------------------------------------------- -- Cache_Interval ----------------------------------------------------------------------------- function Cache_Interval (Self : in T) return Ada.Real_Time.Time_Span with Inline => True; --% Returns a previously set Cache_Interval for this Context. -- --% @param Self --% The object the cache interval shall be returned from. -- --% @return --% The preset cache interval for object Self. ----------------------------------------------------------------------------- -- Set_Cache_Interval ----------------------------------------------------------------------------- procedure Set_Cache_Interval (Self : in out T; Max_Cache_Interval : in Ada.Real_Time.Time_Span); --% Set a new cache interval for the object. -- --% @param Self --% The object for which a new cache interval shall be set. -- --% @param Max_Cache_Interval --% The new cache interval to be set. -- -- Once a value has been retrieved from the server, a new request will not -- be sent if the new request happens within Cache_Interval. This supports -- both rate limiting on queries as well as speed optimization to not -- retrieve new values that seldom change over time, anyway. -- -- The update interval on openweathermap.org seems to be about 10 minutes, -- but that doesn't even mean, there's a new measurement (in fact, this can -- take hours). ----------------------------------------------------------------------------- -- Service_URI ----------------------------------------------------------------------------- function Service_URI (This : in T) return String; --% Returns the URI for the context specific API (including parameters etc.). -- --% @param This --% The object the Service URI shall be retrieved from. -- --% @return --% The query specific service URI for the object. -- For security reasons, the API key parameter is not included here, only -- the query specific parameters. ----------------------------------------------------------------------------- -- Decode_Response ----------------------------------------------------------------------------- function Decode_Response (Self : in T; Root : in GNATCOLL.JSON.JSON_Value) return Data_Set is abstract; --% Decodes the Response and returns the context specific Data_Set. -- Called from within Query() with the received JSON data. -- This subroutine must be overridden by the concrete API context -- implementations to cater for the differences of the services' responses. -- --% @param Self --% The concerned object. -- --% @param Root --% The root object of the JSON tree received from the server. -- --% @return --% The Data_Set extracted from the JSON value given in Root. ----------------------------------------------------------------------------- -- Perform_Query ----------------------------------------------------------------------------- overriding procedure Perform_Query (Self : in out T; Current : in out Data_Set); --% Operation to fire and evaluate a query as defined by the actual type of --% Self. -- --% @param Self --% The query object for which a query shall be sent. -- --% @param Current --% The data set to be updated. private type T is abstract new Query.T with record Server_Connection : Client.T_Access; --% @field Server_Connection --% The HTTP client connection used to communicate with the server. Cache_Interval : Ada.Real_Time.Time_Span; --% @field Cache_Interval --% The span of time previously acquired values will be cached before a --% new query is sent to the server. Key : API_Key; --% @field Key --% The (secret) API key used to authenticate queries. Service : API_Services; --% @field Service --% The API service for this query. Parameters : AWS.Parameters.List; --% @field Parameters --% API specific query parameters. end record; ----------------------------------------------------------------------------- -- Cache_Interval ----------------------------------------------------------------------------- function Cache_Interval (Self : in T) return Ada.Real_Time.Time_Span is (Self.Cache_Interval); end Open_Weather_Map.API.Service;
[ { "context": "ts -- Tests for keystore IO\n-- Copyright (C) 2019 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 157, "score": 0.9998704791069031, "start": 142, "tag": "NAME", "value": "Stephane Carrez" }, { "context": " Copyright (C) 2019 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 188, "score": 0.9998782277107239, "start": 173, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "9 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 215, "score": 0.9999272227287292, "start": 190, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
regtests/keystore-coverage.adb
My-Colaborations/ada-keystore
25
----------------------------------------------------------------------- -- keystore-io-tests -- Tests for keystore IO -- Copyright (C) 2019 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with Keystore.IO.Files; with Keystore.Buffers; with Keystore.Passwords.GPG; with Keystore.Repository; with Keystore.IO.Refs; package body Keystore.Coverage is -- A fake type to make sure execute generated compiler code for <T>DF() operation -- (these functions are used for deep finalization). type Deep_Finalization_Coverage is limited record Stream : Keystore.IO.Files.Wallet_Stream; Context : Keystore.Passwords.GPG.Context_Type; Config : Keystore.Wallet_Config; Repo : Keystore.Repository.Wallet_Repository; Ref : Keystore.IO.Refs.Stream_Ref; Block : Keystore.Buffers.Storage_Block; Buf : Keystore.Buffers.Data_Buffer_Type; Storage : Keystore.Buffers.Storage_Buffer; end record; package Caller is new Util.Test_Caller (Test, "Keystore.Coverage"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Keystore.Coverage", Test_Deep_Coverage'Access); end Add_Tests; procedure Test_Deep_Coverage (T : in out Test) is Item : Deep_Finalization_Coverage; begin Item.Config := Keystore.Secure_Config; T.Assert (Item'Size > 0, "Compiler error!!!!"); end Test_Deep_Coverage; end Keystore.Coverage;
8753
----------------------------------------------------------------------- -- keystore-io-tests -- Tests for keystore IO -- Copyright (C) 2019 <NAME> -- Written by <NAME> (<EMAIL>) -- -- 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 Keystore.IO.Files; with Keystore.Buffers; with Keystore.Passwords.GPG; with Keystore.Repository; with Keystore.IO.Refs; package body Keystore.Coverage is -- A fake type to make sure execute generated compiler code for <T>DF() operation -- (these functions are used for deep finalization). type Deep_Finalization_Coverage is limited record Stream : Keystore.IO.Files.Wallet_Stream; Context : Keystore.Passwords.GPG.Context_Type; Config : Keystore.Wallet_Config; Repo : Keystore.Repository.Wallet_Repository; Ref : Keystore.IO.Refs.Stream_Ref; Block : Keystore.Buffers.Storage_Block; Buf : Keystore.Buffers.Data_Buffer_Type; Storage : Keystore.Buffers.Storage_Buffer; end record; package Caller is new Util.Test_Caller (Test, "Keystore.Coverage"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Keystore.Coverage", Test_Deep_Coverage'Access); end Add_Tests; procedure Test_Deep_Coverage (T : in out Test) is Item : Deep_Finalization_Coverage; begin Item.Config := Keystore.Secure_Config; T.Assert (Item'Size > 0, "Compiler error!!!!"); end Test_Deep_Coverage; end Keystore.Coverage;
true
----------------------------------------------------------------------- -- keystore-io-tests -- Tests for keystore IO -- Copyright (C) 2019 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- 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 Keystore.IO.Files; with Keystore.Buffers; with Keystore.Passwords.GPG; with Keystore.Repository; with Keystore.IO.Refs; package body Keystore.Coverage is -- A fake type to make sure execute generated compiler code for <T>DF() operation -- (these functions are used for deep finalization). type Deep_Finalization_Coverage is limited record Stream : Keystore.IO.Files.Wallet_Stream; Context : Keystore.Passwords.GPG.Context_Type; Config : Keystore.Wallet_Config; Repo : Keystore.Repository.Wallet_Repository; Ref : Keystore.IO.Refs.Stream_Ref; Block : Keystore.Buffers.Storage_Block; Buf : Keystore.Buffers.Data_Buffer_Type; Storage : Keystore.Buffers.Storage_Buffer; end record; package Caller is new Util.Test_Caller (Test, "Keystore.Coverage"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Keystore.Coverage", Test_Deep_Coverage'Access); end Add_Tests; procedure Test_Deep_Coverage (T : in out Test) is Item : Deep_Finalization_Coverage; begin Item.Config := Keystore.Secure_Config; T.Assert (Item'Size > 0, "Compiler error!!!!"); end Test_Deep_Coverage; end Keystore.Coverage;
[ { "context": " --\n-- A = B * (MC * MD - ME * e) --\n-- Zubrych Yevheniia --\n-- IP-53 ", "end": 146, "score": 0.9998685121536255, "start": 129, "tag": "NAME", "value": "Zubrych Yevheniia" } ]
lab15/src/main.adb
evgenijaZ/PP-labs
0
----------------------------------------- -- PRG1 -- -- A = B * (MC * MD - ME * e) -- -- Zubrych Yevheniia -- -- IP-53 -- ----------------------------------------- with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Synchronous_Task_Control; use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Synchronous_Task_Control; with Ada.Calendar; use Ada.Calendar; procedure Main is N : Integer := 900; P : Integer := 4; H : Integer := N / P; startTime : Time; endTime : Time; type Vector is array (1 .. N) of Integer; type Matrix is array (1 .. N) of Vector; A : Vector; MD,ME : Matrix; protected Box is function Copy_e return Integer; function Copy_B return Vector; function Copy_MC return Matrix; procedure Input_e (x: in Integer); procedure Input_B (x: in Integer); procedure Input_MC (x: in Integer); entry Wait1; entry Wait2; procedure Signal1; procedure Signal2; private e: Integer; B:Vector; MC : Matrix; F1 : Integer := 0; F2 : Integer := 0; end Box; protected body Box is function Copy_e return Integer is begin return e; end Copy_e; function Copy_B return Vector is begin return B; end Copy_B; function Copy_MC return Matrix is begin return MC; end Copy_MC; procedure Input_MC (x: in Integer)is begin for i in 1 .. N loop for j in 1 .. N loop MC(i)(j):=x; end loop; end loop; end Input_MC; procedure Input_B (x: in Integer)is begin for i in 1 .. N loop B(i):=x; end loop; end Input_B; procedure Input_e (x : in Integer) is begin e := x; end Input_e; entry Wait1 when F1 = 3 is begin null; end; entry Wait2 when F2 = 3 is begin null; end; procedure Signal1 is begin F1 := F1 + 1; end Signal1; procedure Signal2 is begin F2 := F2 + 1; end Signal2; end Box; procedure Start is task T1; task body T1 is e : Integer; MC : Matrix; B : Vector; MR:Matrix; from, to : Integer; begin Put_Line ("T1 started"); from:=1; to:=H; -- Wait for other threads to finish input Box.Wait1; -- Copy data e:=Box.Copy_e; B:=Box.Copy_B; MC:=Box.Copy_MC; --Calculate A = B * (MC * MDH - MEH * e) for i in 1..N loop for j in from..to loop MR(i)(j):=0; for k in 1..N loop MR(i)(j):=MR(i)(j)+MC(i)(k)*MD(k)(j); end loop; MR(i)(j):=MR(i)(j)-ME(i)(j)*e; end loop; end loop; for j in from..to loop A(j):=0; for k in 1..N loop A(j):=A(j)+B(k)*MR(k)(j); end loop; end loop; -- Signal for other threads to finish Box.Signal2; Put_Line ("T1 finished"); end T1; task T2 is pragma Storage_Size (100000000); end T2; task body T2 is e : Integer; MC : Matrix; B : Vector; MR:Matrix; from, to : Integer; begin Put_Line ("T2 started"); from:=H+1; to:=2*H; --Input B, MD Box.Input_B(1); for i in 1..N loop for j in 1..N loop MD(i)(j):=1; end loop; end loop; -- Input is finished Box.Signal1; -- Wait for other threads to finish input Box.Wait1; -- Copy data e:=Box.Copy_e; B:=Box.Copy_B; MC:=Box.Copy_MC; --Calculate A = B * (MC * MDH - MEH * e) for i in 1..N loop for j in from..to loop MR(i)(j):=0; for k in 1..N loop MR(i)(j):=MR(i)(j)+MC(i)(k)*MD(k)(j); end loop; MR(i)(j):=MR(i)(j)-ME(i)(j)*e; end loop; end loop; for j in from..to loop A(j):=0; for k in 1..N loop A(j):=A(j)+B(k)*MR(k)(j); end loop; end loop; Box.Wait2; if N <= 12 then for i in 1 .. N loop Put (A (i)); Put (" "); end loop; Put_Line (""); end if; Put_Line ("T2 finished"); end T2; task T3 is pragma Storage_Size (100000000); end T3; task body T3 is e : Integer; MC : Matrix; B : Vector; MR:Matrix; from, to : Integer; begin Put_Line ("T3 started"); from:=2*H+1; to:=3*H; --Input e, MC Box.Input_MC(1); Box.Input_e(1); -- Input is finished Box.Signal1; -- Wait for other threads to finish input Box.Wait1; -- Copy data e:=Box.Copy_e; B:=Box.Copy_B; MC:=Box.Copy_MC; --Calculate A = B * (MC * MDH - MEH * e) for i in 1..N loop for j in from..to loop MR(i)(j):=0; for k in 1..N loop MR(i)(j):=MR(i)(j)+MC(i)(k)*MD(k)(j); end loop; MR(i)(j):=MR(i)(j)-ME(i)(j)*e; end loop; end loop; for j in from..to loop A(j):=0; for k in 1..N loop A(j):=A(j)+B(k)*MR(k)(j); end loop; end loop; Box.Signal2; Put_Line ("T3 finished"); end T3; task T4 is pragma Storage_Size (100000000); end T4; task body T4 is e : Integer; MC : Matrix; B : Vector; MR:Matrix; from, to : Integer; begin Put_Line ("T4 started"); from:=3*H+1; to:=N; --Input ME for i in 1..N loop for j in 1..N loop ME(i)(j):=1; end loop; end loop; -- Input is finished Box.Signal1; -- Wait for other threads to finish input Box.Wait1; -- Copy data e:=Box.Copy_e; B:=Box.Copy_B; MC:=Box.Copy_MC; --Calculate A = B * (MC * MDH - MEH * e) for i in 1..N loop for j in from..to loop MR(i)(j):=0; for k in 1..N loop MR(i)(j):=MR(i)(j)+MC(i)(k)*MD(k)(j); end loop; MR(i)(j):=MR(i)(j)-ME(i)(j)*e; end loop; end loop; for j in from..to loop A(j):=0; for k in 1..N loop A(j):=A(j)+B(k)*MR(k)(j); end loop; end loop; Box.Signal2; Put_Line ("T4 finished"); end T4; begin null; end Start; begin startTime := Clock; Start; endTime:=Clock; Put("N: "); Put(N); Put_Line(""); Put("Time: "); Put(Integer(endTime-startTime),10); end Main;
1531
----------------------------------------- -- PRG1 -- -- A = B * (MC * MD - ME * e) -- -- <NAME> -- -- IP-53 -- ----------------------------------------- with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Synchronous_Task_Control; use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Synchronous_Task_Control; with Ada.Calendar; use Ada.Calendar; procedure Main is N : Integer := 900; P : Integer := 4; H : Integer := N / P; startTime : Time; endTime : Time; type Vector is array (1 .. N) of Integer; type Matrix is array (1 .. N) of Vector; A : Vector; MD,ME : Matrix; protected Box is function Copy_e return Integer; function Copy_B return Vector; function Copy_MC return Matrix; procedure Input_e (x: in Integer); procedure Input_B (x: in Integer); procedure Input_MC (x: in Integer); entry Wait1; entry Wait2; procedure Signal1; procedure Signal2; private e: Integer; B:Vector; MC : Matrix; F1 : Integer := 0; F2 : Integer := 0; end Box; protected body Box is function Copy_e return Integer is begin return e; end Copy_e; function Copy_B return Vector is begin return B; end Copy_B; function Copy_MC return Matrix is begin return MC; end Copy_MC; procedure Input_MC (x: in Integer)is begin for i in 1 .. N loop for j in 1 .. N loop MC(i)(j):=x; end loop; end loop; end Input_MC; procedure Input_B (x: in Integer)is begin for i in 1 .. N loop B(i):=x; end loop; end Input_B; procedure Input_e (x : in Integer) is begin e := x; end Input_e; entry Wait1 when F1 = 3 is begin null; end; entry Wait2 when F2 = 3 is begin null; end; procedure Signal1 is begin F1 := F1 + 1; end Signal1; procedure Signal2 is begin F2 := F2 + 1; end Signal2; end Box; procedure Start is task T1; task body T1 is e : Integer; MC : Matrix; B : Vector; MR:Matrix; from, to : Integer; begin Put_Line ("T1 started"); from:=1; to:=H; -- Wait for other threads to finish input Box.Wait1; -- Copy data e:=Box.Copy_e; B:=Box.Copy_B; MC:=Box.Copy_MC; --Calculate A = B * (MC * MDH - MEH * e) for i in 1..N loop for j in from..to loop MR(i)(j):=0; for k in 1..N loop MR(i)(j):=MR(i)(j)+MC(i)(k)*MD(k)(j); end loop; MR(i)(j):=MR(i)(j)-ME(i)(j)*e; end loop; end loop; for j in from..to loop A(j):=0; for k in 1..N loop A(j):=A(j)+B(k)*MR(k)(j); end loop; end loop; -- Signal for other threads to finish Box.Signal2; Put_Line ("T1 finished"); end T1; task T2 is pragma Storage_Size (100000000); end T2; task body T2 is e : Integer; MC : Matrix; B : Vector; MR:Matrix; from, to : Integer; begin Put_Line ("T2 started"); from:=H+1; to:=2*H; --Input B, MD Box.Input_B(1); for i in 1..N loop for j in 1..N loop MD(i)(j):=1; end loop; end loop; -- Input is finished Box.Signal1; -- Wait for other threads to finish input Box.Wait1; -- Copy data e:=Box.Copy_e; B:=Box.Copy_B; MC:=Box.Copy_MC; --Calculate A = B * (MC * MDH - MEH * e) for i in 1..N loop for j in from..to loop MR(i)(j):=0; for k in 1..N loop MR(i)(j):=MR(i)(j)+MC(i)(k)*MD(k)(j); end loop; MR(i)(j):=MR(i)(j)-ME(i)(j)*e; end loop; end loop; for j in from..to loop A(j):=0; for k in 1..N loop A(j):=A(j)+B(k)*MR(k)(j); end loop; end loop; Box.Wait2; if N <= 12 then for i in 1 .. N loop Put (A (i)); Put (" "); end loop; Put_Line (""); end if; Put_Line ("T2 finished"); end T2; task T3 is pragma Storage_Size (100000000); end T3; task body T3 is e : Integer; MC : Matrix; B : Vector; MR:Matrix; from, to : Integer; begin Put_Line ("T3 started"); from:=2*H+1; to:=3*H; --Input e, MC Box.Input_MC(1); Box.Input_e(1); -- Input is finished Box.Signal1; -- Wait for other threads to finish input Box.Wait1; -- Copy data e:=Box.Copy_e; B:=Box.Copy_B; MC:=Box.Copy_MC; --Calculate A = B * (MC * MDH - MEH * e) for i in 1..N loop for j in from..to loop MR(i)(j):=0; for k in 1..N loop MR(i)(j):=MR(i)(j)+MC(i)(k)*MD(k)(j); end loop; MR(i)(j):=MR(i)(j)-ME(i)(j)*e; end loop; end loop; for j in from..to loop A(j):=0; for k in 1..N loop A(j):=A(j)+B(k)*MR(k)(j); end loop; end loop; Box.Signal2; Put_Line ("T3 finished"); end T3; task T4 is pragma Storage_Size (100000000); end T4; task body T4 is e : Integer; MC : Matrix; B : Vector; MR:Matrix; from, to : Integer; begin Put_Line ("T4 started"); from:=3*H+1; to:=N; --Input ME for i in 1..N loop for j in 1..N loop ME(i)(j):=1; end loop; end loop; -- Input is finished Box.Signal1; -- Wait for other threads to finish input Box.Wait1; -- Copy data e:=Box.Copy_e; B:=Box.Copy_B; MC:=Box.Copy_MC; --Calculate A = B * (MC * MDH - MEH * e) for i in 1..N loop for j in from..to loop MR(i)(j):=0; for k in 1..N loop MR(i)(j):=MR(i)(j)+MC(i)(k)*MD(k)(j); end loop; MR(i)(j):=MR(i)(j)-ME(i)(j)*e; end loop; end loop; for j in from..to loop A(j):=0; for k in 1..N loop A(j):=A(j)+B(k)*MR(k)(j); end loop; end loop; Box.Signal2; Put_Line ("T4 finished"); end T4; begin null; end Start; begin startTime := Clock; Start; endTime:=Clock; Put("N: "); Put(N); Put_Line(""); Put("Time: "); Put(Integer(endTime-startTime),10); end Main;
true
----------------------------------------- -- PRG1 -- -- A = B * (MC * MD - ME * e) -- -- PI:NAME:<NAME>END_PI -- -- IP-53 -- ----------------------------------------- with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Synchronous_Task_Control; use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Synchronous_Task_Control; with Ada.Calendar; use Ada.Calendar; procedure Main is N : Integer := 900; P : Integer := 4; H : Integer := N / P; startTime : Time; endTime : Time; type Vector is array (1 .. N) of Integer; type Matrix is array (1 .. N) of Vector; A : Vector; MD,ME : Matrix; protected Box is function Copy_e return Integer; function Copy_B return Vector; function Copy_MC return Matrix; procedure Input_e (x: in Integer); procedure Input_B (x: in Integer); procedure Input_MC (x: in Integer); entry Wait1; entry Wait2; procedure Signal1; procedure Signal2; private e: Integer; B:Vector; MC : Matrix; F1 : Integer := 0; F2 : Integer := 0; end Box; protected body Box is function Copy_e return Integer is begin return e; end Copy_e; function Copy_B return Vector is begin return B; end Copy_B; function Copy_MC return Matrix is begin return MC; end Copy_MC; procedure Input_MC (x: in Integer)is begin for i in 1 .. N loop for j in 1 .. N loop MC(i)(j):=x; end loop; end loop; end Input_MC; procedure Input_B (x: in Integer)is begin for i in 1 .. N loop B(i):=x; end loop; end Input_B; procedure Input_e (x : in Integer) is begin e := x; end Input_e; entry Wait1 when F1 = 3 is begin null; end; entry Wait2 when F2 = 3 is begin null; end; procedure Signal1 is begin F1 := F1 + 1; end Signal1; procedure Signal2 is begin F2 := F2 + 1; end Signal2; end Box; procedure Start is task T1; task body T1 is e : Integer; MC : Matrix; B : Vector; MR:Matrix; from, to : Integer; begin Put_Line ("T1 started"); from:=1; to:=H; -- Wait for other threads to finish input Box.Wait1; -- Copy data e:=Box.Copy_e; B:=Box.Copy_B; MC:=Box.Copy_MC; --Calculate A = B * (MC * MDH - MEH * e) for i in 1..N loop for j in from..to loop MR(i)(j):=0; for k in 1..N loop MR(i)(j):=MR(i)(j)+MC(i)(k)*MD(k)(j); end loop; MR(i)(j):=MR(i)(j)-ME(i)(j)*e; end loop; end loop; for j in from..to loop A(j):=0; for k in 1..N loop A(j):=A(j)+B(k)*MR(k)(j); end loop; end loop; -- Signal for other threads to finish Box.Signal2; Put_Line ("T1 finished"); end T1; task T2 is pragma Storage_Size (100000000); end T2; task body T2 is e : Integer; MC : Matrix; B : Vector; MR:Matrix; from, to : Integer; begin Put_Line ("T2 started"); from:=H+1; to:=2*H; --Input B, MD Box.Input_B(1); for i in 1..N loop for j in 1..N loop MD(i)(j):=1; end loop; end loop; -- Input is finished Box.Signal1; -- Wait for other threads to finish input Box.Wait1; -- Copy data e:=Box.Copy_e; B:=Box.Copy_B; MC:=Box.Copy_MC; --Calculate A = B * (MC * MDH - MEH * e) for i in 1..N loop for j in from..to loop MR(i)(j):=0; for k in 1..N loop MR(i)(j):=MR(i)(j)+MC(i)(k)*MD(k)(j); end loop; MR(i)(j):=MR(i)(j)-ME(i)(j)*e; end loop; end loop; for j in from..to loop A(j):=0; for k in 1..N loop A(j):=A(j)+B(k)*MR(k)(j); end loop; end loop; Box.Wait2; if N <= 12 then for i in 1 .. N loop Put (A (i)); Put (" "); end loop; Put_Line (""); end if; Put_Line ("T2 finished"); end T2; task T3 is pragma Storage_Size (100000000); end T3; task body T3 is e : Integer; MC : Matrix; B : Vector; MR:Matrix; from, to : Integer; begin Put_Line ("T3 started"); from:=2*H+1; to:=3*H; --Input e, MC Box.Input_MC(1); Box.Input_e(1); -- Input is finished Box.Signal1; -- Wait for other threads to finish input Box.Wait1; -- Copy data e:=Box.Copy_e; B:=Box.Copy_B; MC:=Box.Copy_MC; --Calculate A = B * (MC * MDH - MEH * e) for i in 1..N loop for j in from..to loop MR(i)(j):=0; for k in 1..N loop MR(i)(j):=MR(i)(j)+MC(i)(k)*MD(k)(j); end loop; MR(i)(j):=MR(i)(j)-ME(i)(j)*e; end loop; end loop; for j in from..to loop A(j):=0; for k in 1..N loop A(j):=A(j)+B(k)*MR(k)(j); end loop; end loop; Box.Signal2; Put_Line ("T3 finished"); end T3; task T4 is pragma Storage_Size (100000000); end T4; task body T4 is e : Integer; MC : Matrix; B : Vector; MR:Matrix; from, to : Integer; begin Put_Line ("T4 started"); from:=3*H+1; to:=N; --Input ME for i in 1..N loop for j in 1..N loop ME(i)(j):=1; end loop; end loop; -- Input is finished Box.Signal1; -- Wait for other threads to finish input Box.Wait1; -- Copy data e:=Box.Copy_e; B:=Box.Copy_B; MC:=Box.Copy_MC; --Calculate A = B * (MC * MDH - MEH * e) for i in 1..N loop for j in from..to loop MR(i)(j):=0; for k in 1..N loop MR(i)(j):=MR(i)(j)+MC(i)(k)*MD(k)(j); end loop; MR(i)(j):=MR(i)(j)-ME(i)(j)*e; end loop; end loop; for j in from..to loop A(j):=0; for k in 1..N loop A(j):=A(j)+B(k)*MR(k)(j); end loop; end loop; Box.Signal2; Put_Line ("T4 finished"); end T4; begin null; end Start; begin startTime := Clock; Start; endTime:=Clock; Put("N: "); Put(N); Put_Line(""); Put("Time: "); Put(Integer(endTime-startTime),10); end Main;
[ { "context": " --\n-- Copyright © 2012-2014, Vadim Godunko <vgodunko@gmail.com> --\n-- All rig", "end": 829, "score": 0.9998852610588074, "start": 816, "tag": "NAME", "value": "Vadim Godunko" }, { "context": " --\n-- Copyright © 2012-2014, Vadim Godunko <vgodunko@gmail.com> --\n-- All rights reserved. ", "end": 849, "score": 0.9999324083328247, "start": 831, "tag": "EMAIL", "value": "vgodunko@gmail.com" } ]
source/sql/mysql/matreshka-internals-sql_drivers-mysql-databases.adb
svn2github/matreshka
24
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2014, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.Internals.SQL_Drivers.MySQL.Queries; package body Matreshka.Internals.SQL_Drivers.MySQL.Databases is use type Interfaces.C.char_array; use type Interfaces.C.int; UTF8_Encoding : constant Interfaces.C.char_array := "utf8mb4" & Interfaces.C.nul; procedure Set_MySQL_Error (Self : not null access MySQL_Database'Class); -- Sets error message to reported by database. procedure Execute_Query (Self : not null access MySQL_Database'Class; Query : String; Success : in out Boolean); -- Internal subprogram to executre simple parameter-less and result-less -- queries at connection initialization time. ----------- -- Close -- ----------- overriding procedure Close (Self : not null access MySQL_Database) is begin if Self.Handle /= null then mysql_close (Self.Handle); Self.Handle := null; end if; end Close; ------------ -- Commit -- ------------ overriding procedure Commit (Self : not null access MySQL_Database) is begin raise Program_Error; end Commit; --------------------- -- Database_Handle -- --------------------- function Database_Handle (Self : not null access constant MySQL_Database'Class) return MYSQL_Access is begin return Self.Handle; end Database_Handle; ------------------- -- Error_Message -- ------------------- overriding function Error_Message (Self : not null access MySQL_Database) return League.Strings.Universal_String is begin return Self.Error; end Error_Message; ------------------- -- Execute_Query -- ------------------- procedure Execute_Query (Self : not null access MySQL_Database'Class; Query : String; Success : in out Boolean) is procedure Set_MySQL_Stmt_Error; Handle : MYSQL_STMT_Access; C_Query : Interfaces.C.Strings.chars_ptr; Status : Interfaces.C.int; B_Status : my_bool; -------------------------- -- Set_MySQL_Stmt_Error -- -------------------------- procedure Set_MySQL_Stmt_Error is begin Self.Error := League.Strings.From_UTF_8_String (Interfaces.C.Strings.Value (mysql_stmt_error (Handle))); Success := False; end Set_MySQL_Stmt_Error; begin if not Success then -- Return immidiately when error condition had been detected. It -- allows to write sequence of call to Execute_Query without -- intermediate check for error conditions. return; end if; -- Allocate statement handle. Handle := mysql_stmt_init (Self.Database_Handle); if Handle = null then Self.Error := League.Strings.To_Universal_String ("out of memory"); Success := False; return; end if; -- Prepare statement. C_Query := Interfaces.C.Strings.New_String (Query); Status := mysql_stmt_prepare (Handle, C_Query, Interfaces.C.unsigned_long (Interfaces.C.Strings.Strlen (C_Query))); Interfaces.C.Strings.Free (C_Query); if Status /= 0 then Set_MySQL_Stmt_Error; return; end if; -- Execute statement. Status := mysql_stmt_execute (Handle); if Status /= 0 then Set_MySQL_Stmt_Error; return; end if; -- Deallocate statement. B_Status := mysql_stmt_close (Handle); if B_Status /= 0 then Set_MySQL_Stmt_Error; return; end if; end Execute_Query; -------------- -- Finalize -- -------------- overriding procedure Finalize (Self : not null access MySQL_Database) is begin if Self.Handle /= null then Self.Close; end if; end Finalize; ---------- -- Open -- ---------- overriding function Open (Self : not null access MySQL_Database; Options : SQL.Options.SQL_Options) return Boolean is Database_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("database"); Host_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("host"); Password_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("password"); Port_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("port"); Socket_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("socket"); User_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("user"); Host_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; User_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; Password_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; Database_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; Port_Option : Interfaces.C.unsigned := 0; Socket_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; Result : MYSQL_Access; Success : Boolean; begin -- Initialize handle. Self.Handle := mysql_init (null); if Self.Handle = null then Self.Error := League.Strings.To_Universal_String ("insufficient memory to allocate a new object"); return False; end if; -- Set client character encoding to 'utf-8'. if mysql_options (Self.Handle, MYSQL_SET_CHARSET_NAME, UTF8_Encoding) /= 0 then Self.Error := League.Strings.To_Universal_String ("unknown option"); return False; end if; -- Prepare options. if Options.Is_Set (Host_Name) then Host_Option := Interfaces.C.Strings.New_String (Options.Get (Host_Name).To_UTF_8_String); end if; if Options.Is_Set (User_Name) then User_Option := Interfaces.C.Strings.New_String (Options.Get (User_Name).To_UTF_8_String); end if; if Options.Is_Set (Password_Name) then Password_Option := Interfaces.C.Strings.New_String (Options.Get (Password_Name).To_UTF_8_String); end if; if Options.Is_Set (Database_Name) then Database_Option := Interfaces.C.Strings.New_String (Options.Get (Database_Name).To_UTF_8_String); end if; if Options.Is_Set (Port_Name) then Port_Option := Interfaces.C.unsigned'Wide_Wide_Value (Options.Get (Port_Name).To_Wide_Wide_String); end if; if Options.Is_Set (Socket_Name) then Socket_Option := Interfaces.C.Strings.New_String (Options.Get (Socket_Name).To_UTF_8_String); end if; -- Connect to database. Result := mysql_real_connect (Self.Handle, Host_Option, User_Option, Password_Option, Database_Option, Port_Option, Socket_Option, 0); -- Cleanup options. Interfaces.C.Strings.Free (Host_Option); Interfaces.C.Strings.Free (User_Option); Interfaces.C.Strings.Free (Password_Option); Interfaces.C.Strings.Free (Database_Option); Interfaces.C.Strings.Free (Socket_Option); -- Check result of operation. if Result = null then Self.Set_MySQL_Error; return False; end if; -- Configure connection. Success := True; -- Set time_zone variable to UTC. Driver assumes that all date/time -- types are represented as UTC time. Execute_Query (Self, "SET time_zone = '+00:00'", Success); return Success; end Open; ----------- -- Query -- ----------- overriding function Query (Self : not null access MySQL_Database) return not null Query_Access is begin return Result : constant not null Query_Access := new Queries.MySQL_Query do Queries.Initialize (Queries.MySQL_Query'Class (Result.all)'Access, Self); end return; end Query; --------------------- -- Set_MySQL_Error -- --------------------- procedure Set_MySQL_Error (Self : not null access MySQL_Database'Class) is Error : constant String := Interfaces.C.Strings.Value (mysql_error (Self.Handle)); begin Self.Error := League.Strings.From_UTF_8_String (Error); end Set_MySQL_Error; end Matreshka.Internals.SQL_Drivers.MySQL.Databases;
28491
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2014, <NAME> <<EMAIL>> -- -- 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.SQL_Drivers.MySQL.Queries; package body Matreshka.Internals.SQL_Drivers.MySQL.Databases is use type Interfaces.C.char_array; use type Interfaces.C.int; UTF8_Encoding : constant Interfaces.C.char_array := "utf8mb4" & Interfaces.C.nul; procedure Set_MySQL_Error (Self : not null access MySQL_Database'Class); -- Sets error message to reported by database. procedure Execute_Query (Self : not null access MySQL_Database'Class; Query : String; Success : in out Boolean); -- Internal subprogram to executre simple parameter-less and result-less -- queries at connection initialization time. ----------- -- Close -- ----------- overriding procedure Close (Self : not null access MySQL_Database) is begin if Self.Handle /= null then mysql_close (Self.Handle); Self.Handle := null; end if; end Close; ------------ -- Commit -- ------------ overriding procedure Commit (Self : not null access MySQL_Database) is begin raise Program_Error; end Commit; --------------------- -- Database_Handle -- --------------------- function Database_Handle (Self : not null access constant MySQL_Database'Class) return MYSQL_Access is begin return Self.Handle; end Database_Handle; ------------------- -- Error_Message -- ------------------- overriding function Error_Message (Self : not null access MySQL_Database) return League.Strings.Universal_String is begin return Self.Error; end Error_Message; ------------------- -- Execute_Query -- ------------------- procedure Execute_Query (Self : not null access MySQL_Database'Class; Query : String; Success : in out Boolean) is procedure Set_MySQL_Stmt_Error; Handle : MYSQL_STMT_Access; C_Query : Interfaces.C.Strings.chars_ptr; Status : Interfaces.C.int; B_Status : my_bool; -------------------------- -- Set_MySQL_Stmt_Error -- -------------------------- procedure Set_MySQL_Stmt_Error is begin Self.Error := League.Strings.From_UTF_8_String (Interfaces.C.Strings.Value (mysql_stmt_error (Handle))); Success := False; end Set_MySQL_Stmt_Error; begin if not Success then -- Return immidiately when error condition had been detected. It -- allows to write sequence of call to Execute_Query without -- intermediate check for error conditions. return; end if; -- Allocate statement handle. Handle := mysql_stmt_init (Self.Database_Handle); if Handle = null then Self.Error := League.Strings.To_Universal_String ("out of memory"); Success := False; return; end if; -- Prepare statement. C_Query := Interfaces.C.Strings.New_String (Query); Status := mysql_stmt_prepare (Handle, C_Query, Interfaces.C.unsigned_long (Interfaces.C.Strings.Strlen (C_Query))); Interfaces.C.Strings.Free (C_Query); if Status /= 0 then Set_MySQL_Stmt_Error; return; end if; -- Execute statement. Status := mysql_stmt_execute (Handle); if Status /= 0 then Set_MySQL_Stmt_Error; return; end if; -- Deallocate statement. B_Status := mysql_stmt_close (Handle); if B_Status /= 0 then Set_MySQL_Stmt_Error; return; end if; end Execute_Query; -------------- -- Finalize -- -------------- overriding procedure Finalize (Self : not null access MySQL_Database) is begin if Self.Handle /= null then Self.Close; end if; end Finalize; ---------- -- Open -- ---------- overriding function Open (Self : not null access MySQL_Database; Options : SQL.Options.SQL_Options) return Boolean is Database_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("database"); Host_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("host"); Password_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("password"); Port_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("port"); Socket_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("socket"); User_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("user"); Host_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; User_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; Password_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; Database_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; Port_Option : Interfaces.C.unsigned := 0; Socket_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; Result : MYSQL_Access; Success : Boolean; begin -- Initialize handle. Self.Handle := mysql_init (null); if Self.Handle = null then Self.Error := League.Strings.To_Universal_String ("insufficient memory to allocate a new object"); return False; end if; -- Set client character encoding to 'utf-8'. if mysql_options (Self.Handle, MYSQL_SET_CHARSET_NAME, UTF8_Encoding) /= 0 then Self.Error := League.Strings.To_Universal_String ("unknown option"); return False; end if; -- Prepare options. if Options.Is_Set (Host_Name) then Host_Option := Interfaces.C.Strings.New_String (Options.Get (Host_Name).To_UTF_8_String); end if; if Options.Is_Set (User_Name) then User_Option := Interfaces.C.Strings.New_String (Options.Get (User_Name).To_UTF_8_String); end if; if Options.Is_Set (Password_Name) then Password_Option := Interfaces.C.Strings.New_String (Options.Get (Password_Name).To_UTF_8_String); end if; if Options.Is_Set (Database_Name) then Database_Option := Interfaces.C.Strings.New_String (Options.Get (Database_Name).To_UTF_8_String); end if; if Options.Is_Set (Port_Name) then Port_Option := Interfaces.C.unsigned'Wide_Wide_Value (Options.Get (Port_Name).To_Wide_Wide_String); end if; if Options.Is_Set (Socket_Name) then Socket_Option := Interfaces.C.Strings.New_String (Options.Get (Socket_Name).To_UTF_8_String); end if; -- Connect to database. Result := mysql_real_connect (Self.Handle, Host_Option, User_Option, Password_Option, Database_Option, Port_Option, Socket_Option, 0); -- Cleanup options. Interfaces.C.Strings.Free (Host_Option); Interfaces.C.Strings.Free (User_Option); Interfaces.C.Strings.Free (Password_Option); Interfaces.C.Strings.Free (Database_Option); Interfaces.C.Strings.Free (Socket_Option); -- Check result of operation. if Result = null then Self.Set_MySQL_Error; return False; end if; -- Configure connection. Success := True; -- Set time_zone variable to UTC. Driver assumes that all date/time -- types are represented as UTC time. Execute_Query (Self, "SET time_zone = '+00:00'", Success); return Success; end Open; ----------- -- Query -- ----------- overriding function Query (Self : not null access MySQL_Database) return not null Query_Access is begin return Result : constant not null Query_Access := new Queries.MySQL_Query do Queries.Initialize (Queries.MySQL_Query'Class (Result.all)'Access, Self); end return; end Query; --------------------- -- Set_MySQL_Error -- --------------------- procedure Set_MySQL_Error (Self : not null access MySQL_Database'Class) is Error : constant String := Interfaces.C.Strings.Value (mysql_error (Self.Handle)); begin Self.Error := League.Strings.From_UTF_8_String (Error); end Set_MySQL_Error; end Matreshka.Internals.SQL_Drivers.MySQL.Databases;
true
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2014, PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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.SQL_Drivers.MySQL.Queries; package body Matreshka.Internals.SQL_Drivers.MySQL.Databases is use type Interfaces.C.char_array; use type Interfaces.C.int; UTF8_Encoding : constant Interfaces.C.char_array := "utf8mb4" & Interfaces.C.nul; procedure Set_MySQL_Error (Self : not null access MySQL_Database'Class); -- Sets error message to reported by database. procedure Execute_Query (Self : not null access MySQL_Database'Class; Query : String; Success : in out Boolean); -- Internal subprogram to executre simple parameter-less and result-less -- queries at connection initialization time. ----------- -- Close -- ----------- overriding procedure Close (Self : not null access MySQL_Database) is begin if Self.Handle /= null then mysql_close (Self.Handle); Self.Handle := null; end if; end Close; ------------ -- Commit -- ------------ overriding procedure Commit (Self : not null access MySQL_Database) is begin raise Program_Error; end Commit; --------------------- -- Database_Handle -- --------------------- function Database_Handle (Self : not null access constant MySQL_Database'Class) return MYSQL_Access is begin return Self.Handle; end Database_Handle; ------------------- -- Error_Message -- ------------------- overriding function Error_Message (Self : not null access MySQL_Database) return League.Strings.Universal_String is begin return Self.Error; end Error_Message; ------------------- -- Execute_Query -- ------------------- procedure Execute_Query (Self : not null access MySQL_Database'Class; Query : String; Success : in out Boolean) is procedure Set_MySQL_Stmt_Error; Handle : MYSQL_STMT_Access; C_Query : Interfaces.C.Strings.chars_ptr; Status : Interfaces.C.int; B_Status : my_bool; -------------------------- -- Set_MySQL_Stmt_Error -- -------------------------- procedure Set_MySQL_Stmt_Error is begin Self.Error := League.Strings.From_UTF_8_String (Interfaces.C.Strings.Value (mysql_stmt_error (Handle))); Success := False; end Set_MySQL_Stmt_Error; begin if not Success then -- Return immidiately when error condition had been detected. It -- allows to write sequence of call to Execute_Query without -- intermediate check for error conditions. return; end if; -- Allocate statement handle. Handle := mysql_stmt_init (Self.Database_Handle); if Handle = null then Self.Error := League.Strings.To_Universal_String ("out of memory"); Success := False; return; end if; -- Prepare statement. C_Query := Interfaces.C.Strings.New_String (Query); Status := mysql_stmt_prepare (Handle, C_Query, Interfaces.C.unsigned_long (Interfaces.C.Strings.Strlen (C_Query))); Interfaces.C.Strings.Free (C_Query); if Status /= 0 then Set_MySQL_Stmt_Error; return; end if; -- Execute statement. Status := mysql_stmt_execute (Handle); if Status /= 0 then Set_MySQL_Stmt_Error; return; end if; -- Deallocate statement. B_Status := mysql_stmt_close (Handle); if B_Status /= 0 then Set_MySQL_Stmt_Error; return; end if; end Execute_Query; -------------- -- Finalize -- -------------- overriding procedure Finalize (Self : not null access MySQL_Database) is begin if Self.Handle /= null then Self.Close; end if; end Finalize; ---------- -- Open -- ---------- overriding function Open (Self : not null access MySQL_Database; Options : SQL.Options.SQL_Options) return Boolean is Database_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("database"); Host_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("host"); Password_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("password"); Port_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("port"); Socket_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("socket"); User_Name : constant League.Strings.Universal_String := League.Strings.To_Universal_String ("user"); Host_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; User_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; Password_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; Database_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; Port_Option : Interfaces.C.unsigned := 0; Socket_Option : Interfaces.C.Strings.chars_ptr := Interfaces.C.Strings.Null_Ptr; Result : MYSQL_Access; Success : Boolean; begin -- Initialize handle. Self.Handle := mysql_init (null); if Self.Handle = null then Self.Error := League.Strings.To_Universal_String ("insufficient memory to allocate a new object"); return False; end if; -- Set client character encoding to 'utf-8'. if mysql_options (Self.Handle, MYSQL_SET_CHARSET_NAME, UTF8_Encoding) /= 0 then Self.Error := League.Strings.To_Universal_String ("unknown option"); return False; end if; -- Prepare options. if Options.Is_Set (Host_Name) then Host_Option := Interfaces.C.Strings.New_String (Options.Get (Host_Name).To_UTF_8_String); end if; if Options.Is_Set (User_Name) then User_Option := Interfaces.C.Strings.New_String (Options.Get (User_Name).To_UTF_8_String); end if; if Options.Is_Set (Password_Name) then Password_Option := Interfaces.C.Strings.New_String (Options.Get (Password_Name).To_UTF_8_String); end if; if Options.Is_Set (Database_Name) then Database_Option := Interfaces.C.Strings.New_String (Options.Get (Database_Name).To_UTF_8_String); end if; if Options.Is_Set (Port_Name) then Port_Option := Interfaces.C.unsigned'Wide_Wide_Value (Options.Get (Port_Name).To_Wide_Wide_String); end if; if Options.Is_Set (Socket_Name) then Socket_Option := Interfaces.C.Strings.New_String (Options.Get (Socket_Name).To_UTF_8_String); end if; -- Connect to database. Result := mysql_real_connect (Self.Handle, Host_Option, User_Option, Password_Option, Database_Option, Port_Option, Socket_Option, 0); -- Cleanup options. Interfaces.C.Strings.Free (Host_Option); Interfaces.C.Strings.Free (User_Option); Interfaces.C.Strings.Free (Password_Option); Interfaces.C.Strings.Free (Database_Option); Interfaces.C.Strings.Free (Socket_Option); -- Check result of operation. if Result = null then Self.Set_MySQL_Error; return False; end if; -- Configure connection. Success := True; -- Set time_zone variable to UTC. Driver assumes that all date/time -- types are represented as UTC time. Execute_Query (Self, "SET time_zone = '+00:00'", Success); return Success; end Open; ----------- -- Query -- ----------- overriding function Query (Self : not null access MySQL_Database) return not null Query_Access is begin return Result : constant not null Query_Access := new Queries.MySQL_Query do Queries.Initialize (Queries.MySQL_Query'Class (Result.all)'Access, Self); end return; end Query; --------------------- -- Set_MySQL_Error -- --------------------- procedure Set_MySQL_Error (Self : not null access MySQL_Database'Class) is Error : constant String := Interfaces.C.Strings.Value (mysql_error (Self.Handle)); begin Self.Error := League.Strings.From_UTF_8_String (Error); end Set_MySQL_Error; end Matreshka.Internals.SQL_Drivers.MySQL.Databases;
[ { "context": "-- Copyright (c) 2021 Bartek thindil Jasicki <thindil@laeran.pl>\n--\n-- This program is free so", "end": 44, "score": 0.9998777508735657, "start": 22, "tag": "NAME", "value": "Bartek thindil Jasicki" }, { "context": "-- Copyright (c) 2021 Bartek thindil Jasicki <thindil@laeran.pl>\n--\n-- This program is free software: you can red", "end": 63, "score": 0.9999339580535889, "start": 46, "tag": "EMAIL", "value": "thindil@laeran.pl" } ]
src/ui/dialogs.ads
thindil/steamsky
80
-- Copyright (c) 2021 Bartek thindil Jasicki <thindil@laeran.pl> -- -- 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 Interfaces.C; use Interfaces.C; with CArgv; with Tcl.Tk.Ada.Widgets.TtkFrame; use Tcl.Tk.Ada.Widgets.TtkFrame; with Game; use Game; with Items; use Items; -- ****h* Dialogs/Dialogs -- FUNCTION -- Provide code to show various in game dialogs (messages, questins, etc) -- SOURCE package Dialogs is -- **** -- ****f* Dialogs/Dialogs.Create_Dialog -- FUNCTION -- Create a new dialog with the selected title -- PARAMETERS -- Name - The Tk path name of the new dialog -- Title - The title of the new dialog -- Title_Width - The maximum width of the title. Used to set wrapping for -- it. Default value is 275 pixels. Can be empty. -- Columns - The amount of columns which dialog will have. Used to set -- the title. Default value is 1 column. Can be empty. -- RESULT -- The newly created Dialog as Ttk_Frame -- SOURCE function Create_Dialog (Name, Title: String; Title_Width: Positive := 275; Columns: Positive := 1; Parent_Name: String := ".gameframe") return Ttk_Frame; -- **** -- ****f* Dialogs/Dialogs.Add_Close_Button -- FUNCTION -- Add button to close the selected dialog and set proper bindings for -- it. -- PARAMETERS -- Name - The Tk path name for the button -- Text - The text to display on the button -- Command - The Tcl command to run when the button was clicked -- Columnspan - The amount of columns to merge when placing the close -- button. Can be empty. Default value is 1 (no merging). -- Row - The row in which the button will be placed. Can be empty. -- Default value is 0 (place button in the next row) -- SOURCE procedure Add_Close_Button (Name, Text, Command: String; ColumnSpan: Positive := 1; Row: Natural := 0); -- **** -- ****f* Dialogs/Dialogs.Show_Dialog -- FUNCTION -- Show the selected dialog to the player -- PARAMETERS -- Dialog - The dialog which will be shown -- Parent_Frame - The parent frame name for the dialog. Can be empty. -- Default value is .gameframe -- With_Timer - If True, add timer to the dialog. Can be empty. Default -- value is False -- Relative_X - Relative X coordinate inside of parent frame for the -- dialog. 0.0 is left border. Can be empty. Default value -- is 0.3 -- Relative_Y - Relative Y coordinate inside of parent frame for the -- dialog. 0.0 is top border. Can be empty. Default value is -- 0.3 -- SOURCE procedure Show_Dialog (Dialog: Ttk_Frame; Parent_Frame: String := ".gameframe"; With_Timer: Boolean := False; Relative_X, Relative_Y: Damage_Factor := 0.3); -- **** -- ****o* Dialogs/Dialogs.Close_Dialog_Command -- FUNCTION -- Close the selected dialog -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. -- Argc - Number of arguments passed to the command. -- Argv - Values of arguments passed to the command. -- RESULT -- This function always return TCL_OK -- COMMANDS -- CloseDialog dialogname -- Dialogname is name of the dialog to close -- SOURCE function Close_Dialog_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** -- ****f* Dialogs/Dialogs.Add_Commands -- FUNCTION -- Add Tcl commands related to dialogs -- SOURCE procedure Add_Commands; -- **** -- ****f* Dialogs/Dialogs.ShowMessage -- FUNCTION -- Show the selected message to a player -- PARAMETERS -- Text - Text of message to show -- ParentFrame - The parent frame of the message dialog. Default is -- the game frame. Can be empty -- Title - The text show in the dialog header. -- SOURCE procedure ShowMessage (Text: String; ParentFrame: String := ".gameframe"; Title: String) with Pre => Text'Length > 0 and ParentFrame'Length > 0; -- **** -- ****f* Dialogs/Dialogs.ShowInfo -- FUNCTION -- Show the selected info to a player -- PARAMETERS -- Text - Text of info to show -- ParentName - Name of the parent widget. If empty, then the main game -- window will be used as parent for widget. Default value -- is .gameframe -- Title - The text show in the dialog header. -- SOURCE procedure ShowInfo (Text: String; ParentName: String := ".gameframe"; Title: String) with Pre => Text'Length > 0 and ParentName'Length > 0; -- **** -- ****f* Dialogs/Dialogs.ShowManipulateItem -- FUNCTION -- Show the dialog for manipulate items amount in cargo (like selling, -- dropping, etc). -- PARAMETERS -- Title - Title of the dialog -- Command - Tcl command which will be executed when the player hit -- the button Ok -- Action - The name of action which the player is doing (like drop, -- sell, ect) -- ItemIndex - The index of the item which will be manipulated -- MaxAmount - Max amount of the items to manipualate. If zero, use max -- amount of items from player ship cargo. Default value is -- zero. -- Cost - The cost (in buying) or gain (in selling) for one item in -- the game money. Can be zero. Default value is zero. -- SOURCE procedure ShowManipulateItem (Title, Command, Action: String; ItemIndex: Inventory_Container.Extended_Index; MaxAmount, Cost: Natural := 0) with Pre => Title'Length > 0 and Command'Length > 0; -- **** -- ****f* Dialogs/Dialogs.ShowQuestion -- FUNCTION -- Show the dialog with question to the player -- PARAMETERS -- Question - The question which will be the player asked for -- Result - The value set for Ok button -- In_Game - The question in show during game -- HISTORY -- 5.9 - Added -- SOURCE procedure ShowQuestion (Question, Result: String; In_Game: Boolean := True) with Pre => Question'Length > 0; -- **** end Dialogs;
30527
-- Copyright (c) 2021 <NAME> <<EMAIL>> -- -- 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 Interfaces.C; use Interfaces.C; with CArgv; with Tcl.Tk.Ada.Widgets.TtkFrame; use Tcl.Tk.Ada.Widgets.TtkFrame; with Game; use Game; with Items; use Items; -- ****h* Dialogs/Dialogs -- FUNCTION -- Provide code to show various in game dialogs (messages, questins, etc) -- SOURCE package Dialogs is -- **** -- ****f* Dialogs/Dialogs.Create_Dialog -- FUNCTION -- Create a new dialog with the selected title -- PARAMETERS -- Name - The Tk path name of the new dialog -- Title - The title of the new dialog -- Title_Width - The maximum width of the title. Used to set wrapping for -- it. Default value is 275 pixels. Can be empty. -- Columns - The amount of columns which dialog will have. Used to set -- the title. Default value is 1 column. Can be empty. -- RESULT -- The newly created Dialog as Ttk_Frame -- SOURCE function Create_Dialog (Name, Title: String; Title_Width: Positive := 275; Columns: Positive := 1; Parent_Name: String := ".gameframe") return Ttk_Frame; -- **** -- ****f* Dialogs/Dialogs.Add_Close_Button -- FUNCTION -- Add button to close the selected dialog and set proper bindings for -- it. -- PARAMETERS -- Name - The Tk path name for the button -- Text - The text to display on the button -- Command - The Tcl command to run when the button was clicked -- Columnspan - The amount of columns to merge when placing the close -- button. Can be empty. Default value is 1 (no merging). -- Row - The row in which the button will be placed. Can be empty. -- Default value is 0 (place button in the next row) -- SOURCE procedure Add_Close_Button (Name, Text, Command: String; ColumnSpan: Positive := 1; Row: Natural := 0); -- **** -- ****f* Dialogs/Dialogs.Show_Dialog -- FUNCTION -- Show the selected dialog to the player -- PARAMETERS -- Dialog - The dialog which will be shown -- Parent_Frame - The parent frame name for the dialog. Can be empty. -- Default value is .gameframe -- With_Timer - If True, add timer to the dialog. Can be empty. Default -- value is False -- Relative_X - Relative X coordinate inside of parent frame for the -- dialog. 0.0 is left border. Can be empty. Default value -- is 0.3 -- Relative_Y - Relative Y coordinate inside of parent frame for the -- dialog. 0.0 is top border. Can be empty. Default value is -- 0.3 -- SOURCE procedure Show_Dialog (Dialog: Ttk_Frame; Parent_Frame: String := ".gameframe"; With_Timer: Boolean := False; Relative_X, Relative_Y: Damage_Factor := 0.3); -- **** -- ****o* Dialogs/Dialogs.Close_Dialog_Command -- FUNCTION -- Close the selected dialog -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. -- Argc - Number of arguments passed to the command. -- Argv - Values of arguments passed to the command. -- RESULT -- This function always return TCL_OK -- COMMANDS -- CloseDialog dialogname -- Dialogname is name of the dialog to close -- SOURCE function Close_Dialog_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** -- ****f* Dialogs/Dialogs.Add_Commands -- FUNCTION -- Add Tcl commands related to dialogs -- SOURCE procedure Add_Commands; -- **** -- ****f* Dialogs/Dialogs.ShowMessage -- FUNCTION -- Show the selected message to a player -- PARAMETERS -- Text - Text of message to show -- ParentFrame - The parent frame of the message dialog. Default is -- the game frame. Can be empty -- Title - The text show in the dialog header. -- SOURCE procedure ShowMessage (Text: String; ParentFrame: String := ".gameframe"; Title: String) with Pre => Text'Length > 0 and ParentFrame'Length > 0; -- **** -- ****f* Dialogs/Dialogs.ShowInfo -- FUNCTION -- Show the selected info to a player -- PARAMETERS -- Text - Text of info to show -- ParentName - Name of the parent widget. If empty, then the main game -- window will be used as parent for widget. Default value -- is .gameframe -- Title - The text show in the dialog header. -- SOURCE procedure ShowInfo (Text: String; ParentName: String := ".gameframe"; Title: String) with Pre => Text'Length > 0 and ParentName'Length > 0; -- **** -- ****f* Dialogs/Dialogs.ShowManipulateItem -- FUNCTION -- Show the dialog for manipulate items amount in cargo (like selling, -- dropping, etc). -- PARAMETERS -- Title - Title of the dialog -- Command - Tcl command which will be executed when the player hit -- the button Ok -- Action - The name of action which the player is doing (like drop, -- sell, ect) -- ItemIndex - The index of the item which will be manipulated -- MaxAmount - Max amount of the items to manipualate. If zero, use max -- amount of items from player ship cargo. Default value is -- zero. -- Cost - The cost (in buying) or gain (in selling) for one item in -- the game money. Can be zero. Default value is zero. -- SOURCE procedure ShowManipulateItem (Title, Command, Action: String; ItemIndex: Inventory_Container.Extended_Index; MaxAmount, Cost: Natural := 0) with Pre => Title'Length > 0 and Command'Length > 0; -- **** -- ****f* Dialogs/Dialogs.ShowQuestion -- FUNCTION -- Show the dialog with question to the player -- PARAMETERS -- Question - The question which will be the player asked for -- Result - The value set for Ok button -- In_Game - The question in show during game -- HISTORY -- 5.9 - Added -- SOURCE procedure ShowQuestion (Question, Result: String; In_Game: Boolean := True) with Pre => Question'Length > 0; -- **** end Dialogs;
true
-- Copyright (c) 2021 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- 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 Interfaces.C; use Interfaces.C; with CArgv; with Tcl.Tk.Ada.Widgets.TtkFrame; use Tcl.Tk.Ada.Widgets.TtkFrame; with Game; use Game; with Items; use Items; -- ****h* Dialogs/Dialogs -- FUNCTION -- Provide code to show various in game dialogs (messages, questins, etc) -- SOURCE package Dialogs is -- **** -- ****f* Dialogs/Dialogs.Create_Dialog -- FUNCTION -- Create a new dialog with the selected title -- PARAMETERS -- Name - The Tk path name of the new dialog -- Title - The title of the new dialog -- Title_Width - The maximum width of the title. Used to set wrapping for -- it. Default value is 275 pixels. Can be empty. -- Columns - The amount of columns which dialog will have. Used to set -- the title. Default value is 1 column. Can be empty. -- RESULT -- The newly created Dialog as Ttk_Frame -- SOURCE function Create_Dialog (Name, Title: String; Title_Width: Positive := 275; Columns: Positive := 1; Parent_Name: String := ".gameframe") return Ttk_Frame; -- **** -- ****f* Dialogs/Dialogs.Add_Close_Button -- FUNCTION -- Add button to close the selected dialog and set proper bindings for -- it. -- PARAMETERS -- Name - The Tk path name for the button -- Text - The text to display on the button -- Command - The Tcl command to run when the button was clicked -- Columnspan - The amount of columns to merge when placing the close -- button. Can be empty. Default value is 1 (no merging). -- Row - The row in which the button will be placed. Can be empty. -- Default value is 0 (place button in the next row) -- SOURCE procedure Add_Close_Button (Name, Text, Command: String; ColumnSpan: Positive := 1; Row: Natural := 0); -- **** -- ****f* Dialogs/Dialogs.Show_Dialog -- FUNCTION -- Show the selected dialog to the player -- PARAMETERS -- Dialog - The dialog which will be shown -- Parent_Frame - The parent frame name for the dialog. Can be empty. -- Default value is .gameframe -- With_Timer - If True, add timer to the dialog. Can be empty. Default -- value is False -- Relative_X - Relative X coordinate inside of parent frame for the -- dialog. 0.0 is left border. Can be empty. Default value -- is 0.3 -- Relative_Y - Relative Y coordinate inside of parent frame for the -- dialog. 0.0 is top border. Can be empty. Default value is -- 0.3 -- SOURCE procedure Show_Dialog (Dialog: Ttk_Frame; Parent_Frame: String := ".gameframe"; With_Timer: Boolean := False; Relative_X, Relative_Y: Damage_Factor := 0.3); -- **** -- ****o* Dialogs/Dialogs.Close_Dialog_Command -- FUNCTION -- Close the selected dialog -- PARAMETERS -- ClientData - Custom data send to the command. Unused -- Interp - Tcl interpreter in which command was executed. -- Argc - Number of arguments passed to the command. -- Argv - Values of arguments passed to the command. -- RESULT -- This function always return TCL_OK -- COMMANDS -- CloseDialog dialogname -- Dialogname is name of the dialog to close -- SOURCE function Close_Dialog_Command (ClientData: Integer; Interp: Tcl.Tcl_Interp; Argc: Interfaces.C.int; Argv: CArgv.Chars_Ptr_Ptr) return Interfaces.C.int with Convention => C; -- **** -- ****f* Dialogs/Dialogs.Add_Commands -- FUNCTION -- Add Tcl commands related to dialogs -- SOURCE procedure Add_Commands; -- **** -- ****f* Dialogs/Dialogs.ShowMessage -- FUNCTION -- Show the selected message to a player -- PARAMETERS -- Text - Text of message to show -- ParentFrame - The parent frame of the message dialog. Default is -- the game frame. Can be empty -- Title - The text show in the dialog header. -- SOURCE procedure ShowMessage (Text: String; ParentFrame: String := ".gameframe"; Title: String) with Pre => Text'Length > 0 and ParentFrame'Length > 0; -- **** -- ****f* Dialogs/Dialogs.ShowInfo -- FUNCTION -- Show the selected info to a player -- PARAMETERS -- Text - Text of info to show -- ParentName - Name of the parent widget. If empty, then the main game -- window will be used as parent for widget. Default value -- is .gameframe -- Title - The text show in the dialog header. -- SOURCE procedure ShowInfo (Text: String; ParentName: String := ".gameframe"; Title: String) with Pre => Text'Length > 0 and ParentName'Length > 0; -- **** -- ****f* Dialogs/Dialogs.ShowManipulateItem -- FUNCTION -- Show the dialog for manipulate items amount in cargo (like selling, -- dropping, etc). -- PARAMETERS -- Title - Title of the dialog -- Command - Tcl command which will be executed when the player hit -- the button Ok -- Action - The name of action which the player is doing (like drop, -- sell, ect) -- ItemIndex - The index of the item which will be manipulated -- MaxAmount - Max amount of the items to manipualate. If zero, use max -- amount of items from player ship cargo. Default value is -- zero. -- Cost - The cost (in buying) or gain (in selling) for one item in -- the game money. Can be zero. Default value is zero. -- SOURCE procedure ShowManipulateItem (Title, Command, Action: String; ItemIndex: Inventory_Container.Extended_Index; MaxAmount, Cost: Natural := 0) with Pre => Title'Length > 0 and Command'Length > 0; -- **** -- ****f* Dialogs/Dialogs.ShowQuestion -- FUNCTION -- Show the dialog with question to the player -- PARAMETERS -- Question - The question which will be the player asked for -- Result - The value set for Ok button -- In_Game - The question in show during game -- HISTORY -- 5.9 - Added -- SOURCE procedure ShowQuestion (Question, Result: String; In_Game: Boolean := True) with Pre => Question'Length > 0; -- **** end Dialogs;
[ { "context": "--\n-- Copyright 2018 The wookey project team <wookey@ssi.gouv.fr>\n-- - Ryad Benadjila\n-- - Arnauld Michel", "end": 64, "score": 0.9999327659606934, "start": 46, "tag": "EMAIL", "value": "wookey@ssi.gouv.fr" }, { "context": "he wookey project team <wookey@ssi.gouv.fr>\n-- - Ryad Benadjila\n-- - Arnauld Michelizza\n-- - Mathieu Renard", "end": 91, "score": 0.9983198046684265, "start": 73, "tag": "NAME", "value": "Ryad Benadjila" }, { "context": "okey@ssi.gouv.fr>\n-- - Ryad Benadjila\n-- - Arnauld Michelizza\n-- - Mathieu Renard\n-- - Philippe Thierry\n--", "end": 118, "score": 0.9638456702232361, "start": 99, "tag": "NAME", "value": "Arnauld Michelizza" }, { "context": "ad Benadjila\n-- - Arnauld Michelizza\n-- - Mathieu Renard\n-- - Philippe Thierry\n-- - Philippe Trebuchet", "end": 141, "score": 0.90855473279953, "start": 126, "tag": "NAME", "value": "Mathieu Renard" }, { "context": " Arnauld Michelizza\n-- - Mathieu Renard\n-- - Philippe Thierry\n-- - Philippe Trebuchet\n--\n-- Licensed under th", "end": 165, "score": 0.999815821647644, "start": 149, "tag": "NAME", "value": "Philippe Thierry" }, { "context": " - Mathieu Renard\n-- - Philippe Thierry\n-- - Philippe Trebuchet\n--\n-- Licensed under the Apache License, Version ", "end": 191, "score": 0.9998639225959778, "start": 173, "tag": "NAME", "value": "Philippe Trebuchet" } ]
src/exported/ewok-exported-devices.ads
PThierry/ewok-kernel
65
-- -- Copyright 2018 The wookey project team <wookey@ssi.gouv.fr> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with types.c; with ewok.exported.interrupts; with ewok.exported.gpios; package ewok.exported.devices with spark_mode => off is MAX_INTERRUPTS : constant := 4; MAX_GPIOS : constant := 16; subtype t_device_name is types.c.c_string (1 .. 16); type t_device_name_access is access all t_device_name; type t_interrupt_config_array is array (unsigned_8 range <>) of aliased ewok.exported.interrupts.t_interrupt_config; type t_gpio_config_array is array (unsigned_8 range <>) of aliased ewok.exported.gpios.t_gpio_config; type t_dev_map_mode is (DEV_MAP_AUTO, DEV_MAP_VOLUNTARY); type t_user_device is record name : t_device_name; base_addr : system_address := 0; size : unsigned_32 := 0; interrupt_num : unsigned_8 range 0 .. MAX_INTERRUPTS := 0; gpio_num : unsigned_8 range 0 .. MAX_GPIOS := 0; map_mode : t_dev_map_mode; interrupts : t_interrupt_config_array (1 .. MAX_INTERRUPTS); gpios : t_gpio_config_array (1 .. MAX_GPIOS); end record; type t_user_device_access is access all t_user_device; end ewok.exported.devices;
12113
-- -- Copyright 2018 The wookey project team <<EMAIL>> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- -- 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 types.c; with ewok.exported.interrupts; with ewok.exported.gpios; package ewok.exported.devices with spark_mode => off is MAX_INTERRUPTS : constant := 4; MAX_GPIOS : constant := 16; subtype t_device_name is types.c.c_string (1 .. 16); type t_device_name_access is access all t_device_name; type t_interrupt_config_array is array (unsigned_8 range <>) of aliased ewok.exported.interrupts.t_interrupt_config; type t_gpio_config_array is array (unsigned_8 range <>) of aliased ewok.exported.gpios.t_gpio_config; type t_dev_map_mode is (DEV_MAP_AUTO, DEV_MAP_VOLUNTARY); type t_user_device is record name : t_device_name; base_addr : system_address := 0; size : unsigned_32 := 0; interrupt_num : unsigned_8 range 0 .. MAX_INTERRUPTS := 0; gpio_num : unsigned_8 range 0 .. MAX_GPIOS := 0; map_mode : t_dev_map_mode; interrupts : t_interrupt_config_array (1 .. MAX_INTERRUPTS); gpios : t_gpio_config_array (1 .. MAX_GPIOS); end record; type t_user_device_access is access all t_user_device; end ewok.exported.devices;
true
-- -- Copyright 2018 The wookey project team <PI:EMAIL:<EMAIL>END_PI> -- - PI:NAME:<NAME>END_PI -- - PI:NAME:<NAME>END_PI -- - PI:NAME:<NAME>END_PI -- - PI:NAME:<NAME>END_PI -- - PI:NAME:<NAME>END_PI -- -- 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 types.c; with ewok.exported.interrupts; with ewok.exported.gpios; package ewok.exported.devices with spark_mode => off is MAX_INTERRUPTS : constant := 4; MAX_GPIOS : constant := 16; subtype t_device_name is types.c.c_string (1 .. 16); type t_device_name_access is access all t_device_name; type t_interrupt_config_array is array (unsigned_8 range <>) of aliased ewok.exported.interrupts.t_interrupt_config; type t_gpio_config_array is array (unsigned_8 range <>) of aliased ewok.exported.gpios.t_gpio_config; type t_dev_map_mode is (DEV_MAP_AUTO, DEV_MAP_VOLUNTARY); type t_user_device is record name : t_device_name; base_addr : system_address := 0; size : unsigned_32 := 0; interrupt_num : unsigned_8 range 0 .. MAX_INTERRUPTS := 0; gpio_num : unsigned_8 range 0 .. MAX_GPIOS := 0; map_mode : t_dev_map_mode; interrupts : t_interrupt_config_array (1 .. MAX_INTERRUPTS); gpios : t_gpio_config_array (1 .. MAX_GPIOS); end record; type t_user_device_access is access all t_user_device; end ewok.exported.devices;
[ { "context": "-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired)\n--\n-- Copyright William A. Whitak", "end": 57, "score": 0.9998578429222107, "start": 33, "tag": "NAME", "value": "Colonel William Whitaker" }, { "context": "l William Whitaker (USAF, Retired)\n--\n-- Copyright William A. Whitaker (1936–2010)\n--\n-- This is a free program, which m", "end": 109, "score": 0.999844491481781, "start": 90, "tag": "NAME", "value": "William A. Whitaker" } ]
src/latin_utils/latin_utils-dictionary_package-adjective_entry_io.adb
spr93/whitakers-words
204
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired) -- -- Copyright William A. Whitaker (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. separate (Latin_Utils.Dictionary_Package) package body Adjective_Entry_IO is --------------------------------------------------------------------------- procedure Get (File : in Ada.Text_IO.File_Type; Item : out Adjective_Entry) is Spacer : Character; pragma Unreferenced (Spacer); begin Decn_Record_IO.Get (File, Item.Decl); Ada.Text_IO.Get (File, Spacer); Comparison_Type_IO.Get (File, Item.Co); end Get; --------------------------------------------------------------------------- procedure Get (Item : out Adjective_Entry) is Spacer : Character; pragma Unreferenced (Spacer); begin Decn_Record_IO.Get (Item.Decl); Ada.Text_IO.Get (Spacer); Comparison_Type_IO.Get (Item.Co); end Get; --------------------------------------------------------------------------- procedure Put (File : in Ada.Text_IO.File_Type; Item : in Adjective_Entry) is begin Decn_Record_IO.Put (File, Item.Decl); Ada.Text_IO.Put (File, ' '); Comparison_Type_IO.Put (File, Item.Co); end Put; --------------------------------------------------------------------------- procedure Put (Item : in Adjective_Entry) is begin Decn_Record_IO.Put (Item.Decl); Ada.Text_IO.Put (' '); Comparison_Type_IO.Put (Item.Co); end Put; --------------------------------------------------------------------------- procedure Get (Source : in String; Target : out Adjective_Entry; Last : out Integer ) is -- Used for computing lower bound of substring Low : Integer := Source'First - 1; begin Decn_Record_IO.Get (Source (Low + 1 .. Source'Last), Target.Decl, Low); Low := Low + 1; Comparison_Type_IO.Get (Source (Low + 1 .. Source'Last), Target.Co, Last); end Get; --------------------------------------------------------------------------- procedure Put (Target : out String; Item : in Adjective_Entry) is -- These variables are used for computing bounds of substrings Low : Integer := Target'First - 1; High : Integer := 0; begin -- Put Decn_Record High := Low + Decn_Record_IO.Default_Width; Decn_Record_IO.Put (Target (Low + 1 .. High), Item.Decl); Low := High + 1; Target (Low) := ' '; -- Put Comparison_Type High := Low + Comparison_Type_IO.Default_Width; Comparison_Type_IO.Put (Target (Low + 1 .. High), Item.Co); -- Fill remainder of string Target (High + 1 .. Target'Last) := (others => ' '); end Put; --------------------------------------------------------------------------- end Adjective_Entry_IO;
22156
-- WORDS, a Latin dictionary, by <NAME> (USAF, Retired) -- -- Copyright <NAME> (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. separate (Latin_Utils.Dictionary_Package) package body Adjective_Entry_IO is --------------------------------------------------------------------------- procedure Get (File : in Ada.Text_IO.File_Type; Item : out Adjective_Entry) is Spacer : Character; pragma Unreferenced (Spacer); begin Decn_Record_IO.Get (File, Item.Decl); Ada.Text_IO.Get (File, Spacer); Comparison_Type_IO.Get (File, Item.Co); end Get; --------------------------------------------------------------------------- procedure Get (Item : out Adjective_Entry) is Spacer : Character; pragma Unreferenced (Spacer); begin Decn_Record_IO.Get (Item.Decl); Ada.Text_IO.Get (Spacer); Comparison_Type_IO.Get (Item.Co); end Get; --------------------------------------------------------------------------- procedure Put (File : in Ada.Text_IO.File_Type; Item : in Adjective_Entry) is begin Decn_Record_IO.Put (File, Item.Decl); Ada.Text_IO.Put (File, ' '); Comparison_Type_IO.Put (File, Item.Co); end Put; --------------------------------------------------------------------------- procedure Put (Item : in Adjective_Entry) is begin Decn_Record_IO.Put (Item.Decl); Ada.Text_IO.Put (' '); Comparison_Type_IO.Put (Item.Co); end Put; --------------------------------------------------------------------------- procedure Get (Source : in String; Target : out Adjective_Entry; Last : out Integer ) is -- Used for computing lower bound of substring Low : Integer := Source'First - 1; begin Decn_Record_IO.Get (Source (Low + 1 .. Source'Last), Target.Decl, Low); Low := Low + 1; Comparison_Type_IO.Get (Source (Low + 1 .. Source'Last), Target.Co, Last); end Get; --------------------------------------------------------------------------- procedure Put (Target : out String; Item : in Adjective_Entry) is -- These variables are used for computing bounds of substrings Low : Integer := Target'First - 1; High : Integer := 0; begin -- Put Decn_Record High := Low + Decn_Record_IO.Default_Width; Decn_Record_IO.Put (Target (Low + 1 .. High), Item.Decl); Low := High + 1; Target (Low) := ' '; -- Put Comparison_Type High := Low + Comparison_Type_IO.Default_Width; Comparison_Type_IO.Put (Target (Low + 1 .. High), Item.Co); -- Fill remainder of string Target (High + 1 .. Target'Last) := (others => ' '); end Put; --------------------------------------------------------------------------- end Adjective_Entry_IO;
true
-- WORDS, a Latin dictionary, by PI:NAME:<NAME>END_PI (USAF, Retired) -- -- Copyright PI:NAME:<NAME>END_PI (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. separate (Latin_Utils.Dictionary_Package) package body Adjective_Entry_IO is --------------------------------------------------------------------------- procedure Get (File : in Ada.Text_IO.File_Type; Item : out Adjective_Entry) is Spacer : Character; pragma Unreferenced (Spacer); begin Decn_Record_IO.Get (File, Item.Decl); Ada.Text_IO.Get (File, Spacer); Comparison_Type_IO.Get (File, Item.Co); end Get; --------------------------------------------------------------------------- procedure Get (Item : out Adjective_Entry) is Spacer : Character; pragma Unreferenced (Spacer); begin Decn_Record_IO.Get (Item.Decl); Ada.Text_IO.Get (Spacer); Comparison_Type_IO.Get (Item.Co); end Get; --------------------------------------------------------------------------- procedure Put (File : in Ada.Text_IO.File_Type; Item : in Adjective_Entry) is begin Decn_Record_IO.Put (File, Item.Decl); Ada.Text_IO.Put (File, ' '); Comparison_Type_IO.Put (File, Item.Co); end Put; --------------------------------------------------------------------------- procedure Put (Item : in Adjective_Entry) is begin Decn_Record_IO.Put (Item.Decl); Ada.Text_IO.Put (' '); Comparison_Type_IO.Put (Item.Co); end Put; --------------------------------------------------------------------------- procedure Get (Source : in String; Target : out Adjective_Entry; Last : out Integer ) is -- Used for computing lower bound of substring Low : Integer := Source'First - 1; begin Decn_Record_IO.Get (Source (Low + 1 .. Source'Last), Target.Decl, Low); Low := Low + 1; Comparison_Type_IO.Get (Source (Low + 1 .. Source'Last), Target.Co, Last); end Get; --------------------------------------------------------------------------- procedure Put (Target : out String; Item : in Adjective_Entry) is -- These variables are used for computing bounds of substrings Low : Integer := Target'First - 1; High : Integer := 0; begin -- Put Decn_Record High := Low + Decn_Record_IO.Default_Width; Decn_Record_IO.Put (Target (Low + 1 .. High), Item.Decl); Low := High + 1; Target (Low) := ' '; -- Put Comparison_Type High := Low + Comparison_Type_IO.Default_Width; Comparison_Type_IO.Put (Target (Low + 1 .. High), Item.Co); -- Fill remainder of string Target (High + 1 .. Target'Last) := (others => ' '); end Put; --------------------------------------------------------------------------- end Adjective_Entry_IO;
[ { "context": "-beans -- Storage Ada Beans\n-- Copyright (C) 2012 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@g", "end": 154, "score": 0.9998679161071777, "start": 139, "tag": "NAME", "value": "Stephane Carrez" }, { "context": " Copyright (C) 2012 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under", "end": 185, "score": 0.9998763203620911, "start": 170, "tag": "NAME", "value": "Stephane Carrez" }, { "context": "2 Stephane Carrez\n-- Written by Stephane Carrez (Stephane.Carrez@gmail.com)\n--\n-- Licensed under the Apache License, Versio", "end": 212, "score": 0.99992835521698, "start": 187, "tag": "EMAIL", "value": "Stephane.Carrez@gmail.com" } ]
awa/plugins/awa-storages/src/awa-storages-beans.ads
Letractively/ada-awa
0
----------------------------------------------------------------------- -- awa-storages-beans -- Storage Ada Beans -- Copyright (C) 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with AWA.Storages.Models; with AWA.Storages.Modules; with ASF.Parts; with Util.Beans.Objects; with Util.Beans.Basic; package AWA.Storages.Beans is FOLDER_ID_PARAMETER : constant String := "folderId"; -- ------------------------------ -- Upload Bean -- ------------------------------ -- The <b>Upload_Bean</b> allows to upload a file in the storage space. type Upload_Bean is new AWA.Storages.Models.Storage_Ref and Util.Beans.Basic.Bean with record Module : AWA.Storages.Modules.Storage_Module_Access := null; end record; type Upload_Bean_Access is access all Upload_Bean'Class; -- Get the value identified by the name. overriding function Get_Value (From : in Upload_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Upload_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Save the uploaded file in the storage service. -- @method procedure Save_Part (Bean : in out Upload_Bean; Part : in ASF.Parts.Part'Class); -- Upload the file. -- @method procedure Upload (Bean : in out Upload_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); -- Delete the file. -- @method procedure Delete (Bean : in out Upload_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); -- ------------------------------ -- Folder Bean -- ------------------------------ -- The <b>Folder_Bean</b> allows to create or update the folder name. type Folder_Bean is new AWA.Storages.Models.Storage_Folder_Ref and Util.Beans.Basic.Bean with record Module : AWA.Storages.Modules.Storage_Module_Access := null; end record; type Folder_Bean_Access is access all Folder_Bean'Class; -- Get the value identified by the name. overriding function Get_Value (From : in Folder_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Folder_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Create or save the folder. procedure Save (Bean : in out Folder_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); type Init_Flag is (INIT_FOLDER, INIT_FOLDER_LIST, INIT_FILE_LIST); type Init_Map is array (Init_Flag) of Boolean; -- ------------------------------ -- Storage List Bean -- ------------------------------ -- This bean represents a list of storage files for a given folder. type Storage_List_Bean is new Util.Beans.Basic.Bean with record Module : AWA.Storages.Modules.Storage_Module_Access := null; -- Current folder. Folder : aliased Folder_Bean; Folder_Bean : Folder_Bean_Access; -- List of folders. Folder_List : aliased AWA.Storages.Models.Folder_Info_List_Bean; Folder_List_Bean : AWA.Storages.Models.Folder_Info_List_Bean_Access; -- List of files. Files_List : aliased AWA.Storages.Models.Storage_Info_List_Bean; Files_List_Bean : AWA.Storages.Models.Storage_Info_List_Bean_Access; Init_Flags : aliased Init_Map := (others => False); Flags : access Init_Map; end record; type Storage_List_Bean_Access is access all Storage_List_Bean'Class; -- Load the folder instance. procedure Load_Folder (Storage : in Storage_List_Bean); -- Load the list of folders. procedure Load_Folders (Storage : in Storage_List_Bean); -- Load the list of files associated with the current folder. procedure Load_Files (Storage : in Storage_List_Bean); overriding function Get_Value (List : in Storage_List_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Storage_List_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Create the Folder_List_Bean bean instance. function Create_Folder_List_Bean (Module : in AWA.Storages.Modules.Storage_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; -- Create the Storage_List_Bean bean instance. function Create_Storage_List_Bean (Module : in AWA.Storages.Modules.Storage_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; end AWA.Storages.Beans;
3207
----------------------------------------------------------------------- -- awa-storages-beans -- Storage Ada Beans -- Copyright (C) 2012 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with AWA.Storages.Models; with AWA.Storages.Modules; with ASF.Parts; with Util.Beans.Objects; with Util.Beans.Basic; package AWA.Storages.Beans is FOLDER_ID_PARAMETER : constant String := "folderId"; -- ------------------------------ -- Upload Bean -- ------------------------------ -- The <b>Upload_Bean</b> allows to upload a file in the storage space. type Upload_Bean is new AWA.Storages.Models.Storage_Ref and Util.Beans.Basic.Bean with record Module : AWA.Storages.Modules.Storage_Module_Access := null; end record; type Upload_Bean_Access is access all Upload_Bean'Class; -- Get the value identified by the name. overriding function Get_Value (From : in Upload_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Upload_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Save the uploaded file in the storage service. -- @method procedure Save_Part (Bean : in out Upload_Bean; Part : in ASF.Parts.Part'Class); -- Upload the file. -- @method procedure Upload (Bean : in out Upload_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); -- Delete the file. -- @method procedure Delete (Bean : in out Upload_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); -- ------------------------------ -- Folder Bean -- ------------------------------ -- The <b>Folder_Bean</b> allows to create or update the folder name. type Folder_Bean is new AWA.Storages.Models.Storage_Folder_Ref and Util.Beans.Basic.Bean with record Module : AWA.Storages.Modules.Storage_Module_Access := null; end record; type Folder_Bean_Access is access all Folder_Bean'Class; -- Get the value identified by the name. overriding function Get_Value (From : in Folder_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Folder_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Create or save the folder. procedure Save (Bean : in out Folder_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); type Init_Flag is (INIT_FOLDER, INIT_FOLDER_LIST, INIT_FILE_LIST); type Init_Map is array (Init_Flag) of Boolean; -- ------------------------------ -- Storage List Bean -- ------------------------------ -- This bean represents a list of storage files for a given folder. type Storage_List_Bean is new Util.Beans.Basic.Bean with record Module : AWA.Storages.Modules.Storage_Module_Access := null; -- Current folder. Folder : aliased Folder_Bean; Folder_Bean : Folder_Bean_Access; -- List of folders. Folder_List : aliased AWA.Storages.Models.Folder_Info_List_Bean; Folder_List_Bean : AWA.Storages.Models.Folder_Info_List_Bean_Access; -- List of files. Files_List : aliased AWA.Storages.Models.Storage_Info_List_Bean; Files_List_Bean : AWA.Storages.Models.Storage_Info_List_Bean_Access; Init_Flags : aliased Init_Map := (others => False); Flags : access Init_Map; end record; type Storage_List_Bean_Access is access all Storage_List_Bean'Class; -- Load the folder instance. procedure Load_Folder (Storage : in Storage_List_Bean); -- Load the list of folders. procedure Load_Folders (Storage : in Storage_List_Bean); -- Load the list of files associated with the current folder. procedure Load_Files (Storage : in Storage_List_Bean); overriding function Get_Value (List : in Storage_List_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Storage_List_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Create the Folder_List_Bean bean instance. function Create_Folder_List_Bean (Module : in AWA.Storages.Modules.Storage_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; -- Create the Storage_List_Bean bean instance. function Create_Storage_List_Bean (Module : in AWA.Storages.Modules.Storage_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; end AWA.Storages.Beans;
true
----------------------------------------------------------------------- -- awa-storages-beans -- Storage Ada Beans -- Copyright (C) 2012 PI:NAME:<NAME>END_PI -- Written by PI:NAME:<NAME>END_PI (PI:EMAIL:<EMAIL>END_PI) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with AWA.Storages.Models; with AWA.Storages.Modules; with ASF.Parts; with Util.Beans.Objects; with Util.Beans.Basic; package AWA.Storages.Beans is FOLDER_ID_PARAMETER : constant String := "folderId"; -- ------------------------------ -- Upload Bean -- ------------------------------ -- The <b>Upload_Bean</b> allows to upload a file in the storage space. type Upload_Bean is new AWA.Storages.Models.Storage_Ref and Util.Beans.Basic.Bean with record Module : AWA.Storages.Modules.Storage_Module_Access := null; end record; type Upload_Bean_Access is access all Upload_Bean'Class; -- Get the value identified by the name. overriding function Get_Value (From : in Upload_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Upload_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Save the uploaded file in the storage service. -- @method procedure Save_Part (Bean : in out Upload_Bean; Part : in ASF.Parts.Part'Class); -- Upload the file. -- @method procedure Upload (Bean : in out Upload_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); -- Delete the file. -- @method procedure Delete (Bean : in out Upload_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); -- ------------------------------ -- Folder Bean -- ------------------------------ -- The <b>Folder_Bean</b> allows to create or update the folder name. type Folder_Bean is new AWA.Storages.Models.Storage_Folder_Ref and Util.Beans.Basic.Bean with record Module : AWA.Storages.Modules.Storage_Module_Access := null; end record; type Folder_Bean_Access is access all Folder_Bean'Class; -- Get the value identified by the name. overriding function Get_Value (From : in Folder_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Folder_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Create or save the folder. procedure Save (Bean : in out Folder_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String); type Init_Flag is (INIT_FOLDER, INIT_FOLDER_LIST, INIT_FILE_LIST); type Init_Map is array (Init_Flag) of Boolean; -- ------------------------------ -- Storage List Bean -- ------------------------------ -- This bean represents a list of storage files for a given folder. type Storage_List_Bean is new Util.Beans.Basic.Bean with record Module : AWA.Storages.Modules.Storage_Module_Access := null; -- Current folder. Folder : aliased Folder_Bean; Folder_Bean : Folder_Bean_Access; -- List of folders. Folder_List : aliased AWA.Storages.Models.Folder_Info_List_Bean; Folder_List_Bean : AWA.Storages.Models.Folder_Info_List_Bean_Access; -- List of files. Files_List : aliased AWA.Storages.Models.Storage_Info_List_Bean; Files_List_Bean : AWA.Storages.Models.Storage_Info_List_Bean_Access; Init_Flags : aliased Init_Map := (others => False); Flags : access Init_Map; end record; type Storage_List_Bean_Access is access all Storage_List_Bean'Class; -- Load the folder instance. procedure Load_Folder (Storage : in Storage_List_Bean); -- Load the list of folders. procedure Load_Folders (Storage : in Storage_List_Bean); -- Load the list of files associated with the current folder. procedure Load_Files (Storage : in Storage_List_Bean); overriding function Get_Value (List : in Storage_List_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Storage_List_Bean; Name : in String; Value : in Util.Beans.Objects.Object); -- Create the Folder_List_Bean bean instance. function Create_Folder_List_Bean (Module : in AWA.Storages.Modules.Storage_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; -- Create the Storage_List_Bean bean instance. function Create_Storage_List_Bean (Module : in AWA.Storages.Modules.Storage_Module_Access) return Util.Beans.Basic.Readonly_Bean_Access; end AWA.Storages.Beans;
[ { "context": "ed by AdaCore. --\n-- (http://www.adacore.com). ", "end": 2791, "score": 0.9201827049255371, "start": 2780, "tag": "EMAIL", "value": "adacore.com" } ]
src/asis/a4g-contt-ut.ads
My-Colaborations/dynamo
15
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . C O N T T . U T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1995-2011, Free Software Foundation, Inc. -- -- -- -- ASIS-for-GNAT is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -- -- Public License for more details. You should have received a copy of the -- -- GNU General Public License distributed with ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 51 Franklin -- -- Street, Fifth Floor, Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by AdaCore. -- -- (http://www.adacore.com). -- -- -- ------------------------------------------------------------------------------ -- This package defines for each ASIS Context the corresponding Unit Table, -- which contains all the information needed for the black-box ASIS queries -- about Compilation Units. This table also provides the mechanism for -- searching for a unit by its Ada name, this mechanism is some slight -- modification of the GNAT Namet package. with Asis; use Asis; with Asis.Extensions; use Asis.Extensions; package A4G.Contt.UT is -- Context_Table.Unit_Tables --------------------- -- ASIS Unit Table -- --------------------- -- ASIS Unit Table is the main part of the implementation of ASIS Context -- and ASIS Compilation Unit abstractions. The table is organized in the -- following way: -- - the internal representation of an ASIS Compilation Unit is the -- value of the corresponding Unit Record which is kept in Unit Table -- and indicated by Unit Id; -- - each ASIS Context has its own Unit Table, so most the routines -- dealing with Unit Table contain the Id of an Enclosing Context -- as a Parameter; -- - each ASIS Compilation Units keeps the Id of its enclosing -- Context as a part of its value; -- - The fully expanded Ada name, together for the spec/body sign, -- uniquely identifies a given unit inside its enclosing -- Context/Context; so the triple - expanded Ada name, spec/body -- sign and some identification of the Unit's enclosing Context/Context -- uniquely identifies a given unit among all the Unit processed -- by ASIS; -- - The normalized Ada name, is obtained from the fully expanded -- Ada Unit name by folding all the upper case letters in the -- corresponding lower case letters, appending the spec/body sign -- (which has the form "%s" for a spec and "%b" for a body); -- The entries in the table are accessed using a Unit_Id that ranges -- from First_Unit_Id to Last_Unit_Id. The fields of each entry and -- the corresponding interfaces may be subdivided into four groups. -- The first group, called as Unit Name Table, provides the modified -- version of the functionality of the GNAT Namet package, it is used -- for storing the names of the Units in two forms - in the normalized -- and in the form corresponding to the (defining) occurrence of a -- given name in a source text. Each unit can be effectively searched -- by its normalized name. -- The second group contains the black-box attributes of a Unit. -- The third group contains the information about relations (semantic -- dependencies) between the given unit and the other units in the -- enclosing Context/Context Note, that Ada Unit name, -- included in the first group, logically should also be considered -- as a black-box Unit attribute. -- And the fourth group contains the fields needed for organization of the -- tree swapping during the multiple Units processing. --------------------- -- Unit Name Table -- --------------------- -- Each Unit entry contain the following fields: -- "Normalized" Ada name "Normalized" Ada names of the ASIS Compilation -- Units are their names with upper case letters -- folded to lower case (by applying the -- Ada.Character.Handling.To_Lower functions; -- this lover-case-folding has no relation to GNAT -- conventions described in Namet!), appended by -- suffix %s or %b for spec or bodies/subunits, as -- defined in Uname (spec), and prepended by -- the string image of the Id value of the unit's -- enclosing Context. Each of the names of this -- kind may have only one entry in Unit Name Table. -- -- Ada name Ada names of the ASIS Compilation Units are -- stored keeping the casing from the source text. -- These entries are used to implement the ASIS -- query (-ies?) returning the Ada name of the -- Unit. Ada names may be included more than one -- time in Unit Name Table as the parts of the -- different table entries, as the name of a spec -- and the name of a corresponding body. -- -- Source File Name The name of the Ada source file used to compile -- the given compilation unit (on its own or as a -- supporter of some other unit). -- -- Reference File Name The name of the source file which represents -- the unit source from the user's viewpoint. It is -- the same as the Source File name unless the -- Source_Reference pragma presents for the given -- unit. type Column is (Norm_Ada_Name, Ada_Name, Source_File_Name, Ref_File_Name); -- This enumeration type defines literals used to make the difference -- between different forms of names stored in the Unit Table -- Really every name is kept as the reference into the Char table, -- together with the length of its name. -- The normalized names are hashed, so that a given normalized name appears -- only once in the table. -- Opposite to the GNAT name table, this name table does not handle the -- one-character values in a special way (there is no need for it, because -- storing an one-character name does not seem to be a usual thing -- for this table.) -- ASIS "normalized" Unit names follow the convention which is -- very similar to the GNAT convention defined in Uname (spec), the -- only difference is that ASIS folds all the upper case -- letters to the corresponding lower case letters without any encoding. -- ASIS packages implementing the ASIS Context model for GNAT contain -- "ASIS-related counterparts" of some facilities provided by three -- GNAT packages - Namet, Uname and Fname. -- We keep storing the two values, one of type Int and one of type Byte, -- with each names table entry and subprograms are provided for setting -- and retrieving these associated values. But for now these values are -- of no use in ASIS - we simply are keeping this mechanism from the -- GNAT name table - just in case. -- Unit Name Table may be considered as having the external view -- of the two-column table - for each row indicated by Unit_Id the -- first column contains the Ada name of the corresponding Unit and -- the second column contains Unit's "normalized" name. -- In fact we do not use any encoding-decoding in Unit Name Table. ASIS -- supports only a standard mode of GNAT (that is, it relies on the fact -- that all the identifiers contain only Row 00 characters). ASIS also -- assumes that all the names of the source files are the values of -- the Ada predefined String type. -- All the Unit Tables shares the same Name Buffer, see the specification -- of the parent package for its definition. --------------------------------- -- Unit Name Table Subprograms -- --------------------------------- procedure Get_Name_String (Id : Unit_Id; Col : Column); -- Get_Name_String is used to retrieve the one of the three strings -- associated with an entry in the names table. The Col parameter -- indicates which of the names should be retrieved (Ada name, normalized -- Ada name or source file name) by indicating the "column" in the table -- The resulting string is stored in Name_Buffer and Name_Len is set. function Length_Of_Name (Id : Unit_Id; Col : Column) return Nat; -- ??? pragma Inline (Length_Of_Name); -- Returns length of given name in characters, the result is equivalent to -- calling Get_Name_String and reading Name_Len, except that a call to -- Length_Of_Name does not affect the contents of Name_Len and Name_Buffer. function Name_Find (C : Context_Id) return Unit_Id; -- Name_Find is called with a string stored in Name_Buffer whose length -- is in Name_Len (i.e. the characters of the name are in subscript -- positions 1 to Name_Len in Name_Buffer). It searches the names -- table to see if the string has already been stored. If so the Id of -- the existing entry is returned. Otherwise (opposite to the GNAT name -- table, in which a new entry is created it this situation with its -- Name_Table_Info field set to zero) the Id value corresponding to the -- ASIS Nil_Compilation_Unit, that is Nil_Unit, is returned. -- -- Only normalized Ada names are hashed, so this function is intended to -- be applied to the normalized names only (in is not an error to apply -- it to other forms of names stored in the table, but the result will -- always be Nil_Unit. function Allocate_Unit_Entry (C : Context_Id) return Unit_Id; -- Allocates the new entry in the Unit Name Table for the "normalized" -- Ada Unit name stored in the Name_Buffer (Name_Len should be set -- in a proper way). This routine should be called only if the -- immediately preceding call to an operation working with Unit Name -- Table is the call to Name_Find which has yielded Nil_Unit as a -- result. Note, that this function sets only the "normalized" unit name, -- it does not set the Ada name or the source file name. It also -- increases by one the counter of allocated bodies or specs, depending -- on the suffix in the normalized unit name. function Allocate_Nonexistent_Unit_Entry (C : Context_Id) return Unit_Id; -- Differs from the previous function in the following aspects: -- - 'n' is added to the name suffix to mark that this entry -- corresponds to the nonexistent unit; -- - The body/spec counters are not increased -- - all the attributes of the allocated nonexistent unit are set by -- this procedure. -- -- Allocates the new entry in the Unit Name Table for the "normalized" -- Ada Unit name stored in the Name_Buffer (Name_Len should be set -- in a proper way). This routine should be called only if the -- immediately preceding call to an operation working with Unit Name -- Table is the call to Name_Find which has yielded Nil_Unit as a -- result. Note, that this function sets only the "normalized" unit name, -- it does not set the Ada name or the source file name. function Set_Unit (C : Context_Id; U : Unit_Number_Type) return Unit_Id; -- Creates the Unit table entry for the unit U and sets the normalized -- unit name (which is supposed to be stored in A_Name_Buffer when this -- procedure is called) and the time stamp for the unit. It also adds -- the (Id of the) currently accessed tree to the (empty) list -- of (consistent) trees for this unit. All the other unit attributes -- are set to nil values. The ID of the created entry is returned as a -- result procedure Set_Ada_Name (Id : Unit_Id); pragma Inline (Set_Ada_Name); -- Sets the string stored in Name_Buffer whose length is Name_Len as the -- value of the Ada name of the ASIS Unit indicated by Id value procedure Set_Norm_Ada_Name (Id : Unit_Id); pragma Inline (Set_Norm_Ada_Name); -- Sets the string stored in Name_Buffer whose length is Name_Len as the -- value of the "normalized" Ada name of the ASIS Unit indicated by Id -- value procedure Set_Ref_File_As_Source_File (U : Unit_Id); -- For a given unit in a given context, sets the reference file name equal -- to the source file name (by copying the corresponding references to -- the ASIS Chars table procedure Set_Source_File_Name (Id : Unit_Id; Ref : Boolean := False); pragma Inline (Set_Source_File_Name); -- Sets the string stored in the A_Name_Buffer whose length is A_Name_Len -- as the value of the source or reference (depending on the actual set -- for the Ref parameter) file name of the ASIS Unit indicated by Id value procedure Set_Norm_Ada_Name_String; -- Sets the Normalized Ada Unit name as the value of Name_Buffer. -- This normalized version of the Ada Unit name is -- obtained by folding to lover cases of the GNAT unit name -- which should be previously get as the content of -- Namet.Name_Buffer (that means that every call to this procedure -- should be preceded by the appropriate call to -- Namet.Get_Unqualified_Decoded_Name_String (or -- Namet.Get_Decoded_Name_String if the caller is sure, that the name is -- not qualified) procedure Set_Norm_Ada_Name_String_With_Check (Unit : Unit_Number_Type; Success : out Boolean); -- This is the modified version of Set_Norm_Ada_Name_String: after setting -- the ASIS name buffer it checks if Unit should be considered as -- Compilation_Unit by ASIS. The need for this check caused by artificial -- compilation units created by the compiler for library-level generic -- instantiations. If the check is successful, Success is set True, -- otherwise it is set False. -- -- In case of a tree created for library-level instantiation of a generic -- package (only package ???) GNAT sets the suffix of the name of the -- corresponding unit in its unit table as '%b', but ASIS has to see -- this unit as a spec, therefore in this case this procedure resets the -- suffix of the unit name to '%s' procedure Set_Ref_File_Name_String (U : Unit_Id); -- Is supposed to be called when GNAT Namet.Name_Buffer contains a full -- reference file name. It sets the Reference File name as the value of -- A_Name_Buffer. This name is composed from the reference file name -- obtained from the tree and from the source file name (in which the -- directory information is already adjusted , if needed, by the -- corresponding call to Set_S_File_Name_String) to contain the directory -- information needed to access this file from the current directory. ------------------------------- -- Black-Box Unit Attributes -- ------------------------------- -- Each Unit entry contains the following fields, representing the Unit -- black-box attributes, which are for the direct interest for the ASIS -- queries from the Asis_Compilation_Unit package, the primary idea of -- implementing the Context/Compilation_Unit stuff in ASIS-for-GNAT is -- to compute each of these attribute only once, when the new tree is -- inputted by ASIS for the first time, and then store them in Unit -- Table, so then ASIS queries will be able to get the required -- answer without any new tree processing: -- Top : Node_Id; -- The top node of the unit subtree in the currently accessed full tree. -- From one side, this node should be reset every time the full tree -- is changed. From the other side, the corresponding actions may be -- considered as too time-consumed. This problem is postponed now as -- OPEN PROBLEM, it is not important till we are working under the -- limitation "only one tree can be accessed at a time" -- Enclosing_Context : Context_Id; -- The reference to the Context table which indicates the Enclosing -- Context for a Unit -- Kind : Unit_Kinds; -- The kind of a Compilation Unit, as defined by Asis.Unit_Kinds -- package -- Class : Unit_Classes; -- The class of a Compilation Unit, as defined by Asis.Unit_Kinds -- package -- Origin : Unit_Origins; -- The origin of a Compilation Unit, as defined by Asis.Unit_Kinds -- package -- Main_Unit : Boolean; -- The boolean flag indicating if a Compilation Unit may be treated -- as the main unit for a partition (See RM 10.2(7)) -- GNAT-specific!!?? -- Is_Body_Required : Boolean; -- The boolean flag indicating if a Compilation Unit requires a body -- as a completion ----------------------------------------------------------- -- Black-Box Unit Attributes Access and Update Routines -- ----------------------------------------------------------- function Top (U : Unit_Id) return Node_Id; -- this function is not trivial, it can have tree swapping as its -- "side effect" function Kind (C : Context_Id; U : Unit_Id) return Unit_Kinds; function Class (C : Context_Id; U : Unit_Id) return Unit_Classes; function Origin (C : Context_Id; U : Unit_Id) return Unit_Origins; function Is_Main_Unit (C : Context_Id; U : Unit_Id) return Boolean; function Is_Body_Required (C : Context_Id; U : Unit_Id) return Boolean; -- This function does not reset Context, a Caller is responsible for this function Time_Stamp (C : Context_Id; U : Unit_Id) return Time_Stamp_Type; function Is_Consistent (C : Context_Id; U : Unit_Id) return Boolean; function Source_Status (C : Context_Id; U : Unit_Id) return Source_File_Statuses; function Main_Tree (C : Context_Id; U : Unit_Id) return Tree_Id; function Has_Limited_View_Only (C : Context_Id; U : Unit_Id) return Boolean; -- Checks if U has only limited view in C -------- procedure Set_Top (C : Context_Id; U : Unit_Id; N : Node_Id); procedure Set_Kind (C : Context_Id; U : Unit_Id; K : Unit_Kinds); procedure Set_Class (C : Context_Id; U : Unit_Id; Cl : Unit_Classes); procedure Set_Origin (C : Context_Id; U : Unit_Id; O : Unit_Origins); procedure Set_Is_Main_Unit (C : Context_Id; U : Unit_Id; M : Boolean); procedure Set_Is_Body_Required (C : Context_Id; U : Unit_Id; B : Boolean); procedure Set_Time_Stamp (C : Context_Id; U : Unit_Id; T : Time_Stamp_Type); procedure Set_Is_Consistent (C : Context_Id; U : Unit_Id; B : Boolean); procedure Set_Source_Status (C : Context_Id; U : Unit_Id; S : Source_File_Statuses); ------------------------------------------------- --------------------------- -- Semantic Dependencies -- --------------------------- ---------------------------------------------------- -- Subprograms for Semantic Dependencies Handling -- ---------------------------------------------------- function Not_Root return Boolean; -- Checks if U is not a root library unit (by checking if -- its name contains a dot). This function itself does not set the -- normalized name of U in A_Name_Buffer, it is supposed to be called -- when a proper name is already set. function Subunits (C : Context_Id; U : Unit_Id) return Unit_Id_List; -- Returns the full list of Ids of subunits for U (if any). The full list -- contains nonexistent units for missed subunits -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Subunit (Parent_Body : Asis.Compilation_Unit; Stub_Node : Node_Id) return Asis.Compilation_Unit; -- This function is intended to be used only when all the Unit attributes -- are already computed. It gets the Parent_Body, whose tree should -- contain Stub_Node as a node representing some body stub, and it -- returns the Compilation Unit containing the proper body for this stub. -- It returns a Nil_Compilation_Unit, if the Compilation Unit containing -- the proper body does not exist in the enclosing Context or if it is -- inconsistent with Parent_Body. function Children (U : Unit_Id) return Unit_Id_List; -- returns the list of Ids of children for U (if any) -- -- Note, that this function does not reset Context, it should be done in -- the caller! function GNAT_Compilation_Dependencies (U : Unit_Id) return Unit_Id_List; -- Returns the full list of GNAT compilation dependencies for U -- This list is empty if and only if U is not a main unit of some -- compilation which creates some tree for C. procedure Form_Parent_Name; -- supposing A_Name_Buffer containing a normalized unit name, this -- function forms the normalized name of its parent by stripping out -- the suffix in the Ada part of the name (that is, the part of the -- name between the rightmost '.' and '%") and changing the -- "normalized" suffix to "%s". A_Name_Len is set in accordance with -- this. If the Ada part of the name contains no suffix (that is, if -- it corresponds to a root library unit), A_Name_Len is set equal -- to 0. function Get_Parent_Unit (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the parent unit declaration for U. If U is -- First_Unit_Id, returns Nil_Unit. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Body (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the library_unit_body for the unit U. -- Nil_Unit is not a valid argument for this function. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Declaration (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the library_unit_declaration for the unit U. -- Nil_Unit is not a valid argument for this function. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Subunit_Parent_Body (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the library_unit_body or subunit being the parent -- body for subunit U (a caller is responsible for calling this function -- for subunits). function Get_Nonexistent_Unit (C : Context_Id) return Unit_Id; -- Is supposed to be called just after an attempt to get a unit which is -- supposed to be a needed declaration or a needed body (that is, -- A_Name_Buffer contains a normalized unit name ending with "%s" or "%b" -- respectively). Tries to find the unit of A_Nonexistent_Declaration -- or A_Nonexistent_Body kind with this name, if this attempt fails, -- allocates the new unit entry for the corresponding nonexistent unit. -- Returns the Id of found or allocated unit. function Get_Same_Unit (Arg_C : Context_Id; Arg_U : Unit_Id; Targ_C : Context_Id) return Unit_Id; -- Tries to find in Targ_C just the same unit as Arg_U is in Arg_C. -- Just the same means, that Arg_U and the result of this function -- should have just the same time stamps. If Arg_C = Targ_C, Arg_U -- is returned. If there is no "just the same" unit in Targ_C, -- Nil_Unit is returned. -- -- If No (Arg_U), then the currently accessed Context is not reset (but -- this function is not supposed to be called for Arg_U equal to -- Nil_Unit_Id, although it is not an error). Otherwise Context is reset -- to Targ_C -------------------------------------- -- General-Purpose Unit Subprograms -- -------------------------------------- procedure Finalize (C : Context_Id); -- Currently this routine is only used to generate debugging output -- for the Unit Table of a given Context. function Present (Unit : Unit_Id) return Boolean; -- Tests given Unit Id for equality with Nil_Unit. This allows -- notations like "if Present (Current_Supporter)" as opposed to -- "if Current_Supporter /= Nil_Unit function No (Unit : Unit_Id) return Boolean; -- Tests given Unit Id for equality with Nil_Unit. This allows -- notations like "if No (Current_Supporter)" as opposed to -- "if Current_Supporter = Nil_Unit function Last_Unit return Unit_Id; -- Returns the Unit_Id of the last unit which has been allocated in the -- Unit Name Table. Used to define that the Unit_Id value returned by -- Name_Find corresponds to the ASIS Compilation Unit which is not -- known to ASIS. function Lib_Unit_Decls (C : Context_Id) return Natural; -- returns the number of library_unit_declaratios allocated in the -- Context Unit table function Comp_Unit_Bodies (C : Context_Id) return Natural; -- returns the number of library_unit_bodies and subunits allocated -- in the Context Unit table function Next_Decl (D : Unit_Id) return Unit_Id; -- Returns the Unit_Id of the next unit (starting from, but not including -- D), which is a library_unit_declaration. Returns Nil_Unit, if there -- is no such a unit in C. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function First_Body return Unit_Id; -- Returns the Unit_Id of the first unit which is a -- compilation_unit_body or a subunit. Returns Nil_Unit, if there is -- no such a unit in a current Context. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Next_Body (B : Unit_Id) return Unit_Id; -- Returns the Unit_Id of the next unit (starting from, but not including -- B) which is a compilation_unit_body or a subunit. Returns Nil_Unit, -- if there is no such a unit in C. -- -- Note, that this function does not reset Context, it should be done in -- the caller! procedure Output_Unit (C : Context_Id; Unit : Unit_Id); -- Produces the debug output of the Unit Table entry corresponding -- to Unit -- DO WE NEED THIS PROCEDURE IN THE SPECIFICATION???? procedure Print_Units (C : Context_Id); -- Produces the debug output from the Unit table for the Context C. function Enclosing_Unit (Cont : Context_Id; Node : Node_Id) return Asis.Compilation_Unit; -- This function is intended to be used to define the enclosing -- unit for an Element obtained as a result of some ASIS semantic query. -- It finds the N_Compilation_Unit node for the subtree enclosing -- the Node given as its argument, and then defines the corresponding -- Unit Id, which is supposed to be the Id of Enclosing Unit for an -- Element built up on the base of Node. It does not change the tree -- being currently accessed. All these computations are supposed -- to be performed for a Context Cont. -- Node should not be a result of Atree.Original_Node, because -- it is used as an argument for Atree.Parent function -- -- Note, that this function does no consistency check, that is, the -- currently accessed tree may be not from the list of consistent trees -- for the resulted Unit. --------------- -- NEW STUFF -- --------------- procedure Register_Units (Set_First_New_Unit : Boolean := False); -- When a new tree file is read in during Opening a Context, this procedure -- goes through all the units represented by this tree and checks if these -- units are already known to ASIS. If some unit is unknown, this -- procedure "register" it - it creates the corresponding entry in the -- unit table, and it sets the normalized unit name. It does not set any -- other field of unit record except Kind. It sets Kind as Not_A_Unit -- to indicate, that this unit is only registered, but not processed. -- -- We need this (pre-)registration to be made before starting unit -- processing performed by Process_Unit_New, because we need all the units -- presenting in the tree to be presented also in the Context unit table -- when storing the dependency information. -- -- Note, that all the consistency checks are made by Process_Unit_New, -- even though we can make them here. The reason is to separate this -- (pre-)registration (which is an auxiliary technical action) from -- unit-by-unit processing to facilitate the maintainability of the code. -- -- If Set_First_New_Unit is set ON, stores in A4G.Contt.First_New_Unit -- the first new unit being registered. If Set_First_New_Unit is set OFF -- or if no new units has been registered, First_New_Unit is set to -- Nil_Unit -- -- ??? The current implementation uses Set_Unit, which also sets time -- ??? stamp for a unit being registered. It looks like we do not need -- ??? this, so we can get rid of this. function Already_Processed (C : Context_Id; U : Unit_Id) return Boolean; -- Checks if U has already been processed when scanning previous trees -- during opening C procedure Check_Source_Consistency (C : Context_Id; U_Id : Unit_Id); -- Is called when a Unit is being investigated as encountered for the first -- time during opening the Context C. It checks the existence of the source -- file for this unit, and if the source file exists, it checks that the -- units as represented by the tree is consistent with the source (if this -- is required by the options associated with the Context). -- This procedure should be called after extracting the source file name -- from the tree and putting this into the Context unit table. procedure Check_Consistency (C : Context_Id; U_Id : Unit_Id; U_Num : Unit_Number_Type); -- Is called when a unit is encountered again when opening C. Checks if in -- the currently accessed tree this unit has the same time stamp as it had -- in all the previously processed trees. In case if this check fails, it -- raises ASIS_Failed and forms the diagnosis on behalf of -- Asis.Ada_Environments.Open. (This procedure does not check the source -- file for the unit - this should be done by Check_Source_Consistency -- when the unit was processed for the first time) function TS_From_OS_Time (T : OS_Time) return Time_Stamp_Type; -- Converts OS_Time into Time_Stamp_Type. Is this the right place for -- this function??? procedure Reset_Cache; -- Resents to the empty state the cache data structure used to speed up the -- Top function. Should be called as a part of closing a Context. end A4G.Contt.UT;
4144
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . C O N T T . U T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1995-2011, Free Software Foundation, Inc. -- -- -- -- ASIS-for-GNAT is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -- -- Public License for more details. You should have received a copy of the -- -- GNU General Public License distributed with ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 51 Franklin -- -- Street, Fifth Floor, Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by AdaCore. -- -- (http://www.<EMAIL>). -- -- -- ------------------------------------------------------------------------------ -- This package defines for each ASIS Context the corresponding Unit Table, -- which contains all the information needed for the black-box ASIS queries -- about Compilation Units. This table also provides the mechanism for -- searching for a unit by its Ada name, this mechanism is some slight -- modification of the GNAT Namet package. with Asis; use Asis; with Asis.Extensions; use Asis.Extensions; package A4G.Contt.UT is -- Context_Table.Unit_Tables --------------------- -- ASIS Unit Table -- --------------------- -- ASIS Unit Table is the main part of the implementation of ASIS Context -- and ASIS Compilation Unit abstractions. The table is organized in the -- following way: -- - the internal representation of an ASIS Compilation Unit is the -- value of the corresponding Unit Record which is kept in Unit Table -- and indicated by Unit Id; -- - each ASIS Context has its own Unit Table, so most the routines -- dealing with Unit Table contain the Id of an Enclosing Context -- as a Parameter; -- - each ASIS Compilation Units keeps the Id of its enclosing -- Context as a part of its value; -- - The fully expanded Ada name, together for the spec/body sign, -- uniquely identifies a given unit inside its enclosing -- Context/Context; so the triple - expanded Ada name, spec/body -- sign and some identification of the Unit's enclosing Context/Context -- uniquely identifies a given unit among all the Unit processed -- by ASIS; -- - The normalized Ada name, is obtained from the fully expanded -- Ada Unit name by folding all the upper case letters in the -- corresponding lower case letters, appending the spec/body sign -- (which has the form "%s" for a spec and "%b" for a body); -- The entries in the table are accessed using a Unit_Id that ranges -- from First_Unit_Id to Last_Unit_Id. The fields of each entry and -- the corresponding interfaces may be subdivided into four groups. -- The first group, called as Unit Name Table, provides the modified -- version of the functionality of the GNAT Namet package, it is used -- for storing the names of the Units in two forms - in the normalized -- and in the form corresponding to the (defining) occurrence of a -- given name in a source text. Each unit can be effectively searched -- by its normalized name. -- The second group contains the black-box attributes of a Unit. -- The third group contains the information about relations (semantic -- dependencies) between the given unit and the other units in the -- enclosing Context/Context Note, that Ada Unit name, -- included in the first group, logically should also be considered -- as a black-box Unit attribute. -- And the fourth group contains the fields needed for organization of the -- tree swapping during the multiple Units processing. --------------------- -- Unit Name Table -- --------------------- -- Each Unit entry contain the following fields: -- "Normalized" Ada name "Normalized" Ada names of the ASIS Compilation -- Units are their names with upper case letters -- folded to lower case (by applying the -- Ada.Character.Handling.To_Lower functions; -- this lover-case-folding has no relation to GNAT -- conventions described in Namet!), appended by -- suffix %s or %b for spec or bodies/subunits, as -- defined in Uname (spec), and prepended by -- the string image of the Id value of the unit's -- enclosing Context. Each of the names of this -- kind may have only one entry in Unit Name Table. -- -- Ada name Ada names of the ASIS Compilation Units are -- stored keeping the casing from the source text. -- These entries are used to implement the ASIS -- query (-ies?) returning the Ada name of the -- Unit. Ada names may be included more than one -- time in Unit Name Table as the parts of the -- different table entries, as the name of a spec -- and the name of a corresponding body. -- -- Source File Name The name of the Ada source file used to compile -- the given compilation unit (on its own or as a -- supporter of some other unit). -- -- Reference File Name The name of the source file which represents -- the unit source from the user's viewpoint. It is -- the same as the Source File name unless the -- Source_Reference pragma presents for the given -- unit. type Column is (Norm_Ada_Name, Ada_Name, Source_File_Name, Ref_File_Name); -- This enumeration type defines literals used to make the difference -- between different forms of names stored in the Unit Table -- Really every name is kept as the reference into the Char table, -- together with the length of its name. -- The normalized names are hashed, so that a given normalized name appears -- only once in the table. -- Opposite to the GNAT name table, this name table does not handle the -- one-character values in a special way (there is no need for it, because -- storing an one-character name does not seem to be a usual thing -- for this table.) -- ASIS "normalized" Unit names follow the convention which is -- very similar to the GNAT convention defined in Uname (spec), the -- only difference is that ASIS folds all the upper case -- letters to the corresponding lower case letters without any encoding. -- ASIS packages implementing the ASIS Context model for GNAT contain -- "ASIS-related counterparts" of some facilities provided by three -- GNAT packages - Namet, Uname and Fname. -- We keep storing the two values, one of type Int and one of type Byte, -- with each names table entry and subprograms are provided for setting -- and retrieving these associated values. But for now these values are -- of no use in ASIS - we simply are keeping this mechanism from the -- GNAT name table - just in case. -- Unit Name Table may be considered as having the external view -- of the two-column table - for each row indicated by Unit_Id the -- first column contains the Ada name of the corresponding Unit and -- the second column contains Unit's "normalized" name. -- In fact we do not use any encoding-decoding in Unit Name Table. ASIS -- supports only a standard mode of GNAT (that is, it relies on the fact -- that all the identifiers contain only Row 00 characters). ASIS also -- assumes that all the names of the source files are the values of -- the Ada predefined String type. -- All the Unit Tables shares the same Name Buffer, see the specification -- of the parent package for its definition. --------------------------------- -- Unit Name Table Subprograms -- --------------------------------- procedure Get_Name_String (Id : Unit_Id; Col : Column); -- Get_Name_String is used to retrieve the one of the three strings -- associated with an entry in the names table. The Col parameter -- indicates which of the names should be retrieved (Ada name, normalized -- Ada name or source file name) by indicating the "column" in the table -- The resulting string is stored in Name_Buffer and Name_Len is set. function Length_Of_Name (Id : Unit_Id; Col : Column) return Nat; -- ??? pragma Inline (Length_Of_Name); -- Returns length of given name in characters, the result is equivalent to -- calling Get_Name_String and reading Name_Len, except that a call to -- Length_Of_Name does not affect the contents of Name_Len and Name_Buffer. function Name_Find (C : Context_Id) return Unit_Id; -- Name_Find is called with a string stored in Name_Buffer whose length -- is in Name_Len (i.e. the characters of the name are in subscript -- positions 1 to Name_Len in Name_Buffer). It searches the names -- table to see if the string has already been stored. If so the Id of -- the existing entry is returned. Otherwise (opposite to the GNAT name -- table, in which a new entry is created it this situation with its -- Name_Table_Info field set to zero) the Id value corresponding to the -- ASIS Nil_Compilation_Unit, that is Nil_Unit, is returned. -- -- Only normalized Ada names are hashed, so this function is intended to -- be applied to the normalized names only (in is not an error to apply -- it to other forms of names stored in the table, but the result will -- always be Nil_Unit. function Allocate_Unit_Entry (C : Context_Id) return Unit_Id; -- Allocates the new entry in the Unit Name Table for the "normalized" -- Ada Unit name stored in the Name_Buffer (Name_Len should be set -- in a proper way). This routine should be called only if the -- immediately preceding call to an operation working with Unit Name -- Table is the call to Name_Find which has yielded Nil_Unit as a -- result. Note, that this function sets only the "normalized" unit name, -- it does not set the Ada name or the source file name. It also -- increases by one the counter of allocated bodies or specs, depending -- on the suffix in the normalized unit name. function Allocate_Nonexistent_Unit_Entry (C : Context_Id) return Unit_Id; -- Differs from the previous function in the following aspects: -- - 'n' is added to the name suffix to mark that this entry -- corresponds to the nonexistent unit; -- - The body/spec counters are not increased -- - all the attributes of the allocated nonexistent unit are set by -- this procedure. -- -- Allocates the new entry in the Unit Name Table for the "normalized" -- Ada Unit name stored in the Name_Buffer (Name_Len should be set -- in a proper way). This routine should be called only if the -- immediately preceding call to an operation working with Unit Name -- Table is the call to Name_Find which has yielded Nil_Unit as a -- result. Note, that this function sets only the "normalized" unit name, -- it does not set the Ada name or the source file name. function Set_Unit (C : Context_Id; U : Unit_Number_Type) return Unit_Id; -- Creates the Unit table entry for the unit U and sets the normalized -- unit name (which is supposed to be stored in A_Name_Buffer when this -- procedure is called) and the time stamp for the unit. It also adds -- the (Id of the) currently accessed tree to the (empty) list -- of (consistent) trees for this unit. All the other unit attributes -- are set to nil values. The ID of the created entry is returned as a -- result procedure Set_Ada_Name (Id : Unit_Id); pragma Inline (Set_Ada_Name); -- Sets the string stored in Name_Buffer whose length is Name_Len as the -- value of the Ada name of the ASIS Unit indicated by Id value procedure Set_Norm_Ada_Name (Id : Unit_Id); pragma Inline (Set_Norm_Ada_Name); -- Sets the string stored in Name_Buffer whose length is Name_Len as the -- value of the "normalized" Ada name of the ASIS Unit indicated by Id -- value procedure Set_Ref_File_As_Source_File (U : Unit_Id); -- For a given unit in a given context, sets the reference file name equal -- to the source file name (by copying the corresponding references to -- the ASIS Chars table procedure Set_Source_File_Name (Id : Unit_Id; Ref : Boolean := False); pragma Inline (Set_Source_File_Name); -- Sets the string stored in the A_Name_Buffer whose length is A_Name_Len -- as the value of the source or reference (depending on the actual set -- for the Ref parameter) file name of the ASIS Unit indicated by Id value procedure Set_Norm_Ada_Name_String; -- Sets the Normalized Ada Unit name as the value of Name_Buffer. -- This normalized version of the Ada Unit name is -- obtained by folding to lover cases of the GNAT unit name -- which should be previously get as the content of -- Namet.Name_Buffer (that means that every call to this procedure -- should be preceded by the appropriate call to -- Namet.Get_Unqualified_Decoded_Name_String (or -- Namet.Get_Decoded_Name_String if the caller is sure, that the name is -- not qualified) procedure Set_Norm_Ada_Name_String_With_Check (Unit : Unit_Number_Type; Success : out Boolean); -- This is the modified version of Set_Norm_Ada_Name_String: after setting -- the ASIS name buffer it checks if Unit should be considered as -- Compilation_Unit by ASIS. The need for this check caused by artificial -- compilation units created by the compiler for library-level generic -- instantiations. If the check is successful, Success is set True, -- otherwise it is set False. -- -- In case of a tree created for library-level instantiation of a generic -- package (only package ???) GNAT sets the suffix of the name of the -- corresponding unit in its unit table as '%b', but ASIS has to see -- this unit as a spec, therefore in this case this procedure resets the -- suffix of the unit name to '%s' procedure Set_Ref_File_Name_String (U : Unit_Id); -- Is supposed to be called when GNAT Namet.Name_Buffer contains a full -- reference file name. It sets the Reference File name as the value of -- A_Name_Buffer. This name is composed from the reference file name -- obtained from the tree and from the source file name (in which the -- directory information is already adjusted , if needed, by the -- corresponding call to Set_S_File_Name_String) to contain the directory -- information needed to access this file from the current directory. ------------------------------- -- Black-Box Unit Attributes -- ------------------------------- -- Each Unit entry contains the following fields, representing the Unit -- black-box attributes, which are for the direct interest for the ASIS -- queries from the Asis_Compilation_Unit package, the primary idea of -- implementing the Context/Compilation_Unit stuff in ASIS-for-GNAT is -- to compute each of these attribute only once, when the new tree is -- inputted by ASIS for the first time, and then store them in Unit -- Table, so then ASIS queries will be able to get the required -- answer without any new tree processing: -- Top : Node_Id; -- The top node of the unit subtree in the currently accessed full tree. -- From one side, this node should be reset every time the full tree -- is changed. From the other side, the corresponding actions may be -- considered as too time-consumed. This problem is postponed now as -- OPEN PROBLEM, it is not important till we are working under the -- limitation "only one tree can be accessed at a time" -- Enclosing_Context : Context_Id; -- The reference to the Context table which indicates the Enclosing -- Context for a Unit -- Kind : Unit_Kinds; -- The kind of a Compilation Unit, as defined by Asis.Unit_Kinds -- package -- Class : Unit_Classes; -- The class of a Compilation Unit, as defined by Asis.Unit_Kinds -- package -- Origin : Unit_Origins; -- The origin of a Compilation Unit, as defined by Asis.Unit_Kinds -- package -- Main_Unit : Boolean; -- The boolean flag indicating if a Compilation Unit may be treated -- as the main unit for a partition (See RM 10.2(7)) -- GNAT-specific!!?? -- Is_Body_Required : Boolean; -- The boolean flag indicating if a Compilation Unit requires a body -- as a completion ----------------------------------------------------------- -- Black-Box Unit Attributes Access and Update Routines -- ----------------------------------------------------------- function Top (U : Unit_Id) return Node_Id; -- this function is not trivial, it can have tree swapping as its -- "side effect" function Kind (C : Context_Id; U : Unit_Id) return Unit_Kinds; function Class (C : Context_Id; U : Unit_Id) return Unit_Classes; function Origin (C : Context_Id; U : Unit_Id) return Unit_Origins; function Is_Main_Unit (C : Context_Id; U : Unit_Id) return Boolean; function Is_Body_Required (C : Context_Id; U : Unit_Id) return Boolean; -- This function does not reset Context, a Caller is responsible for this function Time_Stamp (C : Context_Id; U : Unit_Id) return Time_Stamp_Type; function Is_Consistent (C : Context_Id; U : Unit_Id) return Boolean; function Source_Status (C : Context_Id; U : Unit_Id) return Source_File_Statuses; function Main_Tree (C : Context_Id; U : Unit_Id) return Tree_Id; function Has_Limited_View_Only (C : Context_Id; U : Unit_Id) return Boolean; -- Checks if U has only limited view in C -------- procedure Set_Top (C : Context_Id; U : Unit_Id; N : Node_Id); procedure Set_Kind (C : Context_Id; U : Unit_Id; K : Unit_Kinds); procedure Set_Class (C : Context_Id; U : Unit_Id; Cl : Unit_Classes); procedure Set_Origin (C : Context_Id; U : Unit_Id; O : Unit_Origins); procedure Set_Is_Main_Unit (C : Context_Id; U : Unit_Id; M : Boolean); procedure Set_Is_Body_Required (C : Context_Id; U : Unit_Id; B : Boolean); procedure Set_Time_Stamp (C : Context_Id; U : Unit_Id; T : Time_Stamp_Type); procedure Set_Is_Consistent (C : Context_Id; U : Unit_Id; B : Boolean); procedure Set_Source_Status (C : Context_Id; U : Unit_Id; S : Source_File_Statuses); ------------------------------------------------- --------------------------- -- Semantic Dependencies -- --------------------------- ---------------------------------------------------- -- Subprograms for Semantic Dependencies Handling -- ---------------------------------------------------- function Not_Root return Boolean; -- Checks if U is not a root library unit (by checking if -- its name contains a dot). This function itself does not set the -- normalized name of U in A_Name_Buffer, it is supposed to be called -- when a proper name is already set. function Subunits (C : Context_Id; U : Unit_Id) return Unit_Id_List; -- Returns the full list of Ids of subunits for U (if any). The full list -- contains nonexistent units for missed subunits -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Subunit (Parent_Body : Asis.Compilation_Unit; Stub_Node : Node_Id) return Asis.Compilation_Unit; -- This function is intended to be used only when all the Unit attributes -- are already computed. It gets the Parent_Body, whose tree should -- contain Stub_Node as a node representing some body stub, and it -- returns the Compilation Unit containing the proper body for this stub. -- It returns a Nil_Compilation_Unit, if the Compilation Unit containing -- the proper body does not exist in the enclosing Context or if it is -- inconsistent with Parent_Body. function Children (U : Unit_Id) return Unit_Id_List; -- returns the list of Ids of children for U (if any) -- -- Note, that this function does not reset Context, it should be done in -- the caller! function GNAT_Compilation_Dependencies (U : Unit_Id) return Unit_Id_List; -- Returns the full list of GNAT compilation dependencies for U -- This list is empty if and only if U is not a main unit of some -- compilation which creates some tree for C. procedure Form_Parent_Name; -- supposing A_Name_Buffer containing a normalized unit name, this -- function forms the normalized name of its parent by stripping out -- the suffix in the Ada part of the name (that is, the part of the -- name between the rightmost '.' and '%") and changing the -- "normalized" suffix to "%s". A_Name_Len is set in accordance with -- this. If the Ada part of the name contains no suffix (that is, if -- it corresponds to a root library unit), A_Name_Len is set equal -- to 0. function Get_Parent_Unit (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the parent unit declaration for U. If U is -- First_Unit_Id, returns Nil_Unit. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Body (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the library_unit_body for the unit U. -- Nil_Unit is not a valid argument for this function. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Declaration (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the library_unit_declaration for the unit U. -- Nil_Unit is not a valid argument for this function. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Subunit_Parent_Body (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the library_unit_body or subunit being the parent -- body for subunit U (a caller is responsible for calling this function -- for subunits). function Get_Nonexistent_Unit (C : Context_Id) return Unit_Id; -- Is supposed to be called just after an attempt to get a unit which is -- supposed to be a needed declaration or a needed body (that is, -- A_Name_Buffer contains a normalized unit name ending with "%s" or "%b" -- respectively). Tries to find the unit of A_Nonexistent_Declaration -- or A_Nonexistent_Body kind with this name, if this attempt fails, -- allocates the new unit entry for the corresponding nonexistent unit. -- Returns the Id of found or allocated unit. function Get_Same_Unit (Arg_C : Context_Id; Arg_U : Unit_Id; Targ_C : Context_Id) return Unit_Id; -- Tries to find in Targ_C just the same unit as Arg_U is in Arg_C. -- Just the same means, that Arg_U and the result of this function -- should have just the same time stamps. If Arg_C = Targ_C, Arg_U -- is returned. If there is no "just the same" unit in Targ_C, -- Nil_Unit is returned. -- -- If No (Arg_U), then the currently accessed Context is not reset (but -- this function is not supposed to be called for Arg_U equal to -- Nil_Unit_Id, although it is not an error). Otherwise Context is reset -- to Targ_C -------------------------------------- -- General-Purpose Unit Subprograms -- -------------------------------------- procedure Finalize (C : Context_Id); -- Currently this routine is only used to generate debugging output -- for the Unit Table of a given Context. function Present (Unit : Unit_Id) return Boolean; -- Tests given Unit Id for equality with Nil_Unit. This allows -- notations like "if Present (Current_Supporter)" as opposed to -- "if Current_Supporter /= Nil_Unit function No (Unit : Unit_Id) return Boolean; -- Tests given Unit Id for equality with Nil_Unit. This allows -- notations like "if No (Current_Supporter)" as opposed to -- "if Current_Supporter = Nil_Unit function Last_Unit return Unit_Id; -- Returns the Unit_Id of the last unit which has been allocated in the -- Unit Name Table. Used to define that the Unit_Id value returned by -- Name_Find corresponds to the ASIS Compilation Unit which is not -- known to ASIS. function Lib_Unit_Decls (C : Context_Id) return Natural; -- returns the number of library_unit_declaratios allocated in the -- Context Unit table function Comp_Unit_Bodies (C : Context_Id) return Natural; -- returns the number of library_unit_bodies and subunits allocated -- in the Context Unit table function Next_Decl (D : Unit_Id) return Unit_Id; -- Returns the Unit_Id of the next unit (starting from, but not including -- D), which is a library_unit_declaration. Returns Nil_Unit, if there -- is no such a unit in C. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function First_Body return Unit_Id; -- Returns the Unit_Id of the first unit which is a -- compilation_unit_body or a subunit. Returns Nil_Unit, if there is -- no such a unit in a current Context. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Next_Body (B : Unit_Id) return Unit_Id; -- Returns the Unit_Id of the next unit (starting from, but not including -- B) which is a compilation_unit_body or a subunit. Returns Nil_Unit, -- if there is no such a unit in C. -- -- Note, that this function does not reset Context, it should be done in -- the caller! procedure Output_Unit (C : Context_Id; Unit : Unit_Id); -- Produces the debug output of the Unit Table entry corresponding -- to Unit -- DO WE NEED THIS PROCEDURE IN THE SPECIFICATION???? procedure Print_Units (C : Context_Id); -- Produces the debug output from the Unit table for the Context C. function Enclosing_Unit (Cont : Context_Id; Node : Node_Id) return Asis.Compilation_Unit; -- This function is intended to be used to define the enclosing -- unit for an Element obtained as a result of some ASIS semantic query. -- It finds the N_Compilation_Unit node for the subtree enclosing -- the Node given as its argument, and then defines the corresponding -- Unit Id, which is supposed to be the Id of Enclosing Unit for an -- Element built up on the base of Node. It does not change the tree -- being currently accessed. All these computations are supposed -- to be performed for a Context Cont. -- Node should not be a result of Atree.Original_Node, because -- it is used as an argument for Atree.Parent function -- -- Note, that this function does no consistency check, that is, the -- currently accessed tree may be not from the list of consistent trees -- for the resulted Unit. --------------- -- NEW STUFF -- --------------- procedure Register_Units (Set_First_New_Unit : Boolean := False); -- When a new tree file is read in during Opening a Context, this procedure -- goes through all the units represented by this tree and checks if these -- units are already known to ASIS. If some unit is unknown, this -- procedure "register" it - it creates the corresponding entry in the -- unit table, and it sets the normalized unit name. It does not set any -- other field of unit record except Kind. It sets Kind as Not_A_Unit -- to indicate, that this unit is only registered, but not processed. -- -- We need this (pre-)registration to be made before starting unit -- processing performed by Process_Unit_New, because we need all the units -- presenting in the tree to be presented also in the Context unit table -- when storing the dependency information. -- -- Note, that all the consistency checks are made by Process_Unit_New, -- even though we can make them here. The reason is to separate this -- (pre-)registration (which is an auxiliary technical action) from -- unit-by-unit processing to facilitate the maintainability of the code. -- -- If Set_First_New_Unit is set ON, stores in A4G.Contt.First_New_Unit -- the first new unit being registered. If Set_First_New_Unit is set OFF -- or if no new units has been registered, First_New_Unit is set to -- Nil_Unit -- -- ??? The current implementation uses Set_Unit, which also sets time -- ??? stamp for a unit being registered. It looks like we do not need -- ??? this, so we can get rid of this. function Already_Processed (C : Context_Id; U : Unit_Id) return Boolean; -- Checks if U has already been processed when scanning previous trees -- during opening C procedure Check_Source_Consistency (C : Context_Id; U_Id : Unit_Id); -- Is called when a Unit is being investigated as encountered for the first -- time during opening the Context C. It checks the existence of the source -- file for this unit, and if the source file exists, it checks that the -- units as represented by the tree is consistent with the source (if this -- is required by the options associated with the Context). -- This procedure should be called after extracting the source file name -- from the tree and putting this into the Context unit table. procedure Check_Consistency (C : Context_Id; U_Id : Unit_Id; U_Num : Unit_Number_Type); -- Is called when a unit is encountered again when opening C. Checks if in -- the currently accessed tree this unit has the same time stamp as it had -- in all the previously processed trees. In case if this check fails, it -- raises ASIS_Failed and forms the diagnosis on behalf of -- Asis.Ada_Environments.Open. (This procedure does not check the source -- file for the unit - this should be done by Check_Source_Consistency -- when the unit was processed for the first time) function TS_From_OS_Time (T : OS_Time) return Time_Stamp_Type; -- Converts OS_Time into Time_Stamp_Type. Is this the right place for -- this function??? procedure Reset_Cache; -- Resents to the empty state the cache data structure used to speed up the -- Top function. Should be called as a part of closing a Context. end A4G.Contt.UT;
true
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . C O N T T . U T -- -- -- -- S p e c -- -- -- -- Copyright (C) 1995-2011, Free Software Foundation, Inc. -- -- -- -- ASIS-for-GNAT is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -- -- Public License for more details. You should have received a copy of the -- -- GNU General Public License distributed with ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 51 Franklin -- -- Street, Fifth Floor, Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by AdaCore. -- -- (http://www.PI:EMAIL:<EMAIL>END_PI). -- -- -- ------------------------------------------------------------------------------ -- This package defines for each ASIS Context the corresponding Unit Table, -- which contains all the information needed for the black-box ASIS queries -- about Compilation Units. This table also provides the mechanism for -- searching for a unit by its Ada name, this mechanism is some slight -- modification of the GNAT Namet package. with Asis; use Asis; with Asis.Extensions; use Asis.Extensions; package A4G.Contt.UT is -- Context_Table.Unit_Tables --------------------- -- ASIS Unit Table -- --------------------- -- ASIS Unit Table is the main part of the implementation of ASIS Context -- and ASIS Compilation Unit abstractions. The table is organized in the -- following way: -- - the internal representation of an ASIS Compilation Unit is the -- value of the corresponding Unit Record which is kept in Unit Table -- and indicated by Unit Id; -- - each ASIS Context has its own Unit Table, so most the routines -- dealing with Unit Table contain the Id of an Enclosing Context -- as a Parameter; -- - each ASIS Compilation Units keeps the Id of its enclosing -- Context as a part of its value; -- - The fully expanded Ada name, together for the spec/body sign, -- uniquely identifies a given unit inside its enclosing -- Context/Context; so the triple - expanded Ada name, spec/body -- sign and some identification of the Unit's enclosing Context/Context -- uniquely identifies a given unit among all the Unit processed -- by ASIS; -- - The normalized Ada name, is obtained from the fully expanded -- Ada Unit name by folding all the upper case letters in the -- corresponding lower case letters, appending the spec/body sign -- (which has the form "%s" for a spec and "%b" for a body); -- The entries in the table are accessed using a Unit_Id that ranges -- from First_Unit_Id to Last_Unit_Id. The fields of each entry and -- the corresponding interfaces may be subdivided into four groups. -- The first group, called as Unit Name Table, provides the modified -- version of the functionality of the GNAT Namet package, it is used -- for storing the names of the Units in two forms - in the normalized -- and in the form corresponding to the (defining) occurrence of a -- given name in a source text. Each unit can be effectively searched -- by its normalized name. -- The second group contains the black-box attributes of a Unit. -- The third group contains the information about relations (semantic -- dependencies) between the given unit and the other units in the -- enclosing Context/Context Note, that Ada Unit name, -- included in the first group, logically should also be considered -- as a black-box Unit attribute. -- And the fourth group contains the fields needed for organization of the -- tree swapping during the multiple Units processing. --------------------- -- Unit Name Table -- --------------------- -- Each Unit entry contain the following fields: -- "Normalized" Ada name "Normalized" Ada names of the ASIS Compilation -- Units are their names with upper case letters -- folded to lower case (by applying the -- Ada.Character.Handling.To_Lower functions; -- this lover-case-folding has no relation to GNAT -- conventions described in Namet!), appended by -- suffix %s or %b for spec or bodies/subunits, as -- defined in Uname (spec), and prepended by -- the string image of the Id value of the unit's -- enclosing Context. Each of the names of this -- kind may have only one entry in Unit Name Table. -- -- Ada name Ada names of the ASIS Compilation Units are -- stored keeping the casing from the source text. -- These entries are used to implement the ASIS -- query (-ies?) returning the Ada name of the -- Unit. Ada names may be included more than one -- time in Unit Name Table as the parts of the -- different table entries, as the name of a spec -- and the name of a corresponding body. -- -- Source File Name The name of the Ada source file used to compile -- the given compilation unit (on its own or as a -- supporter of some other unit). -- -- Reference File Name The name of the source file which represents -- the unit source from the user's viewpoint. It is -- the same as the Source File name unless the -- Source_Reference pragma presents for the given -- unit. type Column is (Norm_Ada_Name, Ada_Name, Source_File_Name, Ref_File_Name); -- This enumeration type defines literals used to make the difference -- between different forms of names stored in the Unit Table -- Really every name is kept as the reference into the Char table, -- together with the length of its name. -- The normalized names are hashed, so that a given normalized name appears -- only once in the table. -- Opposite to the GNAT name table, this name table does not handle the -- one-character values in a special way (there is no need for it, because -- storing an one-character name does not seem to be a usual thing -- for this table.) -- ASIS "normalized" Unit names follow the convention which is -- very similar to the GNAT convention defined in Uname (spec), the -- only difference is that ASIS folds all the upper case -- letters to the corresponding lower case letters without any encoding. -- ASIS packages implementing the ASIS Context model for GNAT contain -- "ASIS-related counterparts" of some facilities provided by three -- GNAT packages - Namet, Uname and Fname. -- We keep storing the two values, one of type Int and one of type Byte, -- with each names table entry and subprograms are provided for setting -- and retrieving these associated values. But for now these values are -- of no use in ASIS - we simply are keeping this mechanism from the -- GNAT name table - just in case. -- Unit Name Table may be considered as having the external view -- of the two-column table - for each row indicated by Unit_Id the -- first column contains the Ada name of the corresponding Unit and -- the second column contains Unit's "normalized" name. -- In fact we do not use any encoding-decoding in Unit Name Table. ASIS -- supports only a standard mode of GNAT (that is, it relies on the fact -- that all the identifiers contain only Row 00 characters). ASIS also -- assumes that all the names of the source files are the values of -- the Ada predefined String type. -- All the Unit Tables shares the same Name Buffer, see the specification -- of the parent package for its definition. --------------------------------- -- Unit Name Table Subprograms -- --------------------------------- procedure Get_Name_String (Id : Unit_Id; Col : Column); -- Get_Name_String is used to retrieve the one of the three strings -- associated with an entry in the names table. The Col parameter -- indicates which of the names should be retrieved (Ada name, normalized -- Ada name or source file name) by indicating the "column" in the table -- The resulting string is stored in Name_Buffer and Name_Len is set. function Length_Of_Name (Id : Unit_Id; Col : Column) return Nat; -- ??? pragma Inline (Length_Of_Name); -- Returns length of given name in characters, the result is equivalent to -- calling Get_Name_String and reading Name_Len, except that a call to -- Length_Of_Name does not affect the contents of Name_Len and Name_Buffer. function Name_Find (C : Context_Id) return Unit_Id; -- Name_Find is called with a string stored in Name_Buffer whose length -- is in Name_Len (i.e. the characters of the name are in subscript -- positions 1 to Name_Len in Name_Buffer). It searches the names -- table to see if the string has already been stored. If so the Id of -- the existing entry is returned. Otherwise (opposite to the GNAT name -- table, in which a new entry is created it this situation with its -- Name_Table_Info field set to zero) the Id value corresponding to the -- ASIS Nil_Compilation_Unit, that is Nil_Unit, is returned. -- -- Only normalized Ada names are hashed, so this function is intended to -- be applied to the normalized names only (in is not an error to apply -- it to other forms of names stored in the table, but the result will -- always be Nil_Unit. function Allocate_Unit_Entry (C : Context_Id) return Unit_Id; -- Allocates the new entry in the Unit Name Table for the "normalized" -- Ada Unit name stored in the Name_Buffer (Name_Len should be set -- in a proper way). This routine should be called only if the -- immediately preceding call to an operation working with Unit Name -- Table is the call to Name_Find which has yielded Nil_Unit as a -- result. Note, that this function sets only the "normalized" unit name, -- it does not set the Ada name or the source file name. It also -- increases by one the counter of allocated bodies or specs, depending -- on the suffix in the normalized unit name. function Allocate_Nonexistent_Unit_Entry (C : Context_Id) return Unit_Id; -- Differs from the previous function in the following aspects: -- - 'n' is added to the name suffix to mark that this entry -- corresponds to the nonexistent unit; -- - The body/spec counters are not increased -- - all the attributes of the allocated nonexistent unit are set by -- this procedure. -- -- Allocates the new entry in the Unit Name Table for the "normalized" -- Ada Unit name stored in the Name_Buffer (Name_Len should be set -- in a proper way). This routine should be called only if the -- immediately preceding call to an operation working with Unit Name -- Table is the call to Name_Find which has yielded Nil_Unit as a -- result. Note, that this function sets only the "normalized" unit name, -- it does not set the Ada name or the source file name. function Set_Unit (C : Context_Id; U : Unit_Number_Type) return Unit_Id; -- Creates the Unit table entry for the unit U and sets the normalized -- unit name (which is supposed to be stored in A_Name_Buffer when this -- procedure is called) and the time stamp for the unit. It also adds -- the (Id of the) currently accessed tree to the (empty) list -- of (consistent) trees for this unit. All the other unit attributes -- are set to nil values. The ID of the created entry is returned as a -- result procedure Set_Ada_Name (Id : Unit_Id); pragma Inline (Set_Ada_Name); -- Sets the string stored in Name_Buffer whose length is Name_Len as the -- value of the Ada name of the ASIS Unit indicated by Id value procedure Set_Norm_Ada_Name (Id : Unit_Id); pragma Inline (Set_Norm_Ada_Name); -- Sets the string stored in Name_Buffer whose length is Name_Len as the -- value of the "normalized" Ada name of the ASIS Unit indicated by Id -- value procedure Set_Ref_File_As_Source_File (U : Unit_Id); -- For a given unit in a given context, sets the reference file name equal -- to the source file name (by copying the corresponding references to -- the ASIS Chars table procedure Set_Source_File_Name (Id : Unit_Id; Ref : Boolean := False); pragma Inline (Set_Source_File_Name); -- Sets the string stored in the A_Name_Buffer whose length is A_Name_Len -- as the value of the source or reference (depending on the actual set -- for the Ref parameter) file name of the ASIS Unit indicated by Id value procedure Set_Norm_Ada_Name_String; -- Sets the Normalized Ada Unit name as the value of Name_Buffer. -- This normalized version of the Ada Unit name is -- obtained by folding to lover cases of the GNAT unit name -- which should be previously get as the content of -- Namet.Name_Buffer (that means that every call to this procedure -- should be preceded by the appropriate call to -- Namet.Get_Unqualified_Decoded_Name_String (or -- Namet.Get_Decoded_Name_String if the caller is sure, that the name is -- not qualified) procedure Set_Norm_Ada_Name_String_With_Check (Unit : Unit_Number_Type; Success : out Boolean); -- This is the modified version of Set_Norm_Ada_Name_String: after setting -- the ASIS name buffer it checks if Unit should be considered as -- Compilation_Unit by ASIS. The need for this check caused by artificial -- compilation units created by the compiler for library-level generic -- instantiations. If the check is successful, Success is set True, -- otherwise it is set False. -- -- In case of a tree created for library-level instantiation of a generic -- package (only package ???) GNAT sets the suffix of the name of the -- corresponding unit in its unit table as '%b', but ASIS has to see -- this unit as a spec, therefore in this case this procedure resets the -- suffix of the unit name to '%s' procedure Set_Ref_File_Name_String (U : Unit_Id); -- Is supposed to be called when GNAT Namet.Name_Buffer contains a full -- reference file name. It sets the Reference File name as the value of -- A_Name_Buffer. This name is composed from the reference file name -- obtained from the tree and from the source file name (in which the -- directory information is already adjusted , if needed, by the -- corresponding call to Set_S_File_Name_String) to contain the directory -- information needed to access this file from the current directory. ------------------------------- -- Black-Box Unit Attributes -- ------------------------------- -- Each Unit entry contains the following fields, representing the Unit -- black-box attributes, which are for the direct interest for the ASIS -- queries from the Asis_Compilation_Unit package, the primary idea of -- implementing the Context/Compilation_Unit stuff in ASIS-for-GNAT is -- to compute each of these attribute only once, when the new tree is -- inputted by ASIS for the first time, and then store them in Unit -- Table, so then ASIS queries will be able to get the required -- answer without any new tree processing: -- Top : Node_Id; -- The top node of the unit subtree in the currently accessed full tree. -- From one side, this node should be reset every time the full tree -- is changed. From the other side, the corresponding actions may be -- considered as too time-consumed. This problem is postponed now as -- OPEN PROBLEM, it is not important till we are working under the -- limitation "only one tree can be accessed at a time" -- Enclosing_Context : Context_Id; -- The reference to the Context table which indicates the Enclosing -- Context for a Unit -- Kind : Unit_Kinds; -- The kind of a Compilation Unit, as defined by Asis.Unit_Kinds -- package -- Class : Unit_Classes; -- The class of a Compilation Unit, as defined by Asis.Unit_Kinds -- package -- Origin : Unit_Origins; -- The origin of a Compilation Unit, as defined by Asis.Unit_Kinds -- package -- Main_Unit : Boolean; -- The boolean flag indicating if a Compilation Unit may be treated -- as the main unit for a partition (See RM 10.2(7)) -- GNAT-specific!!?? -- Is_Body_Required : Boolean; -- The boolean flag indicating if a Compilation Unit requires a body -- as a completion ----------------------------------------------------------- -- Black-Box Unit Attributes Access and Update Routines -- ----------------------------------------------------------- function Top (U : Unit_Id) return Node_Id; -- this function is not trivial, it can have tree swapping as its -- "side effect" function Kind (C : Context_Id; U : Unit_Id) return Unit_Kinds; function Class (C : Context_Id; U : Unit_Id) return Unit_Classes; function Origin (C : Context_Id; U : Unit_Id) return Unit_Origins; function Is_Main_Unit (C : Context_Id; U : Unit_Id) return Boolean; function Is_Body_Required (C : Context_Id; U : Unit_Id) return Boolean; -- This function does not reset Context, a Caller is responsible for this function Time_Stamp (C : Context_Id; U : Unit_Id) return Time_Stamp_Type; function Is_Consistent (C : Context_Id; U : Unit_Id) return Boolean; function Source_Status (C : Context_Id; U : Unit_Id) return Source_File_Statuses; function Main_Tree (C : Context_Id; U : Unit_Id) return Tree_Id; function Has_Limited_View_Only (C : Context_Id; U : Unit_Id) return Boolean; -- Checks if U has only limited view in C -------- procedure Set_Top (C : Context_Id; U : Unit_Id; N : Node_Id); procedure Set_Kind (C : Context_Id; U : Unit_Id; K : Unit_Kinds); procedure Set_Class (C : Context_Id; U : Unit_Id; Cl : Unit_Classes); procedure Set_Origin (C : Context_Id; U : Unit_Id; O : Unit_Origins); procedure Set_Is_Main_Unit (C : Context_Id; U : Unit_Id; M : Boolean); procedure Set_Is_Body_Required (C : Context_Id; U : Unit_Id; B : Boolean); procedure Set_Time_Stamp (C : Context_Id; U : Unit_Id; T : Time_Stamp_Type); procedure Set_Is_Consistent (C : Context_Id; U : Unit_Id; B : Boolean); procedure Set_Source_Status (C : Context_Id; U : Unit_Id; S : Source_File_Statuses); ------------------------------------------------- --------------------------- -- Semantic Dependencies -- --------------------------- ---------------------------------------------------- -- Subprograms for Semantic Dependencies Handling -- ---------------------------------------------------- function Not_Root return Boolean; -- Checks if U is not a root library unit (by checking if -- its name contains a dot). This function itself does not set the -- normalized name of U in A_Name_Buffer, it is supposed to be called -- when a proper name is already set. function Subunits (C : Context_Id; U : Unit_Id) return Unit_Id_List; -- Returns the full list of Ids of subunits for U (if any). The full list -- contains nonexistent units for missed subunits -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Subunit (Parent_Body : Asis.Compilation_Unit; Stub_Node : Node_Id) return Asis.Compilation_Unit; -- This function is intended to be used only when all the Unit attributes -- are already computed. It gets the Parent_Body, whose tree should -- contain Stub_Node as a node representing some body stub, and it -- returns the Compilation Unit containing the proper body for this stub. -- It returns a Nil_Compilation_Unit, if the Compilation Unit containing -- the proper body does not exist in the enclosing Context or if it is -- inconsistent with Parent_Body. function Children (U : Unit_Id) return Unit_Id_List; -- returns the list of Ids of children for U (if any) -- -- Note, that this function does not reset Context, it should be done in -- the caller! function GNAT_Compilation_Dependencies (U : Unit_Id) return Unit_Id_List; -- Returns the full list of GNAT compilation dependencies for U -- This list is empty if and only if U is not a main unit of some -- compilation which creates some tree for C. procedure Form_Parent_Name; -- supposing A_Name_Buffer containing a normalized unit name, this -- function forms the normalized name of its parent by stripping out -- the suffix in the Ada part of the name (that is, the part of the -- name between the rightmost '.' and '%") and changing the -- "normalized" suffix to "%s". A_Name_Len is set in accordance with -- this. If the Ada part of the name contains no suffix (that is, if -- it corresponds to a root library unit), A_Name_Len is set equal -- to 0. function Get_Parent_Unit (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the parent unit declaration for U. If U is -- First_Unit_Id, returns Nil_Unit. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Body (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the library_unit_body for the unit U. -- Nil_Unit is not a valid argument for this function. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Declaration (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the library_unit_declaration for the unit U. -- Nil_Unit is not a valid argument for this function. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Get_Subunit_Parent_Body (C : Context_Id; U : Unit_Id) return Unit_Id; -- returns the Id of the library_unit_body or subunit being the parent -- body for subunit U (a caller is responsible for calling this function -- for subunits). function Get_Nonexistent_Unit (C : Context_Id) return Unit_Id; -- Is supposed to be called just after an attempt to get a unit which is -- supposed to be a needed declaration or a needed body (that is, -- A_Name_Buffer contains a normalized unit name ending with "%s" or "%b" -- respectively). Tries to find the unit of A_Nonexistent_Declaration -- or A_Nonexistent_Body kind with this name, if this attempt fails, -- allocates the new unit entry for the corresponding nonexistent unit. -- Returns the Id of found or allocated unit. function Get_Same_Unit (Arg_C : Context_Id; Arg_U : Unit_Id; Targ_C : Context_Id) return Unit_Id; -- Tries to find in Targ_C just the same unit as Arg_U is in Arg_C. -- Just the same means, that Arg_U and the result of this function -- should have just the same time stamps. If Arg_C = Targ_C, Arg_U -- is returned. If there is no "just the same" unit in Targ_C, -- Nil_Unit is returned. -- -- If No (Arg_U), then the currently accessed Context is not reset (but -- this function is not supposed to be called for Arg_U equal to -- Nil_Unit_Id, although it is not an error). Otherwise Context is reset -- to Targ_C -------------------------------------- -- General-Purpose Unit Subprograms -- -------------------------------------- procedure Finalize (C : Context_Id); -- Currently this routine is only used to generate debugging output -- for the Unit Table of a given Context. function Present (Unit : Unit_Id) return Boolean; -- Tests given Unit Id for equality with Nil_Unit. This allows -- notations like "if Present (Current_Supporter)" as opposed to -- "if Current_Supporter /= Nil_Unit function No (Unit : Unit_Id) return Boolean; -- Tests given Unit Id for equality with Nil_Unit. This allows -- notations like "if No (Current_Supporter)" as opposed to -- "if Current_Supporter = Nil_Unit function Last_Unit return Unit_Id; -- Returns the Unit_Id of the last unit which has been allocated in the -- Unit Name Table. Used to define that the Unit_Id value returned by -- Name_Find corresponds to the ASIS Compilation Unit which is not -- known to ASIS. function Lib_Unit_Decls (C : Context_Id) return Natural; -- returns the number of library_unit_declaratios allocated in the -- Context Unit table function Comp_Unit_Bodies (C : Context_Id) return Natural; -- returns the number of library_unit_bodies and subunits allocated -- in the Context Unit table function Next_Decl (D : Unit_Id) return Unit_Id; -- Returns the Unit_Id of the next unit (starting from, but not including -- D), which is a library_unit_declaration. Returns Nil_Unit, if there -- is no such a unit in C. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function First_Body return Unit_Id; -- Returns the Unit_Id of the first unit which is a -- compilation_unit_body or a subunit. Returns Nil_Unit, if there is -- no such a unit in a current Context. -- -- Note, that this function does not reset Context, it should be done in -- the caller! function Next_Body (B : Unit_Id) return Unit_Id; -- Returns the Unit_Id of the next unit (starting from, but not including -- B) which is a compilation_unit_body or a subunit. Returns Nil_Unit, -- if there is no such a unit in C. -- -- Note, that this function does not reset Context, it should be done in -- the caller! procedure Output_Unit (C : Context_Id; Unit : Unit_Id); -- Produces the debug output of the Unit Table entry corresponding -- to Unit -- DO WE NEED THIS PROCEDURE IN THE SPECIFICATION???? procedure Print_Units (C : Context_Id); -- Produces the debug output from the Unit table for the Context C. function Enclosing_Unit (Cont : Context_Id; Node : Node_Id) return Asis.Compilation_Unit; -- This function is intended to be used to define the enclosing -- unit for an Element obtained as a result of some ASIS semantic query. -- It finds the N_Compilation_Unit node for the subtree enclosing -- the Node given as its argument, and then defines the corresponding -- Unit Id, which is supposed to be the Id of Enclosing Unit for an -- Element built up on the base of Node. It does not change the tree -- being currently accessed. All these computations are supposed -- to be performed for a Context Cont. -- Node should not be a result of Atree.Original_Node, because -- it is used as an argument for Atree.Parent function -- -- Note, that this function does no consistency check, that is, the -- currently accessed tree may be not from the list of consistent trees -- for the resulted Unit. --------------- -- NEW STUFF -- --------------- procedure Register_Units (Set_First_New_Unit : Boolean := False); -- When a new tree file is read in during Opening a Context, this procedure -- goes through all the units represented by this tree and checks if these -- units are already known to ASIS. If some unit is unknown, this -- procedure "register" it - it creates the corresponding entry in the -- unit table, and it sets the normalized unit name. It does not set any -- other field of unit record except Kind. It sets Kind as Not_A_Unit -- to indicate, that this unit is only registered, but not processed. -- -- We need this (pre-)registration to be made before starting unit -- processing performed by Process_Unit_New, because we need all the units -- presenting in the tree to be presented also in the Context unit table -- when storing the dependency information. -- -- Note, that all the consistency checks are made by Process_Unit_New, -- even though we can make them here. The reason is to separate this -- (pre-)registration (which is an auxiliary technical action) from -- unit-by-unit processing to facilitate the maintainability of the code. -- -- If Set_First_New_Unit is set ON, stores in A4G.Contt.First_New_Unit -- the first new unit being registered. If Set_First_New_Unit is set OFF -- or if no new units has been registered, First_New_Unit is set to -- Nil_Unit -- -- ??? The current implementation uses Set_Unit, which also sets time -- ??? stamp for a unit being registered. It looks like we do not need -- ??? this, so we can get rid of this. function Already_Processed (C : Context_Id; U : Unit_Id) return Boolean; -- Checks if U has already been processed when scanning previous trees -- during opening C procedure Check_Source_Consistency (C : Context_Id; U_Id : Unit_Id); -- Is called when a Unit is being investigated as encountered for the first -- time during opening the Context C. It checks the existence of the source -- file for this unit, and if the source file exists, it checks that the -- units as represented by the tree is consistent with the source (if this -- is required by the options associated with the Context). -- This procedure should be called after extracting the source file name -- from the tree and putting this into the Context unit table. procedure Check_Consistency (C : Context_Id; U_Id : Unit_Id; U_Num : Unit_Number_Type); -- Is called when a unit is encountered again when opening C. Checks if in -- the currently accessed tree this unit has the same time stamp as it had -- in all the previously processed trees. In case if this check fails, it -- raises ASIS_Failed and forms the diagnosis on behalf of -- Asis.Ada_Environments.Open. (This procedure does not check the source -- file for the unit - this should be done by Check_Source_Consistency -- when the unit was processed for the first time) function TS_From_OS_Time (T : OS_Time) return Time_Stamp_Type; -- Converts OS_Time into Time_Stamp_Type. Is this the right place for -- this function??? procedure Reset_Cache; -- Resents to the empty state the cache data structure used to speed up the -- Top function. Should be called as a part of closing a Context. end A4G.Contt.UT;
[ { "context": "e-Identifier: Apache-2.0\n--\n-- Copyright (c) 2018 onox <denkpadje@gmail.com>\n--\n-- Licensed under the A", "end": 70, "score": 0.9989571571350098, "start": 66, "tag": "USERNAME", "value": "onox" }, { "context": "ifier: Apache-2.0\n--\n-- Copyright (c) 2018 onox <denkpadje@gmail.com>\n--\n-- Licensed under the Apache License, Versio", "end": 91, "score": 0.9999250173568726, "start": 72, "tag": "EMAIL", "value": "denkpadje@gmail.com" } ]
orka/src/gl/implementation/gl-enums-internalformat.ads
onox/orka
52
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package GL.Enums.Internalformat is pragma Preelaborate; type Parameter is (Samples, Internalformat_Supported, Internalformat_Preferred, Internalformat_Red_Size, Internalformat_Green_Size, Internalformat_Blue_Size, Internalformat_Alpha_Size, Internalformat_Depth_Size, Internalformat_Stencil_Size, Internalformat_Shared_Size, Internalformat_Red_Type, Internalformat_Green_Type, Internalformat_Blue_Type, Internalformat_Alpha_Type, Internalformat_Depth_Type, Internalformat_Stencil_Type, Max_Width, Max_Height, Max_Depth, Max_Layers, Max_Combined_Dimensions, Color_Components, Depth_Components, Stencil_Components, Color_Renderable, Depth_Renderable, Stencil_Renderable, Framebuffer_Renderable, Framebuffer_Renderable_Layered, Framebuffer_Blend, Texture_Image_Format, Texture_Image_Type, Get_Texture_Image_Format, Get_Texture_Image_Type, Mipmap, Manual_Generate_Mipmap, Auto_Generate_Mipmap, Color_Encoding, sRGB_Read, sRGB_Write, sRGB_Decode_ARB, Filter, Vertex_Texture, Tess_Control_Texture, Tess_Evaluation_Texture, Geometry_Texture, Fragment_Texture, Compute_Texture, Texture_Shadow, Texture_Gather, Texture_Gather_Shadow, Shader_Image_Load, Shader_Image_Store, Shader_Image_Atomic, Image_Texel_Size, Image_Compatibility_Class, Image_Pixel_Format, Image_Pixel_Type, Simultaneous_Texture_And_Depth_Test, Simultaneous_Texture_And_Stencil_Test, Simultaneous_Texture_And_Depth_Write, Simultaneous_Texture_And_Stencil_Write, Texture_Compressed_Block_Width, Texture_Compressed_Block_Height, Texture_Compressed_Block_Size, Clear_Buffer, Texture_View, View_Compatibility_Class, Texture_Compressed, Image_Format_Compatibility_Type, Num_Sample_Counts); private for Parameter use (Samples => 16#80A9#, Internalformat_Supported => 16#826F#, Internalformat_Preferred => 16#8270#, Internalformat_Red_Size => 16#8271#, Internalformat_Green_Size => 16#8272#, Internalformat_Blue_Size => 16#8273#, Internalformat_Alpha_Size => 16#8274#, Internalformat_Depth_Size => 16#8275#, Internalformat_Stencil_Size => 16#8276#, Internalformat_Shared_Size => 16#8277#, Internalformat_Red_Type => 16#8278#, Internalformat_Green_Type => 16#8279#, Internalformat_Blue_Type => 16#827A#, Internalformat_Alpha_Type => 16#827B#, Internalformat_Depth_Type => 16#827C#, Internalformat_Stencil_Type => 16#827D#, Max_Width => 16#827E#, Max_Height => 16#827F#, Max_Depth => 16#8280#, Max_Layers => 16#8281#, Max_Combined_Dimensions => 16#8282#, Color_Components => 16#8283#, Depth_Components => 16#8284#, Stencil_Components => 16#8285#, Color_Renderable => 16#8286#, Depth_Renderable => 16#8287#, Stencil_Renderable => 16#8288#, Framebuffer_Renderable => 16#8289#, Framebuffer_Renderable_Layered => 16#828A#, Framebuffer_Blend => 16#828B#, Texture_Image_Format => 16#828F#, Texture_Image_Type => 16#8290#, Get_Texture_Image_Format => 16#8291#, Get_Texture_Image_Type => 16#8292#, Mipmap => 16#8293#, Manual_Generate_Mipmap => 16#8294#, Auto_Generate_Mipmap => 16#8295#, Color_Encoding => 16#8296#, sRGB_Read => 16#8297#, sRGB_Write => 16#8298#, sRGB_Decode_ARB => 16#8299#, Filter => 16#829A#, Vertex_Texture => 16#829B#, Tess_Control_Texture => 16#829C#, Tess_Evaluation_Texture => 16#829D#, Geometry_Texture => 16#829E#, Fragment_Texture => 16#829F#, Compute_Texture => 16#82A0#, Texture_Shadow => 16#82A1#, Texture_Gather => 16#82A2#, Texture_Gather_Shadow => 16#82A3#, Shader_Image_Load => 16#82A4#, Shader_Image_Store => 16#82A5#, Shader_Image_Atomic => 16#82A6#, Image_Texel_Size => 16#82A7#, Image_Compatibility_Class => 16#82A8#, Image_Pixel_Format => 16#82A9#, Image_Pixel_Type => 16#82AA#, Simultaneous_Texture_And_Depth_Test => 16#82AC#, Simultaneous_Texture_And_Stencil_Test => 16#82AD#, Simultaneous_Texture_And_Depth_Write => 16#82AE#, Simultaneous_Texture_And_Stencil_Write => 16#82AF#, Texture_Compressed_Block_Width => 16#82B1#, Texture_Compressed_Block_Height => 16#82B2#, Texture_Compressed_Block_Size => 16#82B3#, Clear_Buffer => 16#82B4#, Texture_View => 16#82B5#, View_Compatibility_Class => 16#82B6#, Texture_Compressed => 16#86A1#, Image_Format_Compatibility_Type => 16#90C7#, Num_Sample_Counts => 16#9380#); for Parameter'Size use Low_Level.Enum'Size; end GL.Enums.Internalformat;
6127
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 onox <<EMAIL>> -- -- 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 GL.Enums.Internalformat is pragma Preelaborate; type Parameter is (Samples, Internalformat_Supported, Internalformat_Preferred, Internalformat_Red_Size, Internalformat_Green_Size, Internalformat_Blue_Size, Internalformat_Alpha_Size, Internalformat_Depth_Size, Internalformat_Stencil_Size, Internalformat_Shared_Size, Internalformat_Red_Type, Internalformat_Green_Type, Internalformat_Blue_Type, Internalformat_Alpha_Type, Internalformat_Depth_Type, Internalformat_Stencil_Type, Max_Width, Max_Height, Max_Depth, Max_Layers, Max_Combined_Dimensions, Color_Components, Depth_Components, Stencil_Components, Color_Renderable, Depth_Renderable, Stencil_Renderable, Framebuffer_Renderable, Framebuffer_Renderable_Layered, Framebuffer_Blend, Texture_Image_Format, Texture_Image_Type, Get_Texture_Image_Format, Get_Texture_Image_Type, Mipmap, Manual_Generate_Mipmap, Auto_Generate_Mipmap, Color_Encoding, sRGB_Read, sRGB_Write, sRGB_Decode_ARB, Filter, Vertex_Texture, Tess_Control_Texture, Tess_Evaluation_Texture, Geometry_Texture, Fragment_Texture, Compute_Texture, Texture_Shadow, Texture_Gather, Texture_Gather_Shadow, Shader_Image_Load, Shader_Image_Store, Shader_Image_Atomic, Image_Texel_Size, Image_Compatibility_Class, Image_Pixel_Format, Image_Pixel_Type, Simultaneous_Texture_And_Depth_Test, Simultaneous_Texture_And_Stencil_Test, Simultaneous_Texture_And_Depth_Write, Simultaneous_Texture_And_Stencil_Write, Texture_Compressed_Block_Width, Texture_Compressed_Block_Height, Texture_Compressed_Block_Size, Clear_Buffer, Texture_View, View_Compatibility_Class, Texture_Compressed, Image_Format_Compatibility_Type, Num_Sample_Counts); private for Parameter use (Samples => 16#80A9#, Internalformat_Supported => 16#826F#, Internalformat_Preferred => 16#8270#, Internalformat_Red_Size => 16#8271#, Internalformat_Green_Size => 16#8272#, Internalformat_Blue_Size => 16#8273#, Internalformat_Alpha_Size => 16#8274#, Internalformat_Depth_Size => 16#8275#, Internalformat_Stencil_Size => 16#8276#, Internalformat_Shared_Size => 16#8277#, Internalformat_Red_Type => 16#8278#, Internalformat_Green_Type => 16#8279#, Internalformat_Blue_Type => 16#827A#, Internalformat_Alpha_Type => 16#827B#, Internalformat_Depth_Type => 16#827C#, Internalformat_Stencil_Type => 16#827D#, Max_Width => 16#827E#, Max_Height => 16#827F#, Max_Depth => 16#8280#, Max_Layers => 16#8281#, Max_Combined_Dimensions => 16#8282#, Color_Components => 16#8283#, Depth_Components => 16#8284#, Stencil_Components => 16#8285#, Color_Renderable => 16#8286#, Depth_Renderable => 16#8287#, Stencil_Renderable => 16#8288#, Framebuffer_Renderable => 16#8289#, Framebuffer_Renderable_Layered => 16#828A#, Framebuffer_Blend => 16#828B#, Texture_Image_Format => 16#828F#, Texture_Image_Type => 16#8290#, Get_Texture_Image_Format => 16#8291#, Get_Texture_Image_Type => 16#8292#, Mipmap => 16#8293#, Manual_Generate_Mipmap => 16#8294#, Auto_Generate_Mipmap => 16#8295#, Color_Encoding => 16#8296#, sRGB_Read => 16#8297#, sRGB_Write => 16#8298#, sRGB_Decode_ARB => 16#8299#, Filter => 16#829A#, Vertex_Texture => 16#829B#, Tess_Control_Texture => 16#829C#, Tess_Evaluation_Texture => 16#829D#, Geometry_Texture => 16#829E#, Fragment_Texture => 16#829F#, Compute_Texture => 16#82A0#, Texture_Shadow => 16#82A1#, Texture_Gather => 16#82A2#, Texture_Gather_Shadow => 16#82A3#, Shader_Image_Load => 16#82A4#, Shader_Image_Store => 16#82A5#, Shader_Image_Atomic => 16#82A6#, Image_Texel_Size => 16#82A7#, Image_Compatibility_Class => 16#82A8#, Image_Pixel_Format => 16#82A9#, Image_Pixel_Type => 16#82AA#, Simultaneous_Texture_And_Depth_Test => 16#82AC#, Simultaneous_Texture_And_Stencil_Test => 16#82AD#, Simultaneous_Texture_And_Depth_Write => 16#82AE#, Simultaneous_Texture_And_Stencil_Write => 16#82AF#, Texture_Compressed_Block_Width => 16#82B1#, Texture_Compressed_Block_Height => 16#82B2#, Texture_Compressed_Block_Size => 16#82B3#, Clear_Buffer => 16#82B4#, Texture_View => 16#82B5#, View_Compatibility_Class => 16#82B6#, Texture_Compressed => 16#86A1#, Image_Format_Compatibility_Type => 16#90C7#, Num_Sample_Counts => 16#9380#); for Parameter'Size use Low_Level.Enum'Size; end GL.Enums.Internalformat;
true
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 onox <PI:EMAIL:<EMAIL>END_PI> -- -- 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 GL.Enums.Internalformat is pragma Preelaborate; type Parameter is (Samples, Internalformat_Supported, Internalformat_Preferred, Internalformat_Red_Size, Internalformat_Green_Size, Internalformat_Blue_Size, Internalformat_Alpha_Size, Internalformat_Depth_Size, Internalformat_Stencil_Size, Internalformat_Shared_Size, Internalformat_Red_Type, Internalformat_Green_Type, Internalformat_Blue_Type, Internalformat_Alpha_Type, Internalformat_Depth_Type, Internalformat_Stencil_Type, Max_Width, Max_Height, Max_Depth, Max_Layers, Max_Combined_Dimensions, Color_Components, Depth_Components, Stencil_Components, Color_Renderable, Depth_Renderable, Stencil_Renderable, Framebuffer_Renderable, Framebuffer_Renderable_Layered, Framebuffer_Blend, Texture_Image_Format, Texture_Image_Type, Get_Texture_Image_Format, Get_Texture_Image_Type, Mipmap, Manual_Generate_Mipmap, Auto_Generate_Mipmap, Color_Encoding, sRGB_Read, sRGB_Write, sRGB_Decode_ARB, Filter, Vertex_Texture, Tess_Control_Texture, Tess_Evaluation_Texture, Geometry_Texture, Fragment_Texture, Compute_Texture, Texture_Shadow, Texture_Gather, Texture_Gather_Shadow, Shader_Image_Load, Shader_Image_Store, Shader_Image_Atomic, Image_Texel_Size, Image_Compatibility_Class, Image_Pixel_Format, Image_Pixel_Type, Simultaneous_Texture_And_Depth_Test, Simultaneous_Texture_And_Stencil_Test, Simultaneous_Texture_And_Depth_Write, Simultaneous_Texture_And_Stencil_Write, Texture_Compressed_Block_Width, Texture_Compressed_Block_Height, Texture_Compressed_Block_Size, Clear_Buffer, Texture_View, View_Compatibility_Class, Texture_Compressed, Image_Format_Compatibility_Type, Num_Sample_Counts); private for Parameter use (Samples => 16#80A9#, Internalformat_Supported => 16#826F#, Internalformat_Preferred => 16#8270#, Internalformat_Red_Size => 16#8271#, Internalformat_Green_Size => 16#8272#, Internalformat_Blue_Size => 16#8273#, Internalformat_Alpha_Size => 16#8274#, Internalformat_Depth_Size => 16#8275#, Internalformat_Stencil_Size => 16#8276#, Internalformat_Shared_Size => 16#8277#, Internalformat_Red_Type => 16#8278#, Internalformat_Green_Type => 16#8279#, Internalformat_Blue_Type => 16#827A#, Internalformat_Alpha_Type => 16#827B#, Internalformat_Depth_Type => 16#827C#, Internalformat_Stencil_Type => 16#827D#, Max_Width => 16#827E#, Max_Height => 16#827F#, Max_Depth => 16#8280#, Max_Layers => 16#8281#, Max_Combined_Dimensions => 16#8282#, Color_Components => 16#8283#, Depth_Components => 16#8284#, Stencil_Components => 16#8285#, Color_Renderable => 16#8286#, Depth_Renderable => 16#8287#, Stencil_Renderable => 16#8288#, Framebuffer_Renderable => 16#8289#, Framebuffer_Renderable_Layered => 16#828A#, Framebuffer_Blend => 16#828B#, Texture_Image_Format => 16#828F#, Texture_Image_Type => 16#8290#, Get_Texture_Image_Format => 16#8291#, Get_Texture_Image_Type => 16#8292#, Mipmap => 16#8293#, Manual_Generate_Mipmap => 16#8294#, Auto_Generate_Mipmap => 16#8295#, Color_Encoding => 16#8296#, sRGB_Read => 16#8297#, sRGB_Write => 16#8298#, sRGB_Decode_ARB => 16#8299#, Filter => 16#829A#, Vertex_Texture => 16#829B#, Tess_Control_Texture => 16#829C#, Tess_Evaluation_Texture => 16#829D#, Geometry_Texture => 16#829E#, Fragment_Texture => 16#829F#, Compute_Texture => 16#82A0#, Texture_Shadow => 16#82A1#, Texture_Gather => 16#82A2#, Texture_Gather_Shadow => 16#82A3#, Shader_Image_Load => 16#82A4#, Shader_Image_Store => 16#82A5#, Shader_Image_Atomic => 16#82A6#, Image_Texel_Size => 16#82A7#, Image_Compatibility_Class => 16#82A8#, Image_Pixel_Format => 16#82A9#, Image_Pixel_Type => 16#82AA#, Simultaneous_Texture_And_Depth_Test => 16#82AC#, Simultaneous_Texture_And_Stencil_Test => 16#82AD#, Simultaneous_Texture_And_Depth_Write => 16#82AE#, Simultaneous_Texture_And_Stencil_Write => 16#82AF#, Texture_Compressed_Block_Width => 16#82B1#, Texture_Compressed_Block_Height => 16#82B2#, Texture_Compressed_Block_Size => 16#82B3#, Clear_Buffer => 16#82B4#, Texture_View => 16#82B5#, View_Compatibility_Class => 16#82B6#, Texture_Compressed => 16#86A1#, Image_Format_Compatibility_Type => 16#90C7#, Num_Sample_Counts => 16#9380#); for Parameter'Size use Low_Level.Enum'Size; end GL.Enums.Internalformat;
[ { "context": "-- part of OpenGLAda, (c) 2017 Felix Krause\n-- released under the terms of the MIT license, ", "end": 44, "score": 0.9998465776443481, "start": 32, "tag": "NAME", "value": "Felix Krause" } ]
tests/glfw3/glfw_test-windows.adb
Roldak/OpenGLAda
79
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with Glfw.Windows; with Glfw.Monitors; with Glfw.Input.Keys; procedure Glfw_Test.Windows is type My_Window is new Glfw.Windows.Window with null record; overriding procedure Init (Object : not null access My_Window; Width, Height : Glfw.Size; Title : String; Monitor : Glfw.Monitors.Monitor := Glfw.Monitors.No_Monitor; Share : access Glfw.Windows.Window'Class := null); overriding procedure Key_Changed (Object : not null access My_Window; Key : Glfw.Input.Keys.Key; Scancode : Glfw.Input.Keys.Scancode; Action : Glfw.Input.Keys.Action; Mods : Glfw.Input.Keys.Modifiers); procedure Init (Object : not null access My_Window; Width, Height : Glfw.Size; Title : String; Monitor : Glfw.Monitors.Monitor := Glfw.Monitors.No_Monitor; Share : access Glfw.Windows.Window'Class := null) is Upcast : constant Glfw.Windows.Window_Reference := Glfw.Windows.Window (Object.all)'Access; begin Upcast.Init (Width, Height, Title, Monitor, Share); Object.Enable_Callback (Glfw.Windows.Callbacks.Key); end Init; procedure Key_Changed (Object : not null access My_Window; Key : Glfw.Input.Keys.Key; Scancode : Glfw.Input.Keys.Scancode; Action : Glfw.Input.Keys.Action; Mods : Glfw.Input.Keys.Modifiers) is pragma Unreferenced (Scancode); pragma Unreferenced (Action); pragma Unreferenced (Mods); use type Glfw.Input.Keys.Key; begin If Key = Glfw.Input.Keys.Escape then Object.Set_Should_Close (True); end if; end Key_Changed; W1 : aliased Glfw.Windows.Window; W2 : aliased My_Window; begin Glfw.Init; Enable_Print_Errors; W1'Access.Init (640, 480, "Window 1"); W2'Access.Init (640, 480, "Window 2"); while not W2'Access.Should_Close loop Glfw.Input.Wait_For_Events; end loop; Glfw.Shutdown; end Glfw_Test.Windows;
7034
-- part of OpenGLAda, (c) 2017 <NAME> -- released under the terms of the MIT license, see the file "COPYING" with Glfw.Windows; with Glfw.Monitors; with Glfw.Input.Keys; procedure Glfw_Test.Windows is type My_Window is new Glfw.Windows.Window with null record; overriding procedure Init (Object : not null access My_Window; Width, Height : Glfw.Size; Title : String; Monitor : Glfw.Monitors.Monitor := Glfw.Monitors.No_Monitor; Share : access Glfw.Windows.Window'Class := null); overriding procedure Key_Changed (Object : not null access My_Window; Key : Glfw.Input.Keys.Key; Scancode : Glfw.Input.Keys.Scancode; Action : Glfw.Input.Keys.Action; Mods : Glfw.Input.Keys.Modifiers); procedure Init (Object : not null access My_Window; Width, Height : Glfw.Size; Title : String; Monitor : Glfw.Monitors.Monitor := Glfw.Monitors.No_Monitor; Share : access Glfw.Windows.Window'Class := null) is Upcast : constant Glfw.Windows.Window_Reference := Glfw.Windows.Window (Object.all)'Access; begin Upcast.Init (Width, Height, Title, Monitor, Share); Object.Enable_Callback (Glfw.Windows.Callbacks.Key); end Init; procedure Key_Changed (Object : not null access My_Window; Key : Glfw.Input.Keys.Key; Scancode : Glfw.Input.Keys.Scancode; Action : Glfw.Input.Keys.Action; Mods : Glfw.Input.Keys.Modifiers) is pragma Unreferenced (Scancode); pragma Unreferenced (Action); pragma Unreferenced (Mods); use type Glfw.Input.Keys.Key; begin If Key = Glfw.Input.Keys.Escape then Object.Set_Should_Close (True); end if; end Key_Changed; W1 : aliased Glfw.Windows.Window; W2 : aliased My_Window; begin Glfw.Init; Enable_Print_Errors; W1'Access.Init (640, 480, "Window 1"); W2'Access.Init (640, 480, "Window 2"); while not W2'Access.Should_Close loop Glfw.Input.Wait_For_Events; end loop; Glfw.Shutdown; end Glfw_Test.Windows;
true
-- part of OpenGLAda, (c) 2017 PI:NAME:<NAME>END_PI -- released under the terms of the MIT license, see the file "COPYING" with Glfw.Windows; with Glfw.Monitors; with Glfw.Input.Keys; procedure Glfw_Test.Windows is type My_Window is new Glfw.Windows.Window with null record; overriding procedure Init (Object : not null access My_Window; Width, Height : Glfw.Size; Title : String; Monitor : Glfw.Monitors.Monitor := Glfw.Monitors.No_Monitor; Share : access Glfw.Windows.Window'Class := null); overriding procedure Key_Changed (Object : not null access My_Window; Key : Glfw.Input.Keys.Key; Scancode : Glfw.Input.Keys.Scancode; Action : Glfw.Input.Keys.Action; Mods : Glfw.Input.Keys.Modifiers); procedure Init (Object : not null access My_Window; Width, Height : Glfw.Size; Title : String; Monitor : Glfw.Monitors.Monitor := Glfw.Monitors.No_Monitor; Share : access Glfw.Windows.Window'Class := null) is Upcast : constant Glfw.Windows.Window_Reference := Glfw.Windows.Window (Object.all)'Access; begin Upcast.Init (Width, Height, Title, Monitor, Share); Object.Enable_Callback (Glfw.Windows.Callbacks.Key); end Init; procedure Key_Changed (Object : not null access My_Window; Key : Glfw.Input.Keys.Key; Scancode : Glfw.Input.Keys.Scancode; Action : Glfw.Input.Keys.Action; Mods : Glfw.Input.Keys.Modifiers) is pragma Unreferenced (Scancode); pragma Unreferenced (Action); pragma Unreferenced (Mods); use type Glfw.Input.Keys.Key; begin If Key = Glfw.Input.Keys.Escape then Object.Set_Should_Close (True); end if; end Key_Changed; W1 : aliased Glfw.Windows.Window; W2 : aliased My_Window; begin Glfw.Init; Enable_Print_Errors; W1'Access.Init (640, 480, "Window 1"); W2'Access.Init (640, 480, "Window 2"); while not W2'Access.Should_Close loop Glfw.Input.Wait_For_Events; end loop; Glfw.Shutdown; end Glfw_Test.Windows;
[ { "context": "-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifi", "end": 35, "score": 0.9998577237129211, "start": 23, "tag": "NAME", "value": "Maxim Reznik" }, { "context": "-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com>\n--\n-- SPDX-License-Identifier: MIT\n-- License-", "end": 55, "score": 0.9999313950538635, "start": 37, "tag": "EMAIL", "value": "reznikmm@gmail.com" } ]
source/nodes/program-nodes-generic_procedure_declarations.adb
optikos/oasis
0
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Generic_Procedure_Declarations is function Create (Generic_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Formal_Parameters : Program.Element_Vectors.Element_Vector_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Generic_Procedure_Declaration is begin return Result : Generic_Procedure_Declaration := (Generic_Token => Generic_Token, Formal_Parameters => Formal_Parameters, Procedure_Token => Procedure_Token, Name => Name, Left_Bracket_Token => Left_Bracket_Token, Parameters => Parameters, Right_Bracket_Token => Right_Bracket_Token, With_Token => With_Token, Aspects => Aspects, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Formal_Parameters : Program.Element_Vectors.Element_Vector_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Generic_Procedure_Declaration is begin return Result : Implicit_Generic_Procedure_Declaration := (Formal_Parameters => Formal_Parameters, Name => Name, Parameters => Parameters, Aspects => Aspects, 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 Formal_Parameters (Self : Base_Generic_Procedure_Declaration) return Program.Element_Vectors.Element_Vector_Access is begin return Self.Formal_Parameters; end Formal_Parameters; overriding function Name (Self : Base_Generic_Procedure_Declaration) return not null Program.Elements.Defining_Names.Defining_Name_Access is begin return Self.Name; end Name; overriding function Parameters (Self : Base_Generic_Procedure_Declaration) return Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access is begin return Self.Parameters; end Parameters; overriding function Aspects (Self : Base_Generic_Procedure_Declaration) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access is begin return Self.Aspects; end Aspects; overriding function Generic_Token (Self : Generic_Procedure_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Generic_Token; end Generic_Token; overriding function Procedure_Token (Self : Generic_Procedure_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Procedure_Token; end Procedure_Token; overriding function Left_Bracket_Token (Self : Generic_Procedure_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Left_Bracket_Token; end Left_Bracket_Token; overriding function Right_Bracket_Token (Self : Generic_Procedure_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Right_Bracket_Token; end Right_Bracket_Token; overriding function With_Token (Self : Generic_Procedure_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.With_Token; end With_Token; overriding function Semicolon_Token (Self : Generic_Procedure_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Generic_Procedure_Declaration) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Generic_Procedure_Declaration) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Generic_Procedure_Declaration) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Generic_Procedure_Declaration'Class) is begin for Item in Self.Formal_Parameters.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; Set_Enclosing_Element (Self.Name, Self'Unchecked_Access); for Item in Self.Parameters.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; for Item in Self.Aspects.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Generic_Procedure_Declaration_Element (Self : Base_Generic_Procedure_Declaration) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Generic_Procedure_Declaration_Element; overriding function Is_Declaration_Element (Self : Base_Generic_Procedure_Declaration) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Declaration_Element; overriding procedure Visit (Self : not null access Base_Generic_Procedure_Declaration; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Generic_Procedure_Declaration (Self); end Visit; overriding function To_Generic_Procedure_Declaration_Text (Self : aliased in out Generic_Procedure_Declaration) return Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Text_Access is begin return Self'Unchecked_Access; end To_Generic_Procedure_Declaration_Text; overriding function To_Generic_Procedure_Declaration_Text (Self : aliased in out Implicit_Generic_Procedure_Declaration) return Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Text_Access is pragma Unreferenced (Self); begin return null; end To_Generic_Procedure_Declaration_Text; end Program.Nodes.Generic_Procedure_Declarations;
1821
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Generic_Procedure_Declarations is function Create (Generic_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Formal_Parameters : Program.Element_Vectors.Element_Vector_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Generic_Procedure_Declaration is begin return Result : Generic_Procedure_Declaration := (Generic_Token => Generic_Token, Formal_Parameters => Formal_Parameters, Procedure_Token => Procedure_Token, Name => Name, Left_Bracket_Token => Left_Bracket_Token, Parameters => Parameters, Right_Bracket_Token => Right_Bracket_Token, With_Token => With_Token, Aspects => Aspects, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Formal_Parameters : Program.Element_Vectors.Element_Vector_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Generic_Procedure_Declaration is begin return Result : Implicit_Generic_Procedure_Declaration := (Formal_Parameters => Formal_Parameters, Name => Name, Parameters => Parameters, Aspects => Aspects, 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 Formal_Parameters (Self : Base_Generic_Procedure_Declaration) return Program.Element_Vectors.Element_Vector_Access is begin return Self.Formal_Parameters; end Formal_Parameters; overriding function Name (Self : Base_Generic_Procedure_Declaration) return not null Program.Elements.Defining_Names.Defining_Name_Access is begin return Self.Name; end Name; overriding function Parameters (Self : Base_Generic_Procedure_Declaration) return Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access is begin return Self.Parameters; end Parameters; overriding function Aspects (Self : Base_Generic_Procedure_Declaration) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access is begin return Self.Aspects; end Aspects; overriding function Generic_Token (Self : Generic_Procedure_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Generic_Token; end Generic_Token; overriding function Procedure_Token (Self : Generic_Procedure_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Procedure_Token; end Procedure_Token; overriding function Left_Bracket_Token (Self : Generic_Procedure_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Left_Bracket_Token; end Left_Bracket_Token; overriding function Right_Bracket_Token (Self : Generic_Procedure_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Right_Bracket_Token; end Right_Bracket_Token; overriding function With_Token (Self : Generic_Procedure_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.With_Token; end With_Token; overriding function Semicolon_Token (Self : Generic_Procedure_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Generic_Procedure_Declaration) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Generic_Procedure_Declaration) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Generic_Procedure_Declaration) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Generic_Procedure_Declaration'Class) is begin for Item in Self.Formal_Parameters.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; Set_Enclosing_Element (Self.Name, Self'Unchecked_Access); for Item in Self.Parameters.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; for Item in Self.Aspects.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Generic_Procedure_Declaration_Element (Self : Base_Generic_Procedure_Declaration) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Generic_Procedure_Declaration_Element; overriding function Is_Declaration_Element (Self : Base_Generic_Procedure_Declaration) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Declaration_Element; overriding procedure Visit (Self : not null access Base_Generic_Procedure_Declaration; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Generic_Procedure_Declaration (Self); end Visit; overriding function To_Generic_Procedure_Declaration_Text (Self : aliased in out Generic_Procedure_Declaration) return Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Text_Access is begin return Self'Unchecked_Access; end To_Generic_Procedure_Declaration_Text; overriding function To_Generic_Procedure_Declaration_Text (Self : aliased in out Implicit_Generic_Procedure_Declaration) return Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Text_Access is pragma Unreferenced (Self); begin return null; end To_Generic_Procedure_Declaration_Text; end Program.Nodes.Generic_Procedure_Declarations;
true
-- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Generic_Procedure_Declarations is function Create (Generic_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Formal_Parameters : Program.Element_Vectors.Element_Vector_Access; Procedure_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Generic_Procedure_Declaration is begin return Result : Generic_Procedure_Declaration := (Generic_Token => Generic_Token, Formal_Parameters => Formal_Parameters, Procedure_Token => Procedure_Token, Name => Name, Left_Bracket_Token => Left_Bracket_Token, Parameters => Parameters, Right_Bracket_Token => Right_Bracket_Token, With_Token => With_Token, Aspects => Aspects, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Formal_Parameters : Program.Element_Vectors.Element_Vector_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Parameters : Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Generic_Procedure_Declaration is begin return Result : Implicit_Generic_Procedure_Declaration := (Formal_Parameters => Formal_Parameters, Name => Name, Parameters => Parameters, Aspects => Aspects, 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 Formal_Parameters (Self : Base_Generic_Procedure_Declaration) return Program.Element_Vectors.Element_Vector_Access is begin return Self.Formal_Parameters; end Formal_Parameters; overriding function Name (Self : Base_Generic_Procedure_Declaration) return not null Program.Elements.Defining_Names.Defining_Name_Access is begin return Self.Name; end Name; overriding function Parameters (Self : Base_Generic_Procedure_Declaration) return Program.Elements.Parameter_Specifications .Parameter_Specification_Vector_Access is begin return Self.Parameters; end Parameters; overriding function Aspects (Self : Base_Generic_Procedure_Declaration) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access is begin return Self.Aspects; end Aspects; overriding function Generic_Token (Self : Generic_Procedure_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Generic_Token; end Generic_Token; overriding function Procedure_Token (Self : Generic_Procedure_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Procedure_Token; end Procedure_Token; overriding function Left_Bracket_Token (Self : Generic_Procedure_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Left_Bracket_Token; end Left_Bracket_Token; overriding function Right_Bracket_Token (Self : Generic_Procedure_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Right_Bracket_Token; end Right_Bracket_Token; overriding function With_Token (Self : Generic_Procedure_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.With_Token; end With_Token; overriding function Semicolon_Token (Self : Generic_Procedure_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Semicolon_Token; end Semicolon_Token; overriding function Is_Part_Of_Implicit (Self : Implicit_Generic_Procedure_Declaration) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Generic_Procedure_Declaration) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Generic_Procedure_Declaration) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Generic_Procedure_Declaration'Class) is begin for Item in Self.Formal_Parameters.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; Set_Enclosing_Element (Self.Name, Self'Unchecked_Access); for Item in Self.Parameters.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; for Item in Self.Aspects.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Generic_Procedure_Declaration_Element (Self : Base_Generic_Procedure_Declaration) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Generic_Procedure_Declaration_Element; overriding function Is_Declaration_Element (Self : Base_Generic_Procedure_Declaration) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Declaration_Element; overriding procedure Visit (Self : not null access Base_Generic_Procedure_Declaration; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Generic_Procedure_Declaration (Self); end Visit; overriding function To_Generic_Procedure_Declaration_Text (Self : aliased in out Generic_Procedure_Declaration) return Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Text_Access is begin return Self'Unchecked_Access; end To_Generic_Procedure_Declaration_Text; overriding function To_Generic_Procedure_Declaration_Text (Self : aliased in out Implicit_Generic_Procedure_Declaration) return Program.Elements.Generic_Procedure_Declarations .Generic_Procedure_Declaration_Text_Access is pragma Unreferenced (Self); begin return null; end To_Generic_Procedure_Declaration_Text; end Program.Nodes.Generic_Procedure_Declarations;
[ { "context": "-- Copyright 2018-2021 Bartek thindil Jasicki\n--\n-- This file is part of Steam Sky.\n--\n-- ", "end": 48, "score": 0.9998537302017212, "start": 26, "tag": "NAME", "value": "Bartek thindil Jasicki" } ]
src/careers.ads
thindil/steamsky
80
-- Copyright 2018-2021 Bartek thindil Jasicki -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. with Ada.Containers.Hashed_Maps; use Ada.Containers; with Ada.Strings.Unbounded.Hash; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with DOM.Readers; use DOM.Readers; with Game; use Game; -- ****h* Careers/Careers -- FUNCTION -- Provide code for characters careers -- SOURCE package Careers is -- **** -- ****s* Careers/Careers.Career_Record -- FUNCTION -- Data structure for player career -- PARAMETERS -- Name - Name of career, displayed to player -- Skills - List of skills which have bonuses to experience if player -- select this career -- SOURCE type Career_Record is record Name: Unbounded_String; Skills: UnboundedString_Container.Vector; end record; -- **** -- ****t* Careers/Careers.Careers_Container -- FUNCTION -- Used to store all available careers -- SOURCE package Careers_Container is new Hashed_Maps (Key_Type => Unbounded_String, Element_Type => Career_Record, Hash => Ada.Strings.Unbounded.Hash, Equivalent_Keys => "="); -- **** -- ****v* Careers/Careers.Careers_List -- FUNCTION -- List of all available careers for player -- SOURCE Careers_List: Careers_Container.Map; -- **** -- ****f* Careers/Careers.Load_Careers -- FUNCTION -- Load player careers from file -- PARAMETERS -- Reader - XML Reader from which careers will be read -- SOURCE procedure Load_Careers(Reader: Tree_Reader); -- **** end Careers;
3697
-- Copyright 2018-2021 <NAME> -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. with Ada.Containers.Hashed_Maps; use Ada.Containers; with Ada.Strings.Unbounded.Hash; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with DOM.Readers; use DOM.Readers; with Game; use Game; -- ****h* Careers/Careers -- FUNCTION -- Provide code for characters careers -- SOURCE package Careers is -- **** -- ****s* Careers/Careers.Career_Record -- FUNCTION -- Data structure for player career -- PARAMETERS -- Name - Name of career, displayed to player -- Skills - List of skills which have bonuses to experience if player -- select this career -- SOURCE type Career_Record is record Name: Unbounded_String; Skills: UnboundedString_Container.Vector; end record; -- **** -- ****t* Careers/Careers.Careers_Container -- FUNCTION -- Used to store all available careers -- SOURCE package Careers_Container is new Hashed_Maps (Key_Type => Unbounded_String, Element_Type => Career_Record, Hash => Ada.Strings.Unbounded.Hash, Equivalent_Keys => "="); -- **** -- ****v* Careers/Careers.Careers_List -- FUNCTION -- List of all available careers for player -- SOURCE Careers_List: Careers_Container.Map; -- **** -- ****f* Careers/Careers.Load_Careers -- FUNCTION -- Load player careers from file -- PARAMETERS -- Reader - XML Reader from which careers will be read -- SOURCE procedure Load_Careers(Reader: Tree_Reader); -- **** end Careers;
true
-- Copyright 2018-2021 PI:NAME:<NAME>END_PI -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. with Ada.Containers.Hashed_Maps; use Ada.Containers; with Ada.Strings.Unbounded.Hash; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with DOM.Readers; use DOM.Readers; with Game; use Game; -- ****h* Careers/Careers -- FUNCTION -- Provide code for characters careers -- SOURCE package Careers is -- **** -- ****s* Careers/Careers.Career_Record -- FUNCTION -- Data structure for player career -- PARAMETERS -- Name - Name of career, displayed to player -- Skills - List of skills which have bonuses to experience if player -- select this career -- SOURCE type Career_Record is record Name: Unbounded_String; Skills: UnboundedString_Container.Vector; end record; -- **** -- ****t* Careers/Careers.Careers_Container -- FUNCTION -- Used to store all available careers -- SOURCE package Careers_Container is new Hashed_Maps (Key_Type => Unbounded_String, Element_Type => Career_Record, Hash => Ada.Strings.Unbounded.Hash, Equivalent_Keys => "="); -- **** -- ****v* Careers/Careers.Careers_List -- FUNCTION -- List of all available careers for player -- SOURCE Careers_List: Careers_Container.Map; -- **** -- ****f* Careers/Careers.Load_Careers -- FUNCTION -- Load player careers from file -- PARAMETERS -- Reader - XML Reader from which careers will be read -- SOURCE procedure Load_Careers(Reader: Tree_Reader); -- **** end Careers;