repo_name
stringlengths
9
74
language
stringclasses
1 value
length_bytes
int64
11
9.34M
extension
stringclasses
2 values
content
stringlengths
11
9.34M
Fabien-Chouteau/pygamer-simulator
Ada
4,599
adb
with Ada.Real_Time; use Ada.Real_Time; with Ada.Real_Time.Timing_Events; use Ada.Real_Time.Timing_Events; with Ada.Text_IO; package body PyGamer.Time is use type Ada.Real_Time.Time; use type Ada.Real_Time.Time_Span; Period_Ms : constant := 100; Event_Period : constant Time_Span := Milliseconds (Period_Ms); Subscribers : array (1 .. 10) of Tick_Callback := (others => null); Event : Ada.Real_Time.Timing_Events.Timing_Event; Start_Time : Ada.Real_Time.Time; procedure Initialize; protected Events is procedure Handler (Event : in out Timing_Event); function Clock return Time_Ms; private Clock_Ms : Time_Ms := 0 with Volatile; end Events; ------------ -- Events -- ------------ protected body Events is ------------- -- Handler -- ------------- procedure Handler (Event : in out Timing_Event) is begin Clock_Ms := Clock_Ms + Period_Ms; for Subs of Subscribers loop if Subs /= null then -- Call the subscriber Subs.all; end if; end loop; -- Re-trigger Set_Handler (Event, Event_Period, Events.Handler'Access); end Handler; ----------- -- Clock -- ----------- function Clock return Time_Ms is begin return Clock_Ms; end Clock; end Events; ---------------- -- Initialize -- ---------------- procedure Initialize is begin Start_Time := Ada.Real_Time.Clock; Set_Handler (Event, Event_Period, Events.Handler'Access); end Initialize; ----------- -- Clock -- ----------- function Clock return Time_Ms is (Time_Ms (To_Duration (Ada.Real_Time.Clock - Start_Time) * 1000.0)); -------------- -- Delay_Ms -- -------------- procedure Delay_Ms (Milliseconds : UInt64) is begin Delay_Until (Clock + Milliseconds); end Delay_Ms; ----------------- -- Delay_Until -- ----------------- procedure Delay_Until (Wakeup_Time : Time_Ms) is begin delay until Start_Time + Milliseconds (Integer (Wakeup_Time)); end Delay_Until; ----------------- -- Tick_Period -- ----------------- function Tick_Period return Time_Ms is begin return Period_Ms; end Tick_Period; --------------------- -- Tick_Subscriber -- --------------------- function Tick_Subscriber (Callback : not null Tick_Callback) return Boolean is begin for Subs of Subscribers loop if Subs = Callback then return True; end if; end loop; return False; end Tick_Subscriber; -------------------- -- Tick_Subscribe -- -------------------- function Tick_Subscribe (Callback : not null Tick_Callback) return Boolean is begin for Subs of Subscribers loop if Subs = null then Subs := Callback; return True; end if; end loop; return False; end Tick_Subscribe; ---------------------- -- Tick_Unsubscribe -- ---------------------- function Tick_Unsubscribe (Callback : not null Tick_Callback) return Boolean is begin for Subs of Subscribers loop if Subs = Callback then Subs := null; return True; end if; end loop; return False; end Tick_Unsubscribe; --------------- -- HAL_Delay -- --------------- Delay_Instance : aliased PG_Delays; function HAL_Delay return not null HAL.Time.Any_Delays is begin return Delay_Instance'Access; end HAL_Delay; ------------------------ -- Delay_Microseconds -- ------------------------ overriding procedure Delay_Microseconds (This : in out PG_Delays; Us : Integer) is pragma Unreferenced (This); begin Delay_Ms (UInt64 (Us / 1000)); end Delay_Microseconds; ------------------------ -- Delay_Milliseconds -- ------------------------ overriding procedure Delay_Milliseconds (This : in out PG_Delays; Ms : Integer) is pragma Unreferenced (This); begin Delay_Ms (UInt64 (Ms)); end Delay_Milliseconds; ------------------- -- Delay_Seconds -- ------------------- overriding procedure Delay_Seconds (This : in out PG_Delays; S : Integer) is pragma Unreferenced (This); begin Delay_Ms (UInt64 (S * 1000)); end Delay_Seconds; begin Initialize; end PyGamer.Time;
reznikmm/matreshka
Ada
3,749
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Chart_Display_R_Square_Attributes is pragma Preelaborate; type ODF_Chart_Display_R_Square_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Chart_Display_R_Square_Attribute_Access is access all ODF_Chart_Display_R_Square_Attribute'Class with Storage_Size => 0; end ODF.DOM.Chart_Display_R_Square_Attributes;
reznikmm/matreshka
Ada
3,659
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Elements; package ODF.DOM.Text_Subject_Elements is pragma Preelaborate; type ODF_Text_Subject is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Text_Subject_Access is access all ODF_Text_Subject'Class with Storage_Size => 0; end ODF.DOM.Text_Subject_Elements;
sungyeon/drake
Ada
985
adb
with Ada.Containers; with Ada.Strings.Hash; with Ada.Strings.Wide_Hash; with Ada.Strings.Wide_Wide_Hash; procedure hash is use type Ada.Containers.Hash_Type; type HA is array (Positive range <>) of Ada.Containers.Hash_Type; D : HA := ( Ada.Strings.Hash ("abcdefg"), Ada.Strings.Hash ("ab"), Ada.Strings.Hash ("ba"), Ada.Strings.Hash ("----------"), Ada.Strings.Hash ("-----------"), Ada.Strings.Hash ("------------")); begin for I in D'First .. D'Last - 1 loop for J in I + 1 .. D'Last loop pragma Assert (D (I) /= D (J)); null; end loop; end loop; -- Hash = Wide_Hash = Wide_Wide_Hash pragma Assert (Ada.Strings.Hash ("Hash") = Ada.Strings.Wide_Hash ("Hash")); pragma Assert (Ada.Strings.Hash ("Hash") = Ada.Strings.Wide_Wide_Hash ("Hash")); -- the hash algorithm is MurmurHash3 (seed = 0) pragma Assert (Ada.Strings.Hash ("") = 0); pragma Assert (Ada.Strings.Hash ("a") = 16#56c1cbd1#); -- 61 00 00 00 pragma Debug (Ada.Debug.Put ("OK")); end hash;
reznikmm/matreshka
Ada
3,724
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Style_Join_Border_Attributes is pragma Preelaborate; type ODF_Style_Join_Border_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Style_Join_Border_Attribute_Access is access all ODF_Style_Join_Border_Attribute'Class with Storage_Size => 0; end ODF.DOM.Style_Join_Border_Attributes;
stcarrez/ada-lzma
Ada
1,368
ads
----------------------------------------------------------------------- -- lzma - LZMA package -- The MIT License (MIT) -- -- Copyright (c) 2015 Stephane Carrez -- -- 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. ----------------------------------------------------------------------- package Lzma is pragma Pure; end Lzma;
reznikmm/matreshka
Ada
3,549
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with League.Strings; with ODF.DOM.Packages; package ODF.Packages is function Load (File_Name : League.Strings.Universal_String) return ODF.DOM.Packages.ODF_Package_Access; end ODF.Packages;
onox/orka
Ada
1,040
ads
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2021 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package Orka.SIMD.AVX2.Integers.Compare is pragma Pure; function "=" (Left, Right : m256i) return m256i with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_pcmpeqd256"; function ">" (Left, Right : m256i) return m256i with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_pcmpgtd256"; end Orka.SIMD.AVX2.Integers.Compare;
docandrew/troodon
Ada
1,772
ads
pragma Ada_2012; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; package bits_cpu_set_h is -- Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993 -- scheduling interface. -- Copyright (C) 1996-2021 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- <https://www.gnu.org/licenses/>. -- Size definition for CPU sets. -- Type for array elements in 'cpu_set_t'. subtype uu_cpu_mask is unsigned_long; -- /usr/include/bits/cpu-set.h:32 -- Basic access functions. -- Data structure to describe CPU mask. -- skipped anonymous struct anon_16 type cpu_set_t_array1085 is array (0 .. 15) of aliased uu_cpu_mask; type cpu_set_t is record uu_bits : aliased cpu_set_t_array1085; -- /usr/include/bits/cpu-set.h:41 end record with Convention => C_Pass_By_Copy; -- /usr/include/bits/cpu-set.h:42 -- Access functions for CPU masks. -- skipped func __sched_cpucount -- skipped func __sched_cpualloc -- skipped func __sched_cpufree end bits_cpu_set_h;
KipodAfterFree/KAF-2019-FireHog
Ada
3,043
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- tour -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998 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 <[email protected]> 1996 -- Version Control -- $Revision: 1.5 $ -- Binding Version 00.93 ------------------------------------------------------------------------------ with Sample; use Sample; procedure Tour is begin Whow; end Tour;
AdaCore/training_material
Ada
2,252
ads
----------------------------------------------------------------------- -- Ada Labs -- -- -- -- Copyright (C) 2008-2009, AdaCore -- -- -- -- Labs is free software; you can redistribute it and/or modify it -- -- under the terms of the GNU General Public License as published by -- -- the Free Software Foundation; either version 2 of the License, or -- -- (at your option) any later version. -- -- -- -- This program is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. You should have received -- -- a copy of the GNU General Public License along with this program; -- -- if not, write to the Free Software Foundation, Inc., 59 Temple -- -- Place - Suite 330, Boston, MA 02111-1307, USA. -- ----------------------------------------------------------------------- with Display; use Display; with Display.Basic; use Display.Basic; package Solar_System is -- define type Bodies_Enum_T as an enumeration of Sun, Earth, Moon, Satellite type Bodies_Enum_T is (Sun, Earth, Moon, Satellite, Comet, Black_Hole, Asteroid_1, Asteroid_2); -- define a type Body_T to store every information about a body -- X, Y, Distance, Speed, Angle, Color, Radius type Body_T is record X : Float := 0.0; Y : Float := 0.0; Distance : Float; Speed : Float; Angle : Float; Color : RGBA_T; Radius : Float; Turns_Around : Bodies_Enum_T; Visible : Boolean := True; end record; -- define type Bodies_Array_T as an array of Body_T indexed by bodies enumeration type Bodies_Array_T is array (Bodies_Enum_T) of Body_T; procedure Move_All (Bodies : in out Bodies_Array_T); end Solar_System;
docandrew/troodon
Ada
41,580
adb
with Ada.Containers.Doubly_Linked_Lists; with Ada.Text_IO; with Ada.Unchecked_Conversion; with Ada.Unchecked_Deallocation; with Interfaces.C; use Interfaces.C; with System; with GL; with GLext; with GLX; with GLXext; with X11; with XLib; with xcb; use xcb; with xcb_xfixes; with xcb_shape; with xproto; use xproto; with xcb_composite; with Desktop; with Render; with Render.Shaders; with Render.Util; with Setup; with Util; package body Compositor is type OverlayReplyPtr is access all xcb_composite.xcb_composite_get_overlay_window_reply_t; -- Overlay window returned from composite extension. We'll actually draw to -- the sceneWindow, which is a child of this overlay. overlayWindow : xproto.xcb_window_t; -- If supported, the GLX_EXT_texture_from_pixmap extension should be a -- faster way to get the XComposite off-screen buffer into a texture that -- we can render. fastTexFromPixmap : Boolean := False; glXBindTexImageEXT : GLXext.PFNGLXBINDTEXIMAGEEXTPROC; glXReleaseTexImageEXT : GLXext.PFNGLXRELEASETEXIMAGEEXTPROC; -- If supported, the glXSwapInterval function can be used to provide vsync -- for less screen tearing. glxVSync : Boolean := False; glXSwapIntervalEXT : GLXext.PFNGLXSWAPINTERVALEXTPROC; --------------------------------------------------------------------------- -- Keep a list of all the windows so we can re-draw them in stacking order. -- As a window is focused, we remove it and re-append it to the end of this -- list. (bottom = first, top = last). -- -- This can be thought of as a sort of primitive scene graph. --------------------------------------------------------------------------- package WindowStack is new Ada.Containers.Doubly_Linked_Lists (Element_Type => xproto.xcb_window_t); winStack : WindowStack.List; --------------------------------------------------------------------------- -- addWindow --------------------------------------------------------------------------- procedure addWindow (win : xproto.xcb_window_t) is use WindowStack; begin winStack.append (win); end addWindow; --------------------------------------------------------------------------- -- deleteWindow --------------------------------------------------------------------------- procedure deleteWindow (win : xproto.xcb_window_t) is use WindowStack; C : Cursor := winStack.find (win); begin if C /= No_Element then winStack.delete (C); else raise CompositorException with "Attempted to delete non-existent window from render stack"; end if; end deleteWindow; --------------------------------------------------------------------------- -- bringToTop -- It's not necessarily an error to call this with a window not in the -- list. --------------------------------------------------------------------------- procedure bringToTop (win : xproto.xcb_window_t) is use WindowStack; begin deleteWindow (win); winStack.append (win); exception when CompositorException => raise CompositorException with "Attempted to bring non-existent window to top of render stack"; end bringToTop; --------------------------------------------------------------------------- -- createGLScene -- Given a overlay window from the X Composite extension and the OpenGL -- Renderer, create a GLX window that we can composite images to. -- -- @TODO some overlap here between this and Frames.createOpenGLSurface, -- could probably avoid some repetition. --------------------------------------------------------------------------- procedure createGLScene (c : access xcb_connection_t; rend : Render.Renderer; sceneWin : xproto.xcb_window_t) is glxWindow : GLX.GLXWindow; glxRet : int; begin glxWindow := GLX.glXCreateWindow (dpy => rend.display, config => rend.fbConfig, win => Interfaces.C.unsigned_long(sceneWin), attribList => null); if glxWindow = 0 then raise CompositorException with "Troodon: (compositor) Failed to create OpenGL overlay window"; end if; Compositor.sceneDrawable := GLX.GLXDrawable (glxWindow); glxRet := GLX.glXMakeContextCurrent (dpy => rend.display, draw => Compositor.sceneDrawable, read => Compositor.sceneDrawable, ctx => rend.context); if glxRet = 0 then raise CompositorException with "Troodon: (compositor) Failed to make GLX context current."; end if; end createGLScene; --------------------------------------------------------------------------- -- allowInputPassthrough -- Tell the overlay window not to receive events using a (well-known?) -- XFixes technique. I'm not sure the origin of this technique, but I most -- assuredly did not invent it. -- -- Essentially, we create a XFixes region with an empty shape, and set that -- as the input region for the overlay window, essentially making it an -- "output only" window. -- -- @TODO when using checked versions of these functions, we seem to always -- get an error code. Notably, Qt does not check for errors on these. --------------------------------------------------------------------------- procedure allowInputPassthrough (c : access xcb.xcb_connection_t; win : xproto.xcb_window_t) is use xcb; use xproto; use xcb_xfixes; use xcb_shape; -- rect : aliased xcb_rectangle_t := (x => 0, y => 0, width => 0, height => 0); region : xcb_xfixes_region_t; regionInput : xcb_shape_kind_t := xcb_shape_kind_t(xcb_shape_sk_t'Pos(XCB_SHAPE_SK_INPUT)); cookie : xcb_void_cookie_t; error : access xcb_generic_error_t; begin -- Create the region region := xcb_xfixes_region_t(xcb_generate_id (c)); cookie := xcb_xfixes_create_region_checked (c => c, region => region, rectangles_len => 0, rectangles => null); error := xcb_request_check (c, cookie); if error /= null then raise CompositorException with "Troodon: (compositor) Failed to create input pass-through region for overlay window, error:" & error.error_code'Image & " response type:" & error.response_type'Image & " major:" & error.major_code'Image & " minor:" & error.minor_code'Image & " resource:" & error.resource_id'Image & " sequence:" & error.sequence'Image; end if; -- Set the window input shape Ada.Text_IO.Put_Line ("Troodon: (compositor) Setting window shape region"); cookie := xcb_xfixes_set_window_shape_region_checked (c => c, dest => win, dest_kind => regionInput, x_offset => 0, y_offset => 0, region => region); error := xcb_request_check (c, cookie); if error /= null then raise CompositorException with "Troodon: (compositor) Failed to set input shape region on overlay window, error:" & error.error_code'Image; end if; -- Destroy the region cookie := xcb_xfixes_destroy_region_checked (c, region); error := xcb_request_check (c, cookie); if error /= null then raise CompositorException with "Troodon: (compositor) Failed to destroy input shape region, error:" & error.error_code'Image; end if; end allowInputPassthrough; --------------------------------------------------------------------------- -- start -- Check for the X Composite extension and, if available, request an -- overlay window from the X server. --------------------------------------------------------------------------- procedure start (c : access xcb_connection_t; rend : Render.Renderer; mode : CompositeMode) is use GLXext; use xcb; use xproto; use xcb_composite; use Render; cookie : xcb_void_cookie_t; error : access xcb_generic_error_t; root : xcb_window_t := Setup.getRootWindow (c); updateMode : Interfaces.C.unsigned_char; cookieOvly : xcb_composite_get_overlay_window_cookie_t; replyOvly : OverlayReplyPtr; geomOvly : xcb_get_geometry_reply_t; sceneWin : xcb_window_t; sceneAttr : aliased xcb_create_window_value_list_t; sceneMask : Interfaces.C.unsigned; -- Procedure name in C format for glxGetProcAddress procName1 : Interfaces.C.char_array := Interfaces.C.To_C ("glXBindTexImageEXT"); procName2 : Interfaces.C.char_array := Interfaces.C.To_C ("glXReleaseTexImageEXT"); procName3 : Interfaces.C.char_array := Interfaces.C.To_C ("glXSwapIntervalEXT"); procedure free is new Ada.Unchecked_Deallocation (Object => xcb_composite_get_overlay_window_reply_t, Name => OverlayReplyPtr); function toBindProc is new Ada.Unchecked_Conversion (Source => GLX.uu_GLXextFuncPtr, Target => GLXext.PFNGLXBINDTEXIMAGEEXTPROC); function toReleaseProc is new Ada.Unchecked_Conversion (Source => GLX.uu_GLXextFuncPtr, Target => GLXext.PFNGLXRELEASETEXIMAGEEXTPROC); function toSyncProc is new Ada.Unchecked_Conversion (Source => GLX.uu_GLXextFuncPtr, Target => GLXext.PFNGLXSWAPINTERVALEXTPROC); begin -- @TODO probably want to grab server before doing this or do this in Setup while -- we have it grabbed. -- If we don't have an OpenGL renderer, just let the server do basic compositing. if rend.kind = Render.OPENGL and mode = MANUAL then Ada.Text_IO.Put_Line ("Troodon: (compositor) Using manual redirection w/ OpenGL"); updateMode := xcb_composite_redirect_t'Pos(XCB_COMPOSITE_REDIRECT_MANUAL); else Ada.Text_IO.Put_Line ("Troodon: (Compositor) Using automatic redirection"); updateMode := xcb_composite_redirect_t'Pos(XCB_COMPOSITE_REDIRECT_AUTOMATIC); end if; -- Instruct the X Server to redirect all window output to off-screen buffers. cookie := xcb_composite_redirect_subwindows_checked (c => c, window => root, update => updateMode); error := xcb_request_check (c, cookie); if error /= null then Ada.Text_IO.Put_Line ("Troodon: (Compositor) Error redirecting subwindows:" & error.error_code'Image); raise CompositorException with "Failed to redirect subwindows"; end if; if rend.kind = Render.OpenGL and mode = MANUAL then cookieOvly := xcb_composite_get_overlay_window (c, root); replyOvly := xcb_composite_get_overlay_window_reply (c, cookieOvly, error'Address); if error /= null then Ada.Text_IO.Put_Line ("Troodon: (Compositor) Error getting overlay window:" & error.error_code'Image); end if; Ada.Text_IO.Put_Line ("Troodon: (Compositor) Received overlay window:" & replyOvly.overlay_win'Image); overlayWindow := replyOvly.overlay_win; Ada.Text_IO.Put_Line ("Troodon: (Compositor) Creating scene window"); geomOvly := Util.getWindowGeometry (c, replyOvly.overlay_win); -- Experiment -- Now, we create our own window with the overlay as it's parent but 32-bit color. sceneWin := xcb_generate_id(c); sceneAttr.background_pixel := 0; sceneAttr.border_pixel := 0; sceneAttr.colormap := rend.colormap; -- colormap sceneAttr.event_mask := XCB_EVENT_MASK_EXPOSURE; sceneMask := XCB_CW_BACK_PIXEL or XCB_CW_BORDER_PIXEL or XCB_CW_COLORMAP or XCB_CW_EVENT_MASK; -- Create scene window. We'll render everything to this. cookie := xcb_create_window_aux_checked (c => c, depth => 32, wid => sceneWin, parent => overlayWindow, x => 0, y => 0, width => geomOvly.width, height => geomOvly.height, border_width => 0, u_class => xcb_window_class_t'Pos (XCB_WINDOW_CLASS_INPUT_OUTPUT), visual => rend.visualID, value_mask => sceneMask, value_list => sceneAttr'Access); error := xcb_request_check (c, cookie); Ada.Text_IO.Put_Line ("Troodon: (Compositor) Created scene window:" & sceneWin'Image); if error /= null then raise CompositorException with "Troodon: (Compositor) Failed to create scene window, error:" & error.error_code'Image; end if; createGLScene (c, rend, sceneWin); -- Set the package globals here. Compositor.sceneWindow := sceneWin; -- Compositor.sceneDrawable := GLX.GLXDrawable(sceneWin); cookie := xcb_map_window_checked (c, sceneWin); error := xcb_request_check (c, cookie); if error /= null then raise CompositorException with "Troodon: (Compositor) Failed to map scene window, error code:" & error.error_code'Image; end if; -- Set overlay as pass-through. If we're using server-side compositing we don't -- need to do this. allowInputPassthrough (c, overlayWindow); allowInputPassthrough (c, sceneWin); free (replyOvly); -- Attempt to get GLX_EXT_texture_from_pixmap extension. -- @TODO consider checking for availability before going through all this work. glXBindTexImageEXT := toBindProc (GLX.glXGetProcAddress (procName1(0)'Access)); glXReleaseTexImageEXT := toReleaseProc (GLX.glXGetProcAddress (procName2(0)'Access)); if glXBindTexImageEXT = null or glXReleaseTexImageEXT = null then raise CompositorException with "Failed to get glXBindTexImageEXT procedure"; end if; -- Attempt to get glXSwapInterval extension glXSwapIntervalEXT := toSyncProc (GLX.glXGetProcAddress (procName3(0)'Access)); if glXSwapIntervalEXT /= null then null; --Ada.Text_IO.Put_Line ("Troodon: (compositor) Using glXSwapIntervalEXT extension"); --@TODO this doesn't seem to play nice with Xephyr, and gives screen tearing -- anyhow. --glxVSync := True; --glXSwapIntervalEXT (rend.display, overlayDrawable, 1); end if; end if; end start; --------------------------------------------------------------------------- -- stop --------------------------------------------------------------------------- procedure stop (c : access xcb_connection_t; rend : Render.Renderer; mode : Compositor.CompositeMode) is use xcb_composite; cookie : xcb_void_cookie_t; error : access xcb_generic_error_t; root : xcb_window_t := Setup.getRootWindow (c); updateMode : Interfaces.C.unsigned_char := (if mode = MANUAL then xcb_composite_redirect_t'Pos(XCB_COMPOSITE_REDIRECT_MANUAL) else xcb_composite_redirect_t'Pos(XCB_COMPOSITE_REDIRECT_AUTOMATIC)); begin Ada.Text_IO.Put_Line ("Troodon: (Compositor) Shutting down."); GLX.glXDestroyWindow (rend.display, GLX.GLXWindow(sceneDrawable)); cookie := xcb_destroy_window_checked (c, Compositor.sceneWindow); error := xcb_request_check (c, cookie); if error /= null then Ada.Text_IO.Put_Line ("Troodon: (Compositor) Unable to delete the compositor scene window, error:" & error.error_code'Image); end if; cookie := xcb_composite_release_overlay_window_checked (c, overlayWindow); error := xcb_request_check (c, cookie); if error /= null then Ada.Text_IO.Put_Line ("Troodon: (Compositor) Unable to release overlay window, error:" & error.error_code'Image); end if; cookie := xcb_composite_unredirect_subwindows_checked (c, root, updateMode); error := xcb_request_check (c, cookie); if error /= null then Ada.Text_IO.Put_Line ("Troodon: (Compositor) Unable to un-redirect subwindows, error:" & error.error_code'Image); end if; Ada.Text_IO.Put_Line ("Troodon: (Compositor) Stopped."); end stop; --------------------------------------------------------------------------- -- drawShadow -- draw drop shadow for a window --------------------------------------------------------------------------- procedure drawShadow (c : access xcb.xcb_connection_t; rend : Render.Renderer; window : xcb_window_t) is -- identify the corners of all our windows. geomWin : xcb_get_geometry_reply_t; shadowX : Float; shadowY : Float; shadowW : Float; shadowH : Float; -- By changing these values the drop shadow can move to different positions. -- Could use negative values here for a glow effect offsetX1 : Float := 10.0; offsetY1 : Float := 10.0; offsetX2 : Float := 20.0; offsetY2 : Float := 20.0; shadowBox : Render.Util.Box2D; VAO : aliased GL.GLuint; VBO : aliased GL.GLuint; -- orthoM : Render.Util.Mat4 := Render.Util.ortho (0.0, sceneW, sceneH, 0.0, -1.0, 1.0); begin geomWin := Util.getWindowGeometry (c, window); shadowX := Float(geomWin.x) + offsetX1; shadowY := Float(geomWin.y) + offsetY1; shadowW := Float(geomWin.width) + offsetX2; shadowH := Float(geomWin.height) + offsetY2; shadowBox := ( 1 => (shadowX, shadowY + shadowH), 2 => (shadowX, shadowY), 3 => (shadowX + shadowW, shadowY + shadowH), 4 => (shadowX + shadowW, shadowY) ); -- VAO, VBO GLext.glGenVertexArrays (1, VAO'Access); GLext.glGenBuffers (1, VBO'Access); GLext.glBindVertexArray (VAO); GLext.glBindBuffer (GLext.GL_ARRAY_BUFFER, VBO); GLext.glBufferData (GLext.GL_ARRAY_BUFFER, shadowBox'Length, shadowBox'Address, GLext.GL_STATIC_DRAW); -- Shader needs shadow dimensions to calculate blur, screen height to invert coords GLext.glUniform4f (location => Render.Shaders.shadowUniformShadow, v0 => shadowX, v1 => shadowY, v2 => shadowW, v3 => shadowH); GLext.glVertexAttribPointer (index => GL.GLuint(Render.Shaders.shadowAttribCoord), size => 2, c_type => GL.GL_FLOAT, normalized => GL.GL_FALSE, stride => 0, pointer => System.Null_Address); GLext.glEnableVertexAttribArray (GL.GLuint(Render.Shaders.shadowAttribCoord)); GLext.glBufferData (target => GLext.GL_ARRAY_BUFFER, size => shadowBox'Size / 8, data => shadowBox'Address, usage => GLext.GL_DYNAMIC_DRAW); -- glErr := GL.glGetError; --Ada.Text_IO.Put_Line ("drawCircle: glBufferData error? " & glErr'Image); GLext.glBindVertexArray (VAO); GL.glDrawArrays (mode => GL.GL_TRIANGLE_STRIP, first => 0, count => Interfaces.C.int(shadowBox'Last)); -- glErr := GL.glGetError; --Ada.Text_IO.Put_Line ("drawCircle: glDrawArrays error? " & glErr'Image); GLext.glDisableVertexAttribArray (GL.GLuint(Render.Shaders.shadowAttribCoord)); GLext.glDeleteVertexArrays (1, VAO'Access); GLext.glDeleteBuffers (1, VBO'Access); end drawShadow; --------------------------------------------------------------------------- -- This is an experimental method to batch up some of the requests like -- xcb_get_geometry, create a bunch of textures at once, but this still has -- issues and isn't ready to go yet. --------------------------------------------------------------------------- -- procedure updateScene (c : access xcb.xcb_connection_t; -- rend : Render.Renderer) is -- use xcb_composite; -- -- Set up parallel arrays of all the elements we need here. -- type GeomPtr is access all xcb_get_geometry_reply_t; -- numWindows : Natural := Natural(winStack.Length); -- -- geometry cookies -- type GCookieArr is array (Natural range 1..numWindows) of xcb_get_geometry_cookie_t; -- type GeomArr is array (Natural range 1..numWindows) of GeomPtr; -- type QuadArr is array (Natural range 1..numWindows) of Render.Util.Box with -- Convention => C; -- -- pixmap cookies -- type PCookieArr is array (Natural range 1..numWindows) of xcb_void_cookie_t; -- type PixmapArr is array (Natural range 1..numWindows) of xcb_pixmap_t; -- -- GLX pixmaps -- type GPixmapArr is array (Natural range 1..numWindows) of GLX.GLXPixmap; -- type GlXPixmapAttrList is array (Natural range <>) of aliased Interfaces.C.int; -- glxPixmapAttrRGB : GLXPixmapAttrList := ( -- GLXext.GLX_TEXTURE_TARGET_EXT, GLXext.GLX_TEXTURE_2D_EXT, -- GLXext.GLX_TEXTURE_FORMAT_EXT, GLXext.GLX_TEXTURE_FORMAT_RGB_EXT, -- 0); -- glxPixmapAttrRGBA : GLXPixmapAttrList := ( -- GLXext.GLX_TEXTURE_TARGET_EXT, GLXext.GLX_TEXTURE_2D_EXT, -- GLXext.GLX_TEXTURE_FORMAT_EXT, GLXext.GLX_TEXTURE_FORMAT_RGBA_EXT, -- 0); -- glxPixmapAttr : access int; -- -- Textures -- type TexArray is array (Natural range 1..numWindows) of aliased GL.GLuint with Convention => C; -- -- VAOs, VBOs -- -- type VAOArr is array (Natural range 1..numWindows) of aliased GL.GLuint with Convention => C; -- -- type VBOArr is array (Natural range 1..numWindows) of aliased GL.GLuint with Convention => C; -- gcookies : GCookieArr; -- geoms : GeomArr; -- quads : QuadArr; -- pcookies : PCookieArr; -- pixmaps : PixmapArr; -- gpixmaps : GPixmapArr; -- error : access xcb_generic_error_t; -- textures : TexArray; -- -- VAOs : VAOArr; -- -- VBOs : VBOArr; -- procedure free is new Ada.Unchecked_Deallocation (Object => xcb_get_geometry_reply_t, -- Name => GeomPtr); -- i : Natural := 1; -- begin -- if numWindows = 0 then -- return; -- end if; -- Ada.Text_IO.Put_Line ("Drawing" & numWindows'Image & " windows"); -- -- Send out all geometry requests and generate pixmap IDs for each -- for win of winStack loop -- -- We can probably do this even earlier, then do some GL setup while -- -- the server is figuring it out. -- pixmaps(i) := xcb_generate_id (c); -- gcookies(i) := xcb_get_geometry (c, win); -- if pixmaps(i) = 0 then -- raise CompositorException with "Unable to generate new ID for pixmap"; -- end if; -- pcookies(i) := xcb_composite_name_window_pixmap (c, win, pixmaps(i)); -- i := i + 1; -- end loop; -- -- While waiting for geometry requests, create textures -- GL.glGenTextures (int(numWindows), textures(1)'Access); -- GL.glTexParameteri (target => GL.GL_TEXTURE_2D, -- pname => GL.GL_TEXTURE_MIN_FILTER, -- param => GL.GL_LINEAR); -- GL.glTexParameteri (target => GL.GL_TEXTURE_2D, -- pname => GL.GL_TEXTURE_MAG_FILTER, -- param => GL.GL_LINEAR); -- -- GLext.glGenVertexArrays (numWindows, VAOs(1)'Access); -- -- GLext.glGenBuffers (numWindows, VBOs(1)'Access); -- -- Receive all geometry requests, create quad and GLX pixmap for each window -- for j in 1..numWindows loop -- geoms(j) := xcb_get_geometry_reply (c, gcookies(j), error'Address); -- declare -- winX : Float := Float(geoms(j).x); -- winY : Float := Float(geoms(j).y); -- winW : Float := Float(geoms(j).width); -- winH : Float := Float(geoms(j).height); -- begin -- Ada.Text_IO.Put_Line ("Drawing window at " & winX'Image & "," & winY'Image); -- quads(j) := ( -- 1 => (winX, winY + winH, 0.0, 1.0), -- Bottom left -- 2 => (winX, winY, 0.0, 0.0), -- Top left -- 3 => (winX + winW, winY + winH, 1.0, 1.0), -- Bottom right -- 4 => (winX + winW, winY, 1.0, 0.0) -- Top right -- ); -- end; -- if geoms(j).depth = 32 then -- glxPixmapAttr := glxPixmapAttrRGBA(0)'Access; -- else -- glxPixmapAttr := glxPixmapAttrRGB(0)'Access; -- end if; -- gpixmaps(j) := GLX.glXCreatePixmap (dpy => rend.display, -- config => rend.fbConfig, -- the_pixmap => X11.Pixmap(pixmaps(j)), -- attribList => glxPixmapAttr); -- end loop; -- Ada.Text_IO.Put_Line ("c"); -- --@TODO figure out how to change this per-window. -- GLext.glUniform1f (Render.Shaders.winUniformAlpha, 1.0); -- -- Buffer all the quads -- GLext.glGenBuffers (1, Render.Shaders.winVBO'Access); -- GLext.glBindBuffer (target => GLext.GL_ARRAY_BUFFER, -- buffer => Render.Shaders.winVBO); -- GLext.glVertexAttribPointer (index => GL.GLuint(Render.Shaders.winAttribCoord), -- size => 4, -- c_type => GL.GL_FLOAT, -- normalized => GL.GL_FALSE, -- stride => 0, -- pointer => System.Null_Address); -- GLext.glEnableVertexAttribArray (GL.GLuint(Render.Shaders.winAttribCoord)); -- GLext.glBufferData (target => GLext.GL_ARRAY_BUFFER, -- size => quads'Length, --quads'Size / 8, -- data => quads'Address, -- usage => GLext.GL_STATIC_DRAW); -- Ada.Text_IO.Put_Line ("d"); -- GL.glActiveTexture (GL.GL_TEXTURE_2D); -- -- Draw the quads -- for j in 1..numWindows loop -- -- bind/re-bind texture -- GL.glBindTexture (GL.GL_TEXTURE_2D, textures(j)); -- glXBindTexImageEXT (rend.display, gpixmaps(j), GLXext.GLX_FRONT_LEFT_EXT, null); -- GL.glDrawArrays (mode => GL.GL_TRIANGLE_STRIP, -- first => int(j - 1), -- count => 4); -- glXReleaseTexImageEXT (rend.display, gpixmaps(j), GLXext.GLX_FRONT_LEFT_EXT); -- end loop; -- Ada.Text_IO.Put_Line ("e"); -- -- Cleanup. -- GLext.glDisableVertexAttribArray (GL.GLuint(Render.Shaders.winAttribCoord)); -- GLext.glDeleteBuffers (1, Render.Shaders.winVBO'Access); -- -- Delete textures -- GL.glDeleteTextures (int(numWindows), textures(1)'Access); -- -- Free all geometry requests and pixmaps -- for j in 1..numWindows loop -- GLX.glXDestroyPixmap (rend.display, gpixmaps(j)); -- free(geoms(j)); -- pcookies(j) := xcb_free_pixmap (c, pixmaps(j)); -- end loop; -- Ada.Text_IO.Put_Line ("f"); -- end updateScene; --------------------------------------------------------------------------- -- blitWindow -- @TODO we should buffer all the window quads at once, then just call -- glDrawArrays here. --------------------------------------------------------------------------- procedure blitWindow (c : access xcb.xcb_connection_t; rend : Render.Renderer; win : xproto.xcb_window_t; transparency : Float := 1.0) is use xcb; use xcb_composite; use xproto; glxRet : int; -- Window geometry, location and orthographic projection geomWin : xcb_get_geometry_reply_t; -- geometry of the window we're blitting winX : Float; winY : Float; winW : Float; winH : Float; -- Pixmap info from XCB cookie : xcb_void_cookie_t; error : access xcb_generic_error_t; pixmap : xcb_pixmap_t; -- GLX Pixmap/Texture vars Type GlXPixmapAttrList is array (Natural range <>) of aliased Interfaces.C.int; glxPixmapAttrRGB : GLXPixmapAttrList := ( GLXext.GLX_TEXTURE_TARGET_EXT, GLXext.GLX_TEXTURE_2D_EXT, GLXext.GLX_TEXTURE_FORMAT_EXT, GLXext.GLX_TEXTURE_FORMAT_RGB_EXT, 0); glxPixmapAttrRGBA : GLXPixmapAttrList := ( GLXext.GLX_TEXTURE_TARGET_EXT, GLXext.GLX_TEXTURE_2D_EXT, GLXext.GLX_TEXTURE_FORMAT_EXT, GLXext.GLX_TEXTURE_FORMAT_RGBA_EXT, 0); glxPixmapAttr : access int; glxPixmap : GLX.GLXPixmap; tex : aliased GL.GLuint; -- Destination quad to which the window shall be rendered dest : Render.Util.Box; begin -- Get window geometry -- @TODO keep track of geometry in a window record in the winStack and -- just reference that here instead of hitting server. geomWin := Util.getWindowGeometry (c, win); winX := Float(geomWin.x); winY := Float(geomWin.y); winW := Float(geomWin.width); winH := Float(geomWin.height); -- Get pixbuf of window's off-screen storage. We have to perform this step -- because a window's contents may have changed between blits. pixmap := xcb_generate_id (c); if pixmap = 0 then raise CompositorException with "Unable to generate new ID for pixmap"; end if; cookie := xcb_composite_name_window_pixmap (c => c, window => win, pixmap => pixmap); -- error := xcb_request_check (c, cookie); -- if error /= null then -- If off-screen pixmap isn't ready yet, just go ahead and bail. -- It might not be mapped yet, or some other weird situation. -- return; -- end if; -- Ada.Text_IO.Put_Line ("Blitting window " & win'Image); -- Determine color depth of window if geomWin.depth = 32 then glxPixmapAttr := glxPixmapAttrRGBA(0)'Access; else glxPixmapAttr := glxPixmapAttrRGB(0)'Access; end if; -- Need to bind to an intermediate GLX pixmap object first. -- Note: GLX documentation says attribList is unused, but example in the -- GLX_EXT_texture_from_pixmap document provides it. glxPixmap := GLX.glXCreatePixmap (dpy => rend.display, config => rend.fbConfig, the_pixmap => X11.Pixmap(pixmap), attribList => glxPixmapAttr); -- @TODO generate all the quads at once, load all textures at once, then -- index into the quad array for each window. GL.glGenTextures (1, tex'Access); GL.glBindTexture (GL.GL_TEXTURE_2D, tex); glXBindTexImageEXT (rend.display, glxPixmap, GLXext.GLX_FRONT_LEFT_EXT, null); GL.glTexParameteri (target => GL.GL_TEXTURE_2D, pname => GL.GL_TEXTURE_MIN_FILTER, param => GL.GL_LINEAR); GL.glTexParameteri (target => GL.GL_TEXTURE_2D, pname => GL.GL_TEXTURE_MAG_FILTER, param => GL.GL_LINEAR); -- Set up attribs/uniforms for shader program GLext.glGenBuffers (1, Render.Shaders.winVBO'Access); GLext.glEnableVertexAttribArray (GL.GLuint(Render.Shaders.winAttribCoord)); GLext.glBindBuffer (target => GLext.GL_ARRAY_BUFFER, buffer => Render.Shaders.winVBO); GLext.glVertexAttribPointer (index => GL.GLuint(Render.Shaders.winAttribCoord), size => 4, c_type => GL.GL_FLOAT, normalized => GL.GL_FALSE, stride => 0, pointer => System.Null_Address); -- per-window Alpha to support transparent windows GLext.glUniform1f (Render.Shaders.winUniformAlpha, transparency); -- Draw quad. A little confusing since texture coords are (0,0) = bottom left dest := ( 1 => (winX, winY + winH, 0.0, 1.0), -- Bottom left 2 => (winX, winY, 0.0, 0.0), -- Top left 3 => (winX + winW, winY + winH, 1.0, 1.0), -- Bottom right 4 => (winX + winW, winY, 1.0, 0.0) -- Top right ); GLext.glBufferData (target => GLext.GL_ARRAY_BUFFER, size => dest'Size / 8, data => dest'Address, usage => GLext.GL_DYNAMIC_DRAW); GL.glDrawArrays (mode => GL.GL_TRIANGLE_STRIP, first => 0, count => Interfaces.C.int(dest'Last)); -- Cleanup glXReleaseTexImageEXT (rend.display, glxPixmap, GLXext.GLX_FRONT_LEFT_EXT); GLext.glDisableVertexAttribArray (GL.GLuint(Render.Shaders.winAttribCoord)); GLext.glDeleteBuffers (1, Render.Shaders.winVBO'Access); GL.glDeleteTextures (1, tex'Access); GLX.glXDestroyPixmap (rend.display, glxPixmap); -- This is important. xcb_composite_name_window_pixmap_checked keeps the -- pixmap allocated until freed. cookie := xcb_free_pixmap (c, pixmap); end blitWindow; ------------------------------------------------------------------------------- -- renderScene -- Copy the off-screen buffers of all windows into the overlay window. -- -- @TODO track damage and re-render only as necessary? -- -- See http://developer.download.nvidia.com/opengl/specs/GLX_EXT_texture_from_pixmap.txt ------------------------------------------------------------------------------- procedure renderScene (c : access xcb.xcb_connection_t; rend : Render.Renderer) is use xcb; use xproto; glxRet : int; cookie : xcb_void_cookie_t; geomScene : xcb_get_geometry_reply_t; -- geometry of the overlay window sceneW : Float; sceneH : Float; orthoM : Render.Util.Mat4; begin -- To ensure all window pixmaps are in a coherent state, and not mid-copy: -- receive request for compositing -- cookie := xcb_grab_server (c); -- perform rendering/compositing glxRet := GLX.glXMakeContextCurrent (dpy => rend.display, draw => sceneDrawable, read => sceneDrawable, ctx => rend.context); GLext.glUseProgram (Render.Shaders.winShaderProg); -- Set up projection geomScene := Util.getWindowGeometry (c, sceneWindow); sceneW := Float(geomScene.width); sceneH := Float(geomScene.height); orthoM := Render.Util.ortho (0.0, sceneW, sceneH, 0.0, -1.0, 1.0); GLext.glUniformMatrix4fv (location => Render.Shaders.winUniformOrtho, count => 1, transpose => GL.GL_TRUE, value => orthoM(1)'Access); GL.glViewport (x => 0, y => 0, width => GL.GLsizei(sceneW), height => GL.GLsizei(sceneH)); if glxRet = 0 then Ada.Text_IO.Put_Line ("Troodon: (Compositor) blitAll - Unable to make context current"); end if; GLX.glXWaitX; -- Complete X work prior to GL call GL.glClearColor (red => 0.7, green => 0.7, blue => 0.0, alpha => 1.0); GL.glClear (GL.GL_COLOR_BUFFER_BIT); -- Always blit the desktop first. blitWindow (c, rend, Desktop.getWindow); -- need to switch shader programs here. -- GLext.glUseProgram (Render.Shaders.shadowShaderProg); --drawShadows (c, rend, winStack); -- GLext.glUseProgram (Render.Shaders.winShaderProg); -- blitWindows (c, rend); for win of winStack loop GLext.glUseProgram (Render.Shaders.shadowShaderProg); GLext.glUniformMatrix4fv (location => Render.Shaders.shadowUniformOrtho, count => 1, transpose => GL.GL_TRUE, value => orthoM(1)'Access); GLext.glUniform4f (location => Render.Shaders.shadowUniformColor, v0 => 0.0, v1 => 0.0, v2 => 0.0, v3 => 0.5); GLext.glUniform1f (location => Render.Shaders.shadowUniformScreenH, v0 => sceneH); drawShadow (c, rend, win); GLext.glUseProgram (Render.Shaders.winShaderProg); GLext.glUniformMatrix4fv (location => Render.Shaders.winUniformOrtho, count => 1, transpose => GL.GL_TRUE, value => orthoM(1)'Access); blitWindow (c, rend, win); end loop; GLX.glXSwapBuffers (rend.display, sceneDrawable); GLext.glUseProgram (0); -- cookie := xcb_ungrab_server (c); end renderScene; end Compositor;
reznikmm/matreshka
Ada
6,134
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.Constants; with ODF.DOM.Elements.Office.Scripts.Internals; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Elements.Office.Scripts is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access Office_Scripts_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.ODF_Visitor'Class then ODF.DOM.Visitors.ODF_Visitor'Class (Visitor).Enter_Office_Scripts (ODF.DOM.Elements.Office.Scripts.Internals.Create (Office_Scripts_Access (Self)), Control); else Matreshka.DOM_Nodes.Elements.Abstract_Element (Self.all).Enter_Element (Visitor, Control); end if; end Enter_Element; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Office_Scripts_Node) return League.Strings.Universal_String is begin return ODF.Constants.Scripts_Name; end Get_Local_Name; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access Office_Scripts_Node; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Visitor in ODF.DOM.Visitors.ODF_Visitor'Class then ODF.DOM.Visitors.ODF_Visitor'Class (Visitor).Leave_Office_Scripts (ODF.DOM.Elements.Office.Scripts.Internals.Create (Office_Scripts_Access (Self)), Control); else Matreshka.DOM_Nodes.Elements.Abstract_Element (Self.all).Leave_Element (Visitor, Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access Office_Scripts_Node; Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class; Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class; Control : in out XML.DOM.Visitors.Traverse_Control) is begin if Iterator in ODF.DOM.Iterators.ODF_Iterator'Class then ODF.DOM.Iterators.ODF_Iterator'Class (Iterator).Visit_Office_Scripts (Visitor, ODF.DOM.Elements.Office.Scripts.Internals.Create (Office_Scripts_Access (Self)), Control); else Matreshka.DOM_Nodes.Elements.Abstract_Element (Self.all).Visit_Element (Iterator, Visitor, Control); end if; end Visit_Element; end Matreshka.ODF_Elements.Office.Scripts;
Schol-R-LEA/sarcos
Ada
98
ads
/home/schol-r-lea/Documents/Programming/Projects/OS-Experiments/sarcos/sarcos/ada/rts/src/gnat.ads
MinimSecure/unum-sdk
Ada
760
ads
-- Copyright 2013-2016 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. package Pck is I : Integer := 1; end Pck;
charlie5/aIDE
Ada
1,887
adb
with AdaM.Factory; package body AdaM.Declaration.of_renaming.a_subprogram is -- Storage Pool -- record_Version : constant := 1; pool_Size : constant := 5_000; package Pool is new AdaM.Factory.Pools (".adam-store", "Declarations.of_renaming.a_subprogram", pool_Size, record_Version, Declaration.of_renaming.a_subprogram.item, Declaration.of_renaming.a_subprogram.view); -- Forge -- procedure define (Self : in out Item) is begin null; end define; overriding procedure destruct (Self : in out Item) is begin null; end destruct; function new_Declaration return View is new_View : constant Declaration.of_renaming.a_subprogram.view := Pool.new_Item; begin define (Declaration.of_renaming.a_subprogram.item (new_View.all)); return new_View; end new_Declaration; procedure free (Self : in out Declaration.of_renaming.a_subprogram.view) is begin destruct (Declaration.of_renaming.a_subprogram.item (Self.all)); Pool.free (Self); end free; -- Attributes -- overriding function Id (Self : access Item) return AdaM.Id is begin return Pool.to_Id (Self); end Id; -- Streams -- procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : in View) renames Pool.View_write; procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : out View) renames Pool.View_read; end AdaM.Declaration.of_renaming.a_subprogram;
ohenley/ada-util
Ada
3,622
adb
----------------------------------------------------------------------- -- util-streams-raw -- Raw streams for Windows based systems -- Copyright (C) 2011 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.IO_Exceptions; with System; with Ada.Text_IO; package body Util.Streams.Raw is use System; use Util.Systems.Os; -- ----------------------- -- Initialize the raw stream to read and write on the given file descriptor. -- ----------------------- procedure Initialize (Stream : in out Raw_Stream; File : in File_Type) is begin if Stream.File /= NO_FILE then raise Ada.IO_Exceptions.Status_Error; end if; Stream.File := File; end Initialize; -- ----------------------- -- Close the stream. -- ----------------------- procedure Close (Stream : in out Raw_Stream) is Error : Integer; begin if Stream.File /= NO_FILE then if Close_Handle (Stream.File) = 0 then Error := Get_Last_Error; if Error /= ERROR_BROKEN_PIPE then raise Ada.IO_Exceptions.Device_Error with "IO error: " & Integer'Image (Error); end if; end if; Stream.File := NO_FILE; end if; end Close; -- ----------------------- -- Write the buffer array to the output stream. -- ----------------------- procedure Write (Stream : in out Raw_Stream; Buffer : in Ada.Streams.Stream_Element_Array) is Res : aliased DWORD := 0; Status : BOOL; begin Status := Write_File (Stream.File, Buffer'Address, Buffer'Length, Res'Unchecked_Access, System.Null_Address); if Status = 0 then raise Ada.IO_Exceptions.Device_Error; end if; end Write; -- ----------------------- -- Read into the buffer as many bytes as possible and return in -- <b>last</b> the position of the last byte read. -- ----------------------- procedure Read (Stream : in out Raw_Stream; Into : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is Res : aliased DWORD := 0; Status : BOOL; Error : Integer; begin Status := Read_File (Stream.File, Into'Address, Into'Length, Res'Unchecked_Access, System.Null_Address); if Status = 0 then Error := Get_Last_Error; if Error /= ERROR_BROKEN_PIPE then raise Ada.IO_Exceptions.Device_Error with "IO error: " & Integer'Image (Error); end if; end if; Last := Into'First + Ada.Streams.Stream_Element_Offset (Res) - 1; end Read; -- ----------------------- -- Flush the stream and release the buffer. -- ----------------------- procedure Finalize (Object : in out Raw_Stream) is begin Close (Object); end Finalize; end Util.Streams.Raw;
ekoeppen/STM32_Generic_Ada_Drivers
Ada
215
ads
with STM32GD.Timer; with STM32_SVD.Interrupts; with STM32_SVD.TIM; use STM32_SVD.TIM; package Peripherals is package Timer is new STM32GD.Timer ( Timer => TIM6_Periph, IRQ => 17); end Peripherals;
stcarrez/stm32-ui
Ada
12,636
ads
--------------------------------- -- GID - Generic Image Decoder -- --------------------------------- -- -- Purpose: -- -- The Generic Image Decoder is a package for decoding a broad -- variety of image formats, from any data stream, to any kind -- of medium, be it an in-memory bitmap, a GUI object, -- some other stream, arrays of floating-point initial data -- for scientific calculations, a browser element, a device,... -- Animations are supported. -- -- The code is unconditionally portable, independent of the -- choice of operating system, processor, endianess and compiler. -- -- Image types currently supported: -- -- BMP, GIF, JPEG, PNG, PNM, TGA -- -- Credits: -- -- - André van Splunter: GIF's LZW decoder in Ada -- - Martin J. Fiedler: most of the JPEG decoder (from NanoJPEG) -- -- More credits in gid_work.xls, sheet "credits". -- -- Copyright (c) Gautier de Montmollin 2010 .. 2018 -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- -- NB: this is the MIT License, as found 2-May-2010 on the site -- http://www.opensource.org/licenses/mit-license.php with Ada.Calendar, Ada.Streams, Ada.Strings.Bounded, Ada.Finalization; with Interfaces; with System; package GID is type Image_descriptor is private; --------------------------------------------------- -- 1) Load the image header from the data stream -- --------------------------------------------------- procedure Load_image_header ( image : out Image_descriptor; from : in out Ada.Streams.Root_Stream_Type'Class; try_tga : Boolean:= False ); -- try_tga: if no known signature is found, assume it might be -- the TGA format (which hasn't a signature) and try to load an -- image of this format unknown_image_format, known_but_unsupported_image_format, unsupported_image_subformat, error_in_image_data, invalid_primary_color_range: exception; ---------------------------------------------------------------------- -- 2) If needed, use dimensions to prepare the retrieval of the -- -- image, for instance: reserving an in-memory bitmap, sizing a -- -- GUI object, defining a browser element, setting up a device -- ---------------------------------------------------------------------- function Pixel_width (image: Image_descriptor) return Positive; function Pixel_height (image: Image_descriptor) return Positive; -- "Unchanged" orientation has origin at top left type Orientation is ( Unchanged, Rotation_90, Rotation_180, Rotation_270 ); function Display_orientation (image: Image_descriptor) return Orientation; -------------------------------------------------------------------- -- 3) Load and decode the image itself. If the image is animated, -- -- call Load_image_contents until next_frame is 0.0 -- -------------------------------------------------------------------- type Display_mode is (fast, nice); -- For bitmap pictures, the result is exactly the same, but -- interlaced images' larger pixels are drawn in full during decoding. generic type Primary_color_range is mod <>; -- Coding of primary colors (red, green or blue) -- and of opacity (also known as alpha channel), on the target "device". -- Currently, only 8-bit and 16-bit are admitted. -- 8-bit coding is usual: TrueColor, PC graphics, etc.; -- 16-bit coding is seen in some high-end apps/devices/formats. -- with procedure Set_X_Y (x, y: Natural); -- After Set_X_Y, next pixel is meant to be displayed at position (x,y) with procedure Put_Pixel ( red, green, blue : Primary_color_range; alpha : Primary_color_range ); -- Called with each byte that was read from the image block section. with procedure Raw_Byte (Byte : in Interfaces.Unsigned_8); -- When Put_Pixel is called twice without a Set_X_Y inbetween, -- the pixel must be displayed on the next X position after the last one. -- [ Rationale: if the image lands into an array with contiguous pixels -- on the X axis, this approach allows full address calculation to be -- made only at the beginning of each row, which is much faster ] -- with procedure Feedback (percents: Natural); -- mode: Display_mode; -- procedure Load_image_contents ( image : in out Image_descriptor; next_frame: out Ada.Calendar.Day_Duration -- ^ animation: real time lapse foreseen between the first image -- and the image right after this one; 0.0 if no next frame ); ------------------------------------------------------------------- -- Some informations about the image, not necessary for decoding -- ------------------------------------------------------------------- type Image_format_type is ( -- Bitmap formats BMP, FITS, GIF, JPEG, PNG, PNM, TGA, TIFF ); function Format (image: Image_descriptor) return Image_format_type; function Detailed_format (image: Image_descriptor) return String; -- example: "GIF89a, interlaced" function Subformat (image: Image_descriptor) return Integer; -- example the 'color type' in PNG function Bits_per_pixel (image: Image_descriptor) return Positive; function RLE_encoded (image: Image_descriptor) return Boolean; function Interlaced (image: Image_descriptor) return Boolean; function Greyscale (image: Image_descriptor) return Boolean; function Has_palette (image: Image_descriptor) return Boolean; function Expect_transparency (image: Image_descriptor) return Boolean; generic with procedure Get_color (Red, Green, Blue : Interfaces.Unsigned_8); procedure Get_palette (image : Image_descriptor); ---------------------------------------------------------------- -- Information about this package - e.g. for an "about" box -- ---------------------------------------------------------------- version : constant String:= "008"; reference : constant String:= "28-Jun-2018"; web: constant String:= "http://gen-img-dec.sf.net/"; -- Hopefully the latest version is at that URL..^ private use Interfaces; subtype U8 is Unsigned_8; subtype U16 is Unsigned_16; subtype U32 is Unsigned_32; package Bounded_255 is new Ada.Strings.Bounded.Generic_Bounded_Length(255); type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class; type RGB_color is record red, green, blue : U8; end record; type Color_table is array (Integer range <>) of RGB_color; type p_Color_table is access Color_table; min_bits: constant:= Integer'Max(32, System.Word_Size); -- 13.3(8): A word is the largest amount of storage that can be -- conveniently and efficiently manipulated by the hardware, -- given the implementation's run-time model. type Integer_M32 is range -2**(min_bits-1) .. 2**(min_bits-1) - 1; -- We define an Integer type which is at least 32 bits, but n bits -- on a native n > 32 bits architecture (no performance hit on 64+ -- bits architectures). subtype Natural_M32 is Integer_M32 range 0..Integer_M32'Last; subtype Positive_M32 is Integer_M32 range 1..Integer_M32'Last; type Byte_array is array(Integer range <>) of U8; type Input_buffer is record data : Byte_array(1..1024); stream : Stream_Access:= null; InBufIdx : Positive:= 1; -- Points to next char in buffer to be read MaxInBufIdx: Natural := 0; -- Count of valid chars in input buffer InputEoF : Boolean; -- End of file indicator end record; -- Initial values ensure call to Fill_Buffer on first Get_Byte -- JPEG may store data _before_ any image header (SOF), then we have -- to make the image descriptor store that information, alas... package JPEG_defs is type Component is (Y, -- brightness Cb, -- hue Cr, -- saturation I, -- ?? Q -- ?? ); type QT is array(0..63) of Natural; type QT_list is array(0..7) of QT; type Compo_set is array(Component) of Boolean; type Info_per_component_A is record -- B is defined inside the decoder qt_assoc : Natural; samples_hor : Natural; samples_ver : Natural; up_factor_x : Natural; -- how much we must repeat horizontally up_factor_y : Natural; -- how much we must repeat vertically shift_x : Natural; -- shift for repeating pixels horizontally shift_y : Natural; -- shift for repeating pixels vertically end record; type Component_info_A is array(Component) of Info_per_component_A; type Supported_color_space is ( YCbCr, -- 3-dim color space Y_Grey, -- 1-dim greyscale CMYK -- 4-dim Cyan, Magenta, Yellow, blacK ); type AC_DC is (AC, DC); type VLC_code is record bits, code: U8; end record; type VLC_table is array(0..65_535) of VLC_code; type p_VLC_table is access VLC_table; type VLC_defs_type is array(AC_DC, 0..7) of p_VLC_table; end JPEG_defs; type JPEG_stuff_type is record components : JPEG_defs.Compo_set:= (others => False); color_space : JPEG_defs.Supported_color_space; info : JPEG_defs.Component_info_A; max_samples_hor : Natural; max_samples_ver : Natural; qt_list : JPEG_defs.QT_list; vlc_defs : JPEG_defs.VLC_defs_type:= (others => (others => null)); restart_interval : Natural; -- predictor restarts every... (0: never) end record; type Endianess_type is (little, big); -- for TIFF images type Image_descriptor is new Ada.Finalization.Controlled with record format : Image_format_type; detailed_format : Bounded_255.Bounded_String; -- for humans only! subformat_id : Integer:= 0; width, height : Positive; display_orientation: Orientation; top_first : Boolean; -- data orientation in TGA bits_per_pixel : Positive; RLE_encoded : Boolean:= False; transparency : Boolean:= False; greyscale : Boolean:= False; interlaced : Boolean:= False; -- GIF or PNG endianess : Endianess_type; -- TIFF JPEG_stuff : JPEG_stuff_type; stream : Stream_Access; buffer : Input_buffer; palette : p_Color_table:= null; first_byte : U8; next_frame : Ada.Calendar.Day_Duration; end record; procedure Adjust (Object : in out Image_descriptor); procedure Finalize (Object : in out Image_descriptor); to_be_done: exception; -- this exception should not happen, even with malformed files -- its role is to pop up when a feature is set as implemented -- but one aspect (e.g. palette) was forgotten. -- -- Primitive tracing using Ada.Text_IO, for debugging, -- or explaining internals. -- type Trace_type is ( none, -- No trace at all, no use of console from the library some_t, -- Image / frame technical informations full -- Byte / pixel / compressed block details ); trace: constant Trace_type:= none; -- <== Choice here no_trace : constant Boolean:= trace=none; full_trace: constant Boolean:= trace=full; some_trace: constant Boolean:= trace>=some_t; end GID;
reznikmm/matreshka
Ada
3,600
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Elements.Generic_Hash; function AMF.DG.Clip_Paths.Hash is new AMF.Elements.Generic_Hash (DG_Clip_Path, DG_Clip_Path_Access);
zhmu/ananas
Ada
3,853
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . C O N C A T _ 9 -- -- -- -- B o d y -- -- -- -- Copyright (C) 2008-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Concat_8; package body System.Concat_9 is pragma Suppress (All_Checks); ------------------ -- Str_Concat_9 -- ------------------ procedure Str_Concat_9 (R : out String; S1, S2, S3, S4, S5, S6, S7, S8, S9 : String) is F, L : Natural; begin F := R'First; L := F + S1'Length - 1; R (F .. L) := S1; F := L + 1; L := F + S2'Length - 1; R (F .. L) := S2; F := L + 1; L := F + S3'Length - 1; R (F .. L) := S3; F := L + 1; L := F + S4'Length - 1; R (F .. L) := S4; F := L + 1; L := F + S5'Length - 1; R (F .. L) := S5; F := L + 1; L := F + S6'Length - 1; R (F .. L) := S6; F := L + 1; L := F + S7'Length - 1; R (F .. L) := S7; F := L + 1; L := F + S8'Length - 1; R (F .. L) := S8; F := L + 1; L := R'Last; R (F .. L) := S9; end Str_Concat_9; ------------------------- -- Str_Concat_Bounds_9 -- ------------------------- procedure Str_Concat_Bounds_9 (Lo, Hi : out Natural; S1, S2, S3, S4, S5, S6, S7, S8, S9 : String) is begin System.Concat_8.Str_Concat_Bounds_8 (Lo, Hi, S2, S3, S4, S5, S6, S7, S8, S9); if S1 /= "" then Hi := S1'Last + Hi - Lo + 1; Lo := S1'First; end if; end Str_Concat_Bounds_9; end System.Concat_9;
charlie5/aIDE
Ada
1,687
adb
with AdaM.Factory; package body AdaM.program_Library is -- Storage Pool -- record_Version : constant := 1; pool_Size : constant := 5_000; package Pool is new AdaM.Factory.Pools (".adam-store", "program_libraries", pool_Size, record_Version, program_Library.item, program_Library.view); -- Forge -- procedure define (Self : in out Item) is begin null; end define; procedure destruct (Self : in out Item) is begin null; end destruct; function new_Subprogram return View is new_View : constant program_Library.view := Pool.new_Item; begin define (program_Library.item (new_View.all)); return new_View; end new_Subprogram; procedure free (Self : in out program_Library.view) is begin destruct (program_Library.item (Self.all)); Pool.free (Self); end free; -- Attributes -- overriding function Id (Self : access Item) return AdaM.Id is begin return Pool.to_Id (Self); end Id; -- Streams -- procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : in View) renames Pool.View_write; procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Self : out View) renames Pool.View_read; end AdaM.program_Library;
optikos/oasis
Ada
7,278
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Lexical_Elements; with Program.Elements.Defining_Identifiers; with Program.Elements.Aspect_Specifications; with Program.Elements.Expressions; with Program.Elements.Protected_Definitions; with Program.Elements.Single_Protected_Declarations; with Program.Element_Visitors; package Program.Nodes.Single_Protected_Declarations is pragma Preelaborate; type Single_Protected_Declaration is new Program.Nodes.Node and Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration and Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration_Text with private; function Create (Protected_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; New_Token : Program.Lexical_Elements.Lexical_Element_Access; Progenitors : Program.Elements.Expressions.Expression_Vector_Access; With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Definition : not null Program.Elements.Protected_Definitions .Protected_Definition_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Single_Protected_Declaration; type Implicit_Single_Protected_Declaration is new Program.Nodes.Node and Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration with private; function Create (Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Progenitors : Program.Elements.Expressions .Expression_Vector_Access; Definition : not null Program.Elements.Protected_Definitions .Protected_Definition_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Single_Protected_Declaration with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Single_Protected_Declaration is abstract new Program.Nodes.Node and Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration with record Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Progenitors : Program.Elements.Expressions.Expression_Vector_Access; Definition : not null Program.Elements.Protected_Definitions .Protected_Definition_Access; end record; procedure Initialize (Self : aliased in out Base_Single_Protected_Declaration'Class); overriding procedure Visit (Self : not null access Base_Single_Protected_Declaration; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Name (Self : Base_Single_Protected_Declaration) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; overriding function Aspects (Self : Base_Single_Protected_Declaration) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; overriding function Progenitors (Self : Base_Single_Protected_Declaration) return Program.Elements.Expressions.Expression_Vector_Access; overriding function Definition (Self : Base_Single_Protected_Declaration) return not null Program.Elements.Protected_Definitions .Protected_Definition_Access; overriding function Is_Single_Protected_Declaration_Element (Self : Base_Single_Protected_Declaration) return Boolean; overriding function Is_Declaration_Element (Self : Base_Single_Protected_Declaration) return Boolean; type Single_Protected_Declaration is new Base_Single_Protected_Declaration and Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration_Text with record Protected_Token : not null Program.Lexical_Elements .Lexical_Element_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; New_Token : Program.Lexical_Elements.Lexical_Element_Access; With_Token_2 : Program.Lexical_Elements.Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; end record; overriding function To_Single_Protected_Declaration_Text (Self : aliased in out Single_Protected_Declaration) return Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration_Text_Access; overriding function Protected_Token (Self : Single_Protected_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function With_Token (Self : Single_Protected_Declaration) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Is_Token (Self : Single_Protected_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function New_Token (Self : Single_Protected_Declaration) return Program.Lexical_Elements.Lexical_Element_Access; overriding function With_Token_2 (Self : Single_Protected_Declaration) return Program.Lexical_Elements.Lexical_Element_Access; overriding function Semicolon_Token (Self : Single_Protected_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Single_Protected_Declaration is new Base_Single_Protected_Declaration with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Single_Protected_Declaration_Text (Self : aliased in out Implicit_Single_Protected_Declaration) return Program.Elements.Single_Protected_Declarations .Single_Protected_Declaration_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Single_Protected_Declaration) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Single_Protected_Declaration) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Single_Protected_Declaration) return Boolean; end Program.Nodes.Single_Protected_Declarations;
charlie5/cBound
Ada
1,265
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces.C.Pointers; package TensorFlow_C.TF_Input is -- Item -- type Item is record oper : access TensorFlow_C.TF_Operation; index : aliased Interfaces.C.int; end record; -- Item_Array -- type Item_Array is array (Interfaces.C.size_t range <>) of aliased TensorFlow_C.TF_Input.Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => TensorFlow_C.TF_Input.Item, Element_Array => TensorFlow_C.TF_Input.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C.size_t range <>) of aliased TensorFlow_C.TF_Input.Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => TensorFlow_C.TF_Input.Pointer, Element_Array => TensorFlow_C.TF_Input.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end TensorFlow_C.TF_Input;
reznikmm/matreshka
Ada
70,752
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Internals.Extents; with AMF.Internals.Tables.CMOF_Constructors; with AMF.Internals.Tables.CMOF_Element_Table; with AMF.Internals.Tables.OCL_String_Data_00; package body AMF.Internals.Tables.OCL_Metamodel.Objects is ---------------- -- Initialize -- ---------------- procedure Initialize is Extent : constant AMF.Internals.AMF_Extent := AMF.Internals.Extents.Allocate_Extent (AMF.Internals.Tables.OCL_String_Data_00.MS_0047'Access); begin Base := AMF.Internals.Tables.CMOF_Element_Table.Last; Initialize_1 (Extent); Initialize_2 (Extent); Initialize_3 (Extent); Initialize_4 (Extent); Initialize_5 (Extent); Initialize_6 (Extent); Initialize_7 (Extent); Initialize_8 (Extent); Initialize_9 (Extent); Initialize_10 (Extent); Initialize_11 (Extent); Initialize_12 (Extent); Initialize_13 (Extent); Initialize_14 (Extent); Initialize_15 (Extent); Initialize_16 (Extent); Initialize_17 (Extent); Initialize_18 (Extent); Initialize_19 (Extent); Initialize_20 (Extent); Initialize_21 (Extent); Initialize_22 (Extent); Initialize_23 (Extent); Initialize_24 (Extent); Initialize_25 (Extent); Initialize_26 (Extent); Initialize_27 (Extent); Initialize_28 (Extent); Initialize_29 (Extent); Initialize_30 (Extent); Initialize_31 (Extent); Initialize_32 (Extent); Initialize_33 (Extent); Initialize_34 (Extent); Initialize_35 (Extent); Initialize_36 (Extent); Initialize_37 (Extent); Initialize_38 (Extent); Initialize_39 (Extent); Initialize_40 (Extent); Initialize_41 (Extent); Initialize_42 (Extent); Initialize_43 (Extent); Initialize_44 (Extent); Initialize_45 (Extent); Initialize_46 (Extent); Initialize_47 (Extent); Initialize_48 (Extent); Initialize_49 (Extent); Initialize_50 (Extent); Initialize_51 (Extent); Initialize_52 (Extent); Initialize_53 (Extent); Initialize_54 (Extent); Initialize_55 (Extent); Initialize_56 (Extent); Initialize_57 (Extent); Initialize_58 (Extent); Initialize_59 (Extent); Initialize_60 (Extent); Initialize_61 (Extent); Initialize_62 (Extent); Initialize_63 (Extent); Initialize_64 (Extent); Initialize_65 (Extent); Initialize_66 (Extent); Initialize_67 (Extent); Initialize_68 (Extent); Initialize_69 (Extent); Initialize_70 (Extent); Initialize_71 (Extent); Initialize_72 (Extent); Initialize_73 (Extent); Initialize_74 (Extent); Initialize_75 (Extent); Initialize_76 (Extent); Initialize_77 (Extent); Initialize_78 (Extent); Initialize_79 (Extent); Initialize_80 (Extent); Initialize_81 (Extent); Initialize_82 (Extent); Initialize_83 (Extent); Initialize_84 (Extent); Initialize_85 (Extent); Initialize_86 (Extent); Initialize_87 (Extent); Initialize_88 (Extent); Initialize_89 (Extent); Initialize_90 (Extent); Initialize_91 (Extent); Initialize_92 (Extent); Initialize_93 (Extent); Initialize_94 (Extent); Initialize_95 (Extent); Initialize_96 (Extent); Initialize_97 (Extent); Initialize_98 (Extent); Initialize_99 (Extent); Initialize_100 (Extent); Initialize_101 (Extent); Initialize_102 (Extent); Initialize_103 (Extent); Initialize_104 (Extent); Initialize_105 (Extent); Initialize_106 (Extent); Initialize_107 (Extent); Initialize_108 (Extent); Initialize_109 (Extent); Initialize_110 (Extent); Initialize_111 (Extent); Initialize_112 (Extent); Initialize_113 (Extent); Initialize_114 (Extent); Initialize_115 (Extent); Initialize_116 (Extent); Initialize_117 (Extent); Initialize_118 (Extent); Initialize_119 (Extent); Initialize_120 (Extent); Initialize_121 (Extent); Initialize_122 (Extent); Initialize_123 (Extent); Initialize_124 (Extent); Initialize_125 (Extent); Initialize_126 (Extent); Initialize_127 (Extent); Initialize_128 (Extent); Initialize_129 (Extent); Initialize_130 (Extent); Initialize_131 (Extent); Initialize_132 (Extent); Initialize_133 (Extent); Initialize_134 (Extent); Initialize_135 (Extent); Initialize_136 (Extent); Initialize_137 (Extent); Initialize_138 (Extent); Initialize_139 (Extent); Initialize_140 (Extent); Initialize_141 (Extent); Initialize_142 (Extent); Initialize_143 (Extent); Initialize_144 (Extent); Initialize_145 (Extent); Initialize_146 (Extent); Initialize_147 (Extent); Initialize_148 (Extent); Initialize_149 (Extent); Initialize_150 (Extent); Initialize_151 (Extent); Initialize_152 (Extent); Initialize_153 (Extent); Initialize_154 (Extent); Initialize_155 (Extent); Initialize_156 (Extent); Initialize_157 (Extent); Initialize_158 (Extent); Initialize_159 (Extent); Initialize_160 (Extent); Initialize_161 (Extent); Initialize_162 (Extent); Initialize_163 (Extent); Initialize_164 (Extent); Initialize_165 (Extent); Initialize_166 (Extent); Initialize_167 (Extent); Initialize_168 (Extent); Initialize_169 (Extent); Initialize_170 (Extent); Initialize_171 (Extent); Initialize_172 (Extent); Initialize_173 (Extent); Initialize_174 (Extent); Initialize_175 (Extent); Initialize_176 (Extent); Initialize_177 (Extent); Initialize_178 (Extent); end Initialize; ------------------ -- Initialize_1 -- ------------------ procedure Initialize_1 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_1; ------------------ -- Initialize_2 -- ------------------ procedure Initialize_2 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_2; ------------------ -- Initialize_3 -- ------------------ procedure Initialize_3 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_3; ------------------ -- Initialize_4 -- ------------------ procedure Initialize_4 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_4; ------------------ -- Initialize_5 -- ------------------ procedure Initialize_5 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_5; ------------------ -- Initialize_6 -- ------------------ procedure Initialize_6 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_6; ------------------ -- Initialize_7 -- ------------------ procedure Initialize_7 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_7; ------------------ -- Initialize_8 -- ------------------ procedure Initialize_8 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_8; ------------------ -- Initialize_9 -- ------------------ procedure Initialize_9 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_9; ------------------- -- Initialize_10 -- ------------------- procedure Initialize_10 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_10; ------------------- -- Initialize_11 -- ------------------- procedure Initialize_11 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_11; ------------------- -- Initialize_12 -- ------------------- procedure Initialize_12 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_12; ------------------- -- Initialize_13 -- ------------------- procedure Initialize_13 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_13; ------------------- -- Initialize_14 -- ------------------- procedure Initialize_14 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_14; ------------------- -- Initialize_15 -- ------------------- procedure Initialize_15 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_15; ------------------- -- Initialize_16 -- ------------------- procedure Initialize_16 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_16; ------------------- -- Initialize_17 -- ------------------- procedure Initialize_17 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_17; ------------------- -- Initialize_18 -- ------------------- procedure Initialize_18 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_18; ------------------- -- Initialize_19 -- ------------------- procedure Initialize_19 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_19; ------------------- -- Initialize_20 -- ------------------- procedure Initialize_20 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_20; ------------------- -- Initialize_21 -- ------------------- procedure Initialize_21 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_21; ------------------- -- Initialize_22 -- ------------------- procedure Initialize_22 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_22; ------------------- -- Initialize_23 -- ------------------- procedure Initialize_23 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_23; ------------------- -- Initialize_24 -- ------------------- procedure Initialize_24 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_24; ------------------- -- Initialize_25 -- ------------------- procedure Initialize_25 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_25; ------------------- -- Initialize_26 -- ------------------- procedure Initialize_26 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_26; ------------------- -- Initialize_27 -- ------------------- procedure Initialize_27 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_27; ------------------- -- Initialize_28 -- ------------------- procedure Initialize_28 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_28; ------------------- -- Initialize_29 -- ------------------- procedure Initialize_29 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_29; ------------------- -- Initialize_30 -- ------------------- procedure Initialize_30 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_30; ------------------- -- Initialize_31 -- ------------------- procedure Initialize_31 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_31; ------------------- -- Initialize_32 -- ------------------- procedure Initialize_32 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_32; ------------------- -- Initialize_33 -- ------------------- procedure Initialize_33 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_33; ------------------- -- Initialize_34 -- ------------------- procedure Initialize_34 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_34; ------------------- -- Initialize_35 -- ------------------- procedure Initialize_35 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_35; ------------------- -- Initialize_36 -- ------------------- procedure Initialize_36 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_36; ------------------- -- Initialize_37 -- ------------------- procedure Initialize_37 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_37; ------------------- -- Initialize_38 -- ------------------- procedure Initialize_38 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_38; ------------------- -- Initialize_39 -- ------------------- procedure Initialize_39 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_39; ------------------- -- Initialize_40 -- ------------------- procedure Initialize_40 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_40; ------------------- -- Initialize_41 -- ------------------- procedure Initialize_41 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_41; ------------------- -- Initialize_42 -- ------------------- procedure Initialize_42 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_42; ------------------- -- Initialize_43 -- ------------------- procedure Initialize_43 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_43; ------------------- -- Initialize_44 -- ------------------- procedure Initialize_44 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_44; ------------------- -- Initialize_45 -- ------------------- procedure Initialize_45 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_45; ------------------- -- Initialize_46 -- ------------------- procedure Initialize_46 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_46; ------------------- -- Initialize_47 -- ------------------- procedure Initialize_47 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Class; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_47; ------------------- -- Initialize_48 -- ------------------- procedure Initialize_48 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_48; ------------------- -- Initialize_49 -- ------------------- procedure Initialize_49 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_49; ------------------- -- Initialize_50 -- ------------------- procedure Initialize_50 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_50; ------------------- -- Initialize_51 -- ------------------- procedure Initialize_51 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_51; ------------------- -- Initialize_52 -- ------------------- procedure Initialize_52 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_52; ------------------- -- Initialize_53 -- ------------------- procedure Initialize_53 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_53; ------------------- -- Initialize_54 -- ------------------- procedure Initialize_54 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_54; ------------------- -- Initialize_55 -- ------------------- procedure Initialize_55 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_55; ------------------- -- Initialize_56 -- ------------------- procedure Initialize_56 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_56; ------------------- -- Initialize_57 -- ------------------- procedure Initialize_57 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_57; ------------------- -- Initialize_58 -- ------------------- procedure Initialize_58 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_58; ------------------- -- Initialize_59 -- ------------------- procedure Initialize_59 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_59; ------------------- -- Initialize_60 -- ------------------- procedure Initialize_60 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_60; ------------------- -- Initialize_61 -- ------------------- procedure Initialize_61 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_61; ------------------- -- Initialize_62 -- ------------------- procedure Initialize_62 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_62; ------------------- -- Initialize_63 -- ------------------- procedure Initialize_63 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_63; ------------------- -- Initialize_64 -- ------------------- procedure Initialize_64 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_64; ------------------- -- Initialize_65 -- ------------------- procedure Initialize_65 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_65; ------------------- -- Initialize_66 -- ------------------- procedure Initialize_66 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_66; ------------------- -- Initialize_67 -- ------------------- procedure Initialize_67 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_67; ------------------- -- Initialize_68 -- ------------------- procedure Initialize_68 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_68; ------------------- -- Initialize_69 -- ------------------- procedure Initialize_69 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_69; ------------------- -- Initialize_70 -- ------------------- procedure Initialize_70 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_70; ------------------- -- Initialize_71 -- ------------------- procedure Initialize_71 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_71; ------------------- -- Initialize_72 -- ------------------- procedure Initialize_72 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_72; ------------------- -- Initialize_73 -- ------------------- procedure Initialize_73 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_73; ------------------- -- Initialize_74 -- ------------------- procedure Initialize_74 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_74; ------------------- -- Initialize_75 -- ------------------- procedure Initialize_75 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_75; ------------------- -- Initialize_76 -- ------------------- procedure Initialize_76 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_76; ------------------- -- Initialize_77 -- ------------------- procedure Initialize_77 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_77; ------------------- -- Initialize_78 -- ------------------- procedure Initialize_78 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_78; ------------------- -- Initialize_79 -- ------------------- procedure Initialize_79 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_79; ------------------- -- Initialize_80 -- ------------------- procedure Initialize_80 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_80; ------------------- -- Initialize_81 -- ------------------- procedure Initialize_81 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_81; ------------------- -- Initialize_82 -- ------------------- procedure Initialize_82 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_82; ------------------- -- Initialize_83 -- ------------------- procedure Initialize_83 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_83; ------------------- -- Initialize_84 -- ------------------- procedure Initialize_84 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_84; ------------------- -- Initialize_85 -- ------------------- procedure Initialize_85 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_85; ------------------- -- Initialize_86 -- ------------------- procedure Initialize_86 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_86; ------------------- -- Initialize_87 -- ------------------- procedure Initialize_87 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_87; ------------------- -- Initialize_88 -- ------------------- procedure Initialize_88 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_88; ------------------- -- Initialize_89 -- ------------------- procedure Initialize_89 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_89; ------------------- -- Initialize_90 -- ------------------- procedure Initialize_90 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_90; ------------------- -- Initialize_91 -- ------------------- procedure Initialize_91 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_91; ------------------- -- Initialize_92 -- ------------------- procedure Initialize_92 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_92; ------------------- -- Initialize_93 -- ------------------- procedure Initialize_93 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_93; ------------------- -- Initialize_94 -- ------------------- procedure Initialize_94 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_94; ------------------- -- Initialize_95 -- ------------------- procedure Initialize_95 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_95; ------------------- -- Initialize_96 -- ------------------- procedure Initialize_96 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_96; ------------------- -- Initialize_97 -- ------------------- procedure Initialize_97 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_97; ------------------- -- Initialize_98 -- ------------------- procedure Initialize_98 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_98; ------------------- -- Initialize_99 -- ------------------- procedure Initialize_99 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_99; -------------------- -- Initialize_100 -- -------------------- procedure Initialize_100 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_100; -------------------- -- Initialize_101 -- -------------------- procedure Initialize_101 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_101; -------------------- -- Initialize_102 -- -------------------- procedure Initialize_102 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_102; -------------------- -- Initialize_103 -- -------------------- procedure Initialize_103 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_103; -------------------- -- Initialize_104 -- -------------------- procedure Initialize_104 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_104; -------------------- -- Initialize_105 -- -------------------- procedure Initialize_105 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_105; -------------------- -- Initialize_106 -- -------------------- procedure Initialize_106 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_106; -------------------- -- Initialize_107 -- -------------------- procedure Initialize_107 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_107; -------------------- -- Initialize_108 -- -------------------- procedure Initialize_108 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_108; -------------------- -- Initialize_109 -- -------------------- procedure Initialize_109 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_109; -------------------- -- Initialize_110 -- -------------------- procedure Initialize_110 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_110; -------------------- -- Initialize_111 -- -------------------- procedure Initialize_111 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_111; -------------------- -- Initialize_112 -- -------------------- procedure Initialize_112 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_112; -------------------- -- Initialize_113 -- -------------------- procedure Initialize_113 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_113; -------------------- -- Initialize_114 -- -------------------- procedure Initialize_114 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_114; -------------------- -- Initialize_115 -- -------------------- procedure Initialize_115 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_115; -------------------- -- Initialize_116 -- -------------------- procedure Initialize_116 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_116; -------------------- -- Initialize_117 -- -------------------- procedure Initialize_117 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_117; -------------------- -- Initialize_118 -- -------------------- procedure Initialize_118 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_118; -------------------- -- Initialize_119 -- -------------------- procedure Initialize_119 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_119; -------------------- -- Initialize_120 -- -------------------- procedure Initialize_120 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_120; -------------------- -- Initialize_121 -- -------------------- procedure Initialize_121 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_121; -------------------- -- Initialize_122 -- -------------------- procedure Initialize_122 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_122; -------------------- -- Initialize_123 -- -------------------- procedure Initialize_123 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_123; -------------------- -- Initialize_124 -- -------------------- procedure Initialize_124 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_124; -------------------- -- Initialize_125 -- -------------------- procedure Initialize_125 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_125; -------------------- -- Initialize_126 -- -------------------- procedure Initialize_126 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_126; -------------------- -- Initialize_127 -- -------------------- procedure Initialize_127 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_127; -------------------- -- Initialize_128 -- -------------------- procedure Initialize_128 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_128; -------------------- -- Initialize_129 -- -------------------- procedure Initialize_129 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_129; -------------------- -- Initialize_130 -- -------------------- procedure Initialize_130 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_130; -------------------- -- Initialize_131 -- -------------------- procedure Initialize_131 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_131; -------------------- -- Initialize_132 -- -------------------- procedure Initialize_132 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Association; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_132; -------------------- -- Initialize_133 -- -------------------- procedure Initialize_133 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Package; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_133; -------------------- -- Initialize_134 -- -------------------- procedure Initialize_134 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_134; -------------------- -- Initialize_135 -- -------------------- procedure Initialize_135 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_135; -------------------- -- Initialize_136 -- -------------------- procedure Initialize_136 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_136; -------------------- -- Initialize_137 -- -------------------- procedure Initialize_137 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_137; -------------------- -- Initialize_138 -- -------------------- procedure Initialize_138 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_138; -------------------- -- Initialize_139 -- -------------------- procedure Initialize_139 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_139; -------------------- -- Initialize_140 -- -------------------- procedure Initialize_140 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Enumeration_Literal; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_140; -------------------- -- Initialize_141 -- -------------------- procedure Initialize_141 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_141; -------------------- -- Initialize_142 -- -------------------- procedure Initialize_142 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_142; -------------------- -- Initialize_143 -- -------------------- procedure Initialize_143 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_143; -------------------- -- Initialize_144 -- -------------------- procedure Initialize_144 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_144; -------------------- -- Initialize_145 -- -------------------- procedure Initialize_145 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_145; -------------------- -- Initialize_146 -- -------------------- procedure Initialize_146 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_146; -------------------- -- Initialize_147 -- -------------------- procedure Initialize_147 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_147; -------------------- -- Initialize_148 -- -------------------- procedure Initialize_148 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_148; -------------------- -- Initialize_149 -- -------------------- procedure Initialize_149 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_149; -------------------- -- Initialize_150 -- -------------------- procedure Initialize_150 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_150; -------------------- -- Initialize_151 -- -------------------- procedure Initialize_151 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_151; -------------------- -- Initialize_152 -- -------------------- procedure Initialize_152 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_152; -------------------- -- Initialize_153 -- -------------------- procedure Initialize_153 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_153; -------------------- -- Initialize_154 -- -------------------- procedure Initialize_154 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_154; -------------------- -- Initialize_155 -- -------------------- procedure Initialize_155 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_155; -------------------- -- Initialize_156 -- -------------------- procedure Initialize_156 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_156; -------------------- -- Initialize_157 -- -------------------- procedure Initialize_157 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_157; -------------------- -- Initialize_158 -- -------------------- procedure Initialize_158 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_158; -------------------- -- Initialize_159 -- -------------------- procedure Initialize_159 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_159; -------------------- -- Initialize_160 -- -------------------- procedure Initialize_160 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_160; -------------------- -- Initialize_161 -- -------------------- procedure Initialize_161 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_161; -------------------- -- Initialize_162 -- -------------------- procedure Initialize_162 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_162; -------------------- -- Initialize_163 -- -------------------- procedure Initialize_163 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_163; -------------------- -- Initialize_164 -- -------------------- procedure Initialize_164 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_164; -------------------- -- Initialize_165 -- -------------------- procedure Initialize_165 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_165; -------------------- -- Initialize_166 -- -------------------- procedure Initialize_166 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_166; -------------------- -- Initialize_167 -- -------------------- procedure Initialize_167 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_167; -------------------- -- Initialize_168 -- -------------------- procedure Initialize_168 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_168; -------------------- -- Initialize_169 -- -------------------- procedure Initialize_169 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_169; -------------------- -- Initialize_170 -- -------------------- procedure Initialize_170 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_170; -------------------- -- Initialize_171 -- -------------------- procedure Initialize_171 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_171; -------------------- -- Initialize_172 -- -------------------- procedure Initialize_172 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_172; -------------------- -- Initialize_173 -- -------------------- procedure Initialize_173 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_173; -------------------- -- Initialize_174 -- -------------------- procedure Initialize_174 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_174; -------------------- -- Initialize_175 -- -------------------- procedure Initialize_175 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_175; -------------------- -- Initialize_176 -- -------------------- procedure Initialize_176 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_176; -------------------- -- Initialize_177 -- -------------------- procedure Initialize_177 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_177; -------------------- -- Initialize_178 -- -------------------- procedure Initialize_178 (Extent : AMF.Internals.AMF_Extent) is Aux : AMF.Internals.CMOF_Element; begin Aux := AMF.Internals.Tables.CMOF_Constructors.Create_CMOF_Property; AMF.Internals.Extents.Internal_Append (Extent, Aux); end Initialize_178; end AMF.Internals.Tables.OCL_Metamodel.Objects;
gerr135/ada_composition
Ada
2,866
adb
package body Iface_Lists.dynamic is overriding function Element_Constant_Reference (Container : aliased in List; Index : Index_Type) return Constant_Reference_Type is CVR : ACV.Constant_Reference_Type := Container.vec.Constant_Reference(Index); R : Constant_Reference_Type(CVR.Element); begin return R; end; overriding function Element_Constant_Reference (Container : aliased in List; Position : Cursor) return Constant_Reference_Type is begin return Element_Constant_Reference(Container, Position.Index); end; overriding function Element_Reference (Container : aliased in out List; Index : Index_Type) return Reference_Type is VR : ACV.Reference_Type := Container.vec.Reference(Index); R : Reference_Type(VR.Element); begin return R; end; overriding function Element_Reference (Container : aliased in out List; Position : Cursor) return Reference_Type is begin return Element_Reference(Container, Position.Index); end; function To_Vector (Length : Index_Type) return List is L : List := (vec => ACV.To_Vector(Ada.Containers.Count_Type(Length))); begin return L; end; overriding function Iterate (Container : in List) return Iterator_Interface'Class is It : Iterator := (Container'Unrestricted_Access, Index_Base'First); begin return It; end; function Has_Element (L : List; Position : Index_Base) return Boolean is begin return ACV.Has_Element(L.vec.To_Cursor(Position)); end; overriding function First (Object : Iterator) return Cursor is C : Cursor := (Object.Container, Index_Type'First); begin return C; end; overriding function Last (Object : Iterator) return Cursor is C : Cursor := (Object.Container, List(Object.Container.all).vec.Last_Index); begin return C; end; overriding function Next (Object : Iterator; Position : Cursor) return Cursor is C : Cursor := (Object.Container, Position.Index + 1); begin return C; end; overriding function Previous (Object : Iterator; Position : Cursor) return Cursor is C : Cursor := (Object.Container, Position.Index - 1); begin return C; end; overriding function Length (Container : aliased in out List) return Index_Base is begin return Index_Base(Container.vec.Length); end; overriding function First_Index(Container : aliased in out List) return Index_Type is begin return Index_Type'First; end; overriding function Last_Index (Container : aliased in out List) return Index_Type is begin return Index_Type'First + Index_Base(Container.vec.Length) - 1; end; end Iface_Lists.dynamic;
BrickBot/Bound-T-H8-300
Ada
3,980
ads
-- Calling.Plain (decl) -- -- A fully static and plain-vanilla calling protocol. -- -- A component of the Bound-T Worst-Case Execution Time Tool. -- ------------------------------------------------------------------------------- -- Copyright (c) 1999 .. 2015 Tidorum Ltd -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- 1. Redistributions of source code must retain the above copyright notice, this -- list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above copyright notice, -- this list of conditions and the following disclaimer in the documentation -- and/or other materials provided with the distribution. -- -- This software is provided by the copyright holders and contributors "as is" and -- any express or implied warranties, including, but not limited to, the implied -- warranties of merchantability and fitness for a particular purpose are -- disclaimed. In no event shall the copyright owner or contributors be liable for -- any direct, indirect, incidental, special, exemplary, or consequential damages -- (including, but not limited to, procurement of substitute goods or services; -- loss of use, data, or profits; or business interruption) however caused and -- on any theory of liability, whether in contract, strict liability, or tort -- (including negligence or otherwise) arising in any way out of the use of this -- software, even if advised of the possibility of such damage. -- -- Other modules (files) of this software composition should contain their -- own copyright statements, which may have different copyright and usage -- conditions. The above conditions apply to this file. ------------------------------------------------------------------------------- -- -- $Revision: 1.4 $ -- $Date: 2015/10/24 19:36:48 $ -- -- $Log: calling-plain.ads,v $ -- Revision 1.4 2015/10/24 19:36:48 niklas -- Moved to free licence. -- -- Revision 1.3 2007-08-20 12:17:26 niklas -- Made Protocol_T abstract to avoid overriding Sure_Invariant here. -- -- Revision 1.2 2006/02/27 09:18:46 niklas -- Changed Protocol_T to derive from Static_Protocol_T, which -- means that some inherited operations are valid as such and -- need not be overridden. -- -- Revision 1.1 2005/02/23 09:05:16 niklas -- BT-CH-0005. -- with Programs; with Storage; with Storage.Bounds; package Calling.Plain is type Protocol_T is abstract new Calling.Static_Protocol_T with record Program : Programs.Program_T; end record; -- -- A calling protocol that has no dynamically mapped cells and -- considers all stack-height cells invariant but others not. -- -- Program -- The program in which the protocol occurs. -- The Height cells of Programs.Stacks (Program) are -- invariant across a call, other cells not. -- The Static function is inherited; it returns True. function Image (Item : Protocol_T) return String; -- -- Returns "Plain". function Map_Kind ( Callee : Storage.Cell_T; Under : Protocol_T) return Map_Kind_T; -- -- Returns Fixed except if Callee is a Stack Height cell, because -- the Plain Protocol does not transform cells. Returns Privy for -- any Stack Height cell. -- -- Overrides (implements) Map_Kind (Calling.Protocol_T). -- The Invariant function is inherited. Thus, only the Stack Height -- cells are defined as invariant under the Plain.Protocol_T. function Caller_Cell ( Callee : Storage.Cell_T; Under : Protocol_T) return Storage.Cell_T; -- -- Returns the Callee cell, because that's the way the Plain -- Protocol works (Fixed mapping). -- -- Overrides (implements) Caller_Cell (Calling.Protocol_T). -- The Apply function is inherited and sets Giving to null -- and does nothing else. end Calling.Plain;
zhmu/ananas
Ada
6,246
adb
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . P A C K _ 4 3 -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Storage_Elements; with System.Unsigned_Types; package body System.Pack_43 is subtype Bit_Order is System.Bit_Order; Reverse_Bit_Order : constant Bit_Order := Bit_Order'Val (1 - Bit_Order'Pos (System.Default_Bit_Order)); subtype Ofs is System.Storage_Elements.Storage_Offset; subtype Uns is System.Unsigned_Types.Unsigned; subtype N07 is System.Unsigned_Types.Unsigned range 0 .. 7; use type System.Storage_Elements.Storage_Offset; use type System.Unsigned_Types.Unsigned; type Cluster is record E0, E1, E2, E3, E4, E5, E6, E7 : Bits_43; end record; for Cluster use record E0 at 0 range 0 * Bits .. 0 * Bits + Bits - 1; E1 at 0 range 1 * Bits .. 1 * Bits + Bits - 1; E2 at 0 range 2 * Bits .. 2 * Bits + Bits - 1; E3 at 0 range 3 * Bits .. 3 * Bits + Bits - 1; E4 at 0 range 4 * Bits .. 4 * Bits + Bits - 1; E5 at 0 range 5 * Bits .. 5 * Bits + Bits - 1; E6 at 0 range 6 * Bits .. 6 * Bits + Bits - 1; E7 at 0 range 7 * Bits .. 7 * Bits + Bits - 1; end record; for Cluster'Size use Bits * 8; for Cluster'Alignment use Integer'Min (Standard'Maximum_Alignment, 1 + 1 * Boolean'Pos (Bits mod 2 = 0) + 2 * Boolean'Pos (Bits mod 4 = 0)); -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. type Cluster_Ref is access Cluster; type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; type Rev_Cluster_Ref is access Rev_Cluster; ------------ -- Get_43 -- ------------ function Get_43 (Arr : System.Address; N : Natural; Rev_SSO : Boolean) return Bits_43 is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : Cluster_Ref with Address => A'Address, Import; RC : Rev_Cluster_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => return RC.E0; when 1 => return RC.E1; when 2 => return RC.E2; when 3 => return RC.E3; when 4 => return RC.E4; when 5 => return RC.E5; when 6 => return RC.E6; when 7 => return RC.E7; end case; else case N07 (Uns (N) mod 8) is when 0 => return C.E0; when 1 => return C.E1; when 2 => return C.E2; when 3 => return C.E3; when 4 => return C.E4; when 5 => return C.E5; when 6 => return C.E6; when 7 => return C.E7; end case; end if; end Get_43; ------------ -- Set_43 -- ------------ procedure Set_43 (Arr : System.Address; N : Natural; E : Bits_43; Rev_SSO : Boolean) is A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); C : Cluster_Ref with Address => A'Address, Import; RC : Rev_Cluster_Ref with Address => A'Address, Import; begin if Rev_SSO then case N07 (Uns (N) mod 8) is when 0 => RC.E0 := E; when 1 => RC.E1 := E; when 2 => RC.E2 := E; when 3 => RC.E3 := E; when 4 => RC.E4 := E; when 5 => RC.E5 := E; when 6 => RC.E6 := E; when 7 => RC.E7 := E; end case; else case N07 (Uns (N) mod 8) is when 0 => C.E0 := E; when 1 => C.E1 := E; when 2 => C.E2 := E; when 3 => C.E3 := E; when 4 => C.E4 := E; when 5 => C.E5 := E; when 6 => C.E6 := E; when 7 => C.E7 := E; end case; end if; end Set_43; end System.Pack_43;
francesco-bongiovanni/ewok-kernel
Ada
4,537
ads
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with applications; use applications; with ewok.perm_auto; with ewok.tasks_shared; use ewoK.tasks_shared; package ewok.perm with spark_mode => on is --------------- -- Types -- --------------- type t_perm_name is (PERM_RES_DEV_DMA, PERM_RES_DEV_CRYPTO_USR, PERM_RES_DEV_CRYPTO_CFG, PERM_RES_DEV_CRYPTO_FULL, PERM_RES_DEV_BUSES, PERM_RES_DEV_EXTI, PERM_RES_DEV_TIM, PERM_RES_TIM_GETMILLI, PERM_RES_TIM_GETMICRO, PERM_RES_TIM_GETCYCLE, PERM_RES_TSK_FISR, PERM_RES_TSK_FIPC, PERM_RES_TSK_RESET, PERM_RES_TSK_UPGRADE, PERM_RES_MEM_DYNAMIC_MAP); --------------- -- Functions -- --------------- -- -- \brief test if a task is allow to declare a DMA SHM with another task -- -- Here we are based on a symetric paradigm (i.e. when a -- task is allowed to declare a DMA SHM with another task, the other -- task is allowed to host a DMA SHM from it). Nonetheless it -- is still an half duplex communication channel (DMA SHM are -- read-only or write-only, accessible only by the DMA controler -- and never mapped into the task memory slot). -- -- \param[in] from the task which want to declare a DMA SHM -- \param[in] tto the task target of the DMA SHM peering -- -- \return true if the permission is granted, of false -- function dmashm_is_granted (from : in t_real_task_id; to : in t_real_task_id) return boolean with Global => null, -- com_dmashm_perm is a constant, not a variable Post => (if (from = to) then dmashm_is_granted'Result = false), Contract_Cases => (ewok.perm_auto.com_dmashm_perm(from,to) => dmashm_is_granted'Result, others => not dmashm_is_granted'Result); -- -- \brief test if a task is allow to send an IPC to another task -- -- Here we are based on a symetric paradigm (i.e. when a -- task is allowed to send an IPC to another task, the other -- task is allowed to receive an IPC from it). Nonetheless it -- is still an half duplex communication channel. -- -- \param[in] from the task which want to send an IPC data -- \param[in] tto the task target of the IPC -- -- \return true if the permission is granted, of false -- function ipc_is_granted (from : in t_real_task_id; to : in t_real_task_id) return boolean with Global => null, -- com_ipc_perm is a constant, not a variable Post => (if (from = to) then ipc_is_granted'Result = false), Contract_Cases => (ewok.perm_auto.com_ipc_perm(from,to) => ipc_is_granted'Result, others => not ipc_is_granted'Result); #if CONFIG_KERNEL_DOMAIN function is_same_domain (from : in t_real_task_id; to : in t_real_task_id) return boolean with Global => null, Post => (if (from = to) then is_same_domain'Result = false); #end if; -- -- \brief test if the ressource is allowed for the task -- -- A typical example of such an API is the following: -- if (!perm_ressource_is_granted(PERM_RES_DEV_DMA, mytask)) { -- goto ret_denied; -- } -- -- \param[in] perm_name the name of the permission -- \param[in] task the task requiring the permission -- -- \return true if the permission is granted, of false -- function ressource_is_granted (perm_name : in t_perm_name; task_id : in applications.t_real_task_id) return boolean with Global => (Input => ewok.perm_auto.ressource_perm_register_tab); end ewok.perm;
twdroeger/ada-awa
Ada
4,649
adb
----------------------------------------------------------------------- -- awa-counters-components -- Counter UI component -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Beans.Objects; with Util.Beans.Basic; with AWA.Counters.Beans; with ASF.Components.Base; with ASF.Views.Nodes; with ASF.Utils; with ASF.Contexts.Writer; package body AWA.Counters.Components is TEXT_ATTRIBUTE_NAMES : Util.Strings.String_Set.Set; function Create_Counter return ASF.Components.Base.UIComponent_Access; -- ------------------------------ -- Create a UICounter component. -- ------------------------------ function Create_Counter return ASF.Components.Base.UIComponent_Access is begin return new UICounter; end Create_Counter; URI : aliased constant String := "http://code.google.com/p/ada-awa/jsf"; COUNTER_TAG : aliased constant String := "counter"; AWA_Bindings : aliased constant ASF.Factory.Binding_Array := (1 => (Name => COUNTER_TAG'Access, Component => Create_Counter'Access, Tag => ASF.Views.Nodes.Create_Component_Node'Access) ); AWA_Factory : aliased constant ASF.Factory.Factory_Bindings := (URI => URI'Access, Bindings => AWA_Bindings'Access); -- ------------------------------ -- Get the AWA Counter component factory. -- ------------------------------ function Definition return ASF.Factory.Factory_Bindings_Access is begin return AWA_Factory'Access; end Definition; -- ------------------------------ -- Check if the counter value is hidden. -- ------------------------------ function Is_Hidden (UI : in UICounter; Context : in ASF.Contexts.Faces.Faces_Context'Class) return Boolean is Value : constant Util.Beans.Objects.Object := UI.Get_Attribute (Context, "hidden"); begin return Util.Beans.Objects.To_Boolean (Value); end Is_Hidden; -- ------------------------------ -- Render the counter component. Starts the DL/DD list and write the input -- component with the possible associated error message. -- ------------------------------ overriding procedure Encode_Begin (UI : in UICounter; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is begin if not UI.Is_Rendered (Context) then return; end if; declare Value : constant Util.Beans.Objects.Object := UI.Get_Attribute (Context, "value"); Bean : constant access Util.Beans.Basic.Readonly_Bean'Class := Util.Beans.Objects.To_Bean (Value); Writer : constant ASF.Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer; Counter : AWA.Counters.Beans.Counter_Bean_Access; begin if Bean = null then ASF.Components.Base.Log_Error (UI, "There is no counter bean value"); return; elsif not (Bean.all in AWA.Counters.Beans.Counter_Bean'Class) then ASF.Components.Base.Log_Error (UI, "The bean value is not a Counter_Bean"); return; end if; Counter := AWA.Counters.Beans.Counter_Bean'Class (Bean.all)'Unchecked_Access; -- Increment the counter associated with the optional key. AWA.Counters.Increment (Counter => Counter.Counter, Key => Counter.Object); -- Render the counter within an optional <span>. if Counter.Value >= 0 and not UI.Is_Hidden (Context) then Writer.Start_Optional_Element ("span"); UI.Render_Attributes (Context, TEXT_ATTRIBUTE_NAMES, Writer); Writer.Write_Text (Integer'Image (Counter.Value)); Writer.End_Optional_Element ("span"); end if; end; end Encode_Begin; begin ASF.Utils.Set_Text_Attributes (TEXT_ATTRIBUTE_NAMES); end AWA.Counters.Components;
reznikmm/matreshka
Ada
3,789
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Attributes; package ODF.DOM.Draw_Extrusion_Rotation_Center_Attributes is pragma Preelaborate; type ODF_Draw_Extrusion_Rotation_Center_Attribute is limited interface and XML.DOM.Attributes.DOM_Attribute; type ODF_Draw_Extrusion_Rotation_Center_Attribute_Access is access all ODF_Draw_Extrusion_Rotation_Center_Attribute'Class with Storage_Size => 0; end ODF.DOM.Draw_Extrusion_Rotation_Center_Attributes;
reznikmm/matreshka
Ada
12,153
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Internals.OCL_Elements; with AMF.OCL.Real_Literal_Exps; with AMF.UML.Comments.Collections; with AMF.UML.Dependencies.Collections; with AMF.UML.Elements.Collections; with AMF.UML.Named_Elements; with AMF.UML.Namespaces.Collections; with AMF.UML.Packages.Collections; with AMF.UML.String_Expressions; with AMF.UML.Types; with AMF.Visitors; package AMF.Internals.OCL_Real_Literal_Exps is type OCL_Real_Literal_Exp_Proxy is limited new AMF.Internals.OCL_Elements.OCL_Element_Proxy and AMF.OCL.Real_Literal_Exps.OCL_Real_Literal_Exp with null record; overriding function Get_Real_Symbol (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return AMF.Real; -- Getter of RealLiteralExp::realSymbol. -- overriding procedure Set_Real_Symbol (Self : not null access OCL_Real_Literal_Exp_Proxy; To : AMF.Real); -- Setter of RealLiteralExp::realSymbol. -- overriding function Get_Type (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return AMF.UML.Types.UML_Type_Access; -- Getter of TypedElement::type. -- -- The type of the TypedElement. -- This information is derived from the return result for this Operation. overriding procedure Set_Type (Self : not null access OCL_Real_Literal_Exp_Proxy; To : AMF.UML.Types.UML_Type_Access); -- Setter of TypedElement::type. -- -- The type of the TypedElement. -- This information is derived from the return result for this Operation. overriding function Get_Client_Dependency (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency; -- Getter of NamedElement::clientDependency. -- -- Indicates the dependencies that reference the client. overriding function Get_Name (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return AMF.Optional_String; -- Getter of NamedElement::name. -- -- The name of the NamedElement. overriding procedure Set_Name (Self : not null access OCL_Real_Literal_Exp_Proxy; To : AMF.Optional_String); -- Setter of NamedElement::name. -- -- The name of the NamedElement. overriding function Get_Name_Expression (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return AMF.UML.String_Expressions.UML_String_Expression_Access; -- Getter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding procedure Set_Name_Expression (Self : not null access OCL_Real_Literal_Exp_Proxy; To : AMF.UML.String_Expressions.UML_String_Expression_Access); -- Setter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. overriding function Get_Namespace (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Getter of NamedElement::namespace. -- -- Specifies the namespace that owns the NamedElement. overriding function Get_Qualified_Name (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return AMF.Optional_String; -- Getter of NamedElement::qualifiedName. -- -- A name which allows the NamedElement to be identified within a -- hierarchy of nested Namespaces. It is constructed from the names of the -- containing namespaces starting at the root of the hierarchy and ending -- with the name of the NamedElement itself. overriding function Get_Visibility (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return AMF.UML.Optional_UML_Visibility_Kind; -- Getter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. overriding procedure Set_Visibility (Self : not null access OCL_Real_Literal_Exp_Proxy; To : AMF.UML.Optional_UML_Visibility_Kind); -- Setter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. overriding function Get_Owned_Comment (Self : not null access constant OCL_Real_Literal_Exp_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 OCL_Real_Literal_Exp_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 OCL_Real_Literal_Exp_Proxy) return AMF.UML.Elements.UML_Element_Access; -- Getter of Element::owner. -- -- The Element that owns this element. overriding function All_Namespaces (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace; -- Operation NamedElement::allNamespaces. -- -- The query allNamespaces() gives the sequence of namespaces in which the -- NamedElement is nested, working outwards. overriding function All_Owning_Packages (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return AMF.UML.Packages.Collections.Set_Of_UML_Package; -- Operation NamedElement::allOwningPackages. -- -- The query allOwningPackages() returns all the directly or indirectly -- owning packages. overriding function Is_Distinguishable_From (Self : not null access constant OCL_Real_Literal_Exp_Proxy; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean; -- Operation NamedElement::isDistinguishableFrom. -- -- The query isDistinguishableFrom() determines whether two NamedElements -- may logically co-exist within a Namespace. By default, two named -- elements are distinguishable if (a) they have unrelated types or (b) -- they have related types but different names. overriding function Namespace (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return AMF.UML.Namespaces.UML_Namespace_Access; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace overriding function Qualified_Name (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return League.Strings.Universal_String; -- Operation NamedElement::qualifiedName. -- -- When there is a name, and all of the containing namespaces have a name, -- the qualified name is constructed from the names of the containing -- namespaces. overriding function Separator (Self : not null access constant OCL_Real_Literal_Exp_Proxy) return League.Strings.Universal_String; -- Operation NamedElement::separator. -- -- The query separator() gives the string that is used to separate names -- when constructing a qualified name. overriding function All_Owned_Elements (Self : not null access constant OCL_Real_Literal_Exp_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 OCL_Real_Literal_Exp_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 OCL_Real_Literal_Exp_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Leave_Element (Self : not null access constant OCL_Real_Literal_Exp_Proxy; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); overriding procedure Visit_Element (Self : not null access constant OCL_Real_Literal_Exp_Proxy; Iterator : in out AMF.Visitors.Abstract_Iterator'Class; Visitor : in out AMF.Visitors.Abstract_Visitor'Class; Control : in out AMF.Visitors.Traverse_Control); end AMF.Internals.OCL_Real_Literal_Exps;
zhmu/ananas
Ada
134
adb
-- { dg-do compile } -- { dg-options "-g" } with debug1; use debug1; procedure test_debug1 is Blob : Meta_Data; begin null; end;
reznikmm/matreshka
Ada
4,647
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Draw.Extrusion_Depth_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Extrusion_Depth_Attribute_Node is begin return Self : Draw_Extrusion_Depth_Attribute_Node do Matreshka.ODF_Draw.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Draw_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Draw_Extrusion_Depth_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Extrusion_Depth_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Draw_URI, Matreshka.ODF_String_Constants.Extrusion_Depth_Attribute, Draw_Extrusion_Depth_Attribute_Node'Tag); end Matreshka.ODF_Draw.Extrusion_Depth_Attributes;
zhmu/ananas
Ada
252
ads
package Opt90a_Pkg is type Rec is record A : Short_Short_Integer; B : Integer; C : String (1 .. 12); end record; pragma Pack (Rec); for Rec'Alignment use 1; type Data is tagged record R : Rec; end record; end Opt90a_Pkg;
rveenker/sdlada
Ada
7,357
adb
-- ----------------------------------------------------------------- -- -- AdaSDL -- -- Thin binding to Simple Direct Media Layer -- -- Copyright (C) 2000-2012 A.M.F.Vargas -- -- Antonio M. M. Ferreira Vargas -- -- Manhente - Barcelos - Portugal -- -- http://adasdl.sourceforge.net -- -- E-mail: [email protected] -- -- ----------------------------------------------------------------- -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public -- -- License as published by the Free Software Foundation; either -- -- version 2 of the License, or (at your option) any later version. -- -- -- -- This 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 -- -- General Public License for more details. -- -- -- -- You should have received a copy of the GNU General Public -- -- License along with this library; if not, write to the -- -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- -- Boston, MA 02111-1307, USA. -- -- -- -- 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. -- -- ----------------------------------------------------------------- -- package body SDL.Types is -- =================================================================== -- generic -- type Data_Type is private; -- type Amount_Type is private; -- function Shift_Left ( -- Data : Data_Type; -- Amount : Amount_Type) return Data_Type; -- function Shift_Left ( -- Value : Value_Type; -- Amount : Amount_Type) return Data_Type -- is -- use Interfaces; -- begin -- return Uint8 (Shift_Left (Unsigned_8 (Value), Amount)); -- end Shift_Left; -- =================================================================== function Shift_Left ( Value : Uint8; Amount : Integer) return Uint8 is use Interfaces; begin return Uint8 (Shift_Left (Unsigned_8 (Value), Amount)); end Shift_Left; -- =================================================================== function Shift_Right ( Value : Uint8; Amount : Integer) return Uint8 is use Interfaces; begin return Uint8 (Shift_Right (Unsigned_8 (Value), Amount)); end Shift_Right; -- =================================================================== function Shift_Left ( Value : Uint16; Amount : Integer) return Uint16 is use Interfaces; begin return Uint16 (Shift_Left (Unsigned_16 (Value), Amount)); end Shift_Left; -- =================================================================== function Shift_Right ( Value : Uint16; Amount : Integer) return Uint16 is use Interfaces; begin return Uint16 (Shift_Right (Unsigned_16 (Value), Amount)); end Shift_Right; -- =================================================================== function Shift_Left ( Value : Uint32; Amount : Integer) return Uint32 is use Interfaces; begin return Uint32 (Shift_Left (Unsigned_32 (Value), Amount)); end Shift_Left; -- =================================================================== function Shift_Right ( Value : Uint32; Amount : Integer) return Uint32 is use Interfaces; begin return Uint32 (Shift_Right (Unsigned_32 (Value), Amount)); end Shift_Right; -- =================================================================== function Increment ( Pointer : Uint8_Ptrs.Object_Pointer; Amount : Natural) return Uint8_Ptrs.Object_Pointer is use Uint8_PtrOps; begin return Uint8_Ptrs.Object_Pointer ( Uint8_PtrOps.Pointer (Pointer) + C.ptrdiff_t (Amount)); end Increment; -- =================================================================== function Decrement ( Pointer : Uint8_Ptrs.Object_Pointer; Amount : Natural) return Uint8_Ptrs.Object_Pointer is use Uint8_PtrOps; begin return Uint8_Ptrs.Object_Pointer ( Uint8_PtrOps.Pointer (Pointer) - C.ptrdiff_t (Amount)); end Decrement; -- =================================================================== function Increment ( Pointer : Uint16_Ptrs.Object_Pointer; Amount : Natural) return Uint16_Ptrs.Object_Pointer is use Uint16_PtrOps; begin return Uint16_Ptrs.Object_Pointer ( Uint16_PtrOps.Pointer (Pointer) + C.ptrdiff_t (Amount)); end Increment; -- =================================================================== function Decrement ( Pointer : Uint16_Ptrs.Object_Pointer; Amount : Natural) return Uint16_Ptrs.Object_Pointer is use Uint16_PtrOps; begin return Uint16_Ptrs.Object_Pointer ( Uint16_PtrOps.Pointer (Pointer) - C.ptrdiff_t (Amount)); end Decrement; -- =================================================================== function Increment ( Pointer : Uint32_Ptrs.Object_Pointer; Amount : Natural) return Uint32_Ptrs.Object_Pointer is use Uint32_PtrOps; begin return Uint32_Ptrs.Object_Pointer ( Uint32_PtrOps.Pointer (Pointer) + C.ptrdiff_t (Amount)); end Increment; -- =================================================================== function Decrement ( Pointer : Uint32_Ptrs.Object_Pointer; Amount : Natural) return Uint32_Ptrs.Object_Pointer is use Uint32_PtrOps; begin return Uint32_Ptrs.Object_Pointer ( Uint32_PtrOps.Pointer (Pointer) - C.ptrdiff_t (Amount)); end Decrement; -- =================================================================== procedure Copy_Array ( Source : Uint8_Ptrs.Object_Pointer; Target : Uint8_Ptrs.Object_Pointer; Lenght : Natural) is begin Uint8_PtrOps.Copy_Array ( Uint8_PtrOps.Pointer (Source), Uint8_PtrOps.Pointer (Target), C.ptrdiff_t (Lenght)); end Copy_Array; -- =================================================================== end SDL.Types;
optikos/oasis
Ada
9,196
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Package_Body_Declarations is function Create (Package_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Body_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Names .Defining_Name_Access; With_Token : Program.Lexical_Elements.Lexical_Element_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Declarations : Program.Element_Vectors.Element_Vector_Access; Begin_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; Exception_Token : Program.Lexical_Elements.Lexical_Element_Access; Exception_Handlers : Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access; End_Token : not null Program.Lexical_Elements .Lexical_Element_Access; End_Name : Program.Elements.Expressions.Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Package_Body_Declaration is begin return Result : Package_Body_Declaration := (Package_Token => Package_Token, Body_Token => Body_Token, Name => Name, With_Token => With_Token, Aspects => Aspects, Is_Token => Is_Token, Declarations => Declarations, Begin_Token => Begin_Token, Statements => Statements, Exception_Token => Exception_Token, Exception_Handlers => Exception_Handlers, End_Token => End_Token, End_Name => End_Name, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Name : not null Program.Elements.Defining_Names .Defining_Name_Access; Aspects : Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access; Declarations : Program.Element_Vectors.Element_Vector_Access; Statements : not null Program.Element_Vectors .Element_Vector_Access; Exception_Handlers : Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access; End_Name : 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_Package_Body_Declaration is begin return Result : Implicit_Package_Body_Declaration := (Name => Name, Aspects => Aspects, Declarations => Declarations, Statements => Statements, Exception_Handlers => Exception_Handlers, End_Name => End_Name, 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 Name (Self : Base_Package_Body_Declaration) return not null Program.Elements.Defining_Names.Defining_Name_Access is begin return Self.Name; end Name; overriding function Aspects (Self : Base_Package_Body_Declaration) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access is begin return Self.Aspects; end Aspects; overriding function Declarations (Self : Base_Package_Body_Declaration) return Program.Element_Vectors.Element_Vector_Access is begin return Self.Declarations; end Declarations; overriding function Statements (Self : Base_Package_Body_Declaration) return not null Program.Element_Vectors.Element_Vector_Access is begin return Self.Statements; end Statements; overriding function Exception_Handlers (Self : Base_Package_Body_Declaration) return Program.Elements.Exception_Handlers .Exception_Handler_Vector_Access is begin return Self.Exception_Handlers; end Exception_Handlers; overriding function End_Name (Self : Base_Package_Body_Declaration) return Program.Elements.Expressions.Expression_Access is begin return Self.End_Name; end End_Name; overriding function Package_Token (Self : Package_Body_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Package_Token; end Package_Token; overriding function Body_Token (Self : Package_Body_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Body_Token; end Body_Token; overriding function With_Token (Self : Package_Body_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.With_Token; end With_Token; overriding function Is_Token (Self : Package_Body_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Is_Token; end Is_Token; overriding function Begin_Token (Self : Package_Body_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Begin_Token; end Begin_Token; overriding function Exception_Token (Self : Package_Body_Declaration) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Exception_Token; end Exception_Token; overriding function End_Token (Self : Package_Body_Declaration) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.End_Token; end End_Token; overriding function Semicolon_Token (Self : Package_Body_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_Package_Body_Declaration) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Package_Body_Declaration) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Package_Body_Declaration) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Package_Body_Declaration'Class) is begin Set_Enclosing_Element (Self.Name, Self'Unchecked_Access); for Item in Self.Aspects.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; for Item in Self.Declarations.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; for Item in Self.Statements.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; for Item in Self.Exception_Handlers.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; if Self.End_Name.Assigned then Set_Enclosing_Element (Self.End_Name, Self'Unchecked_Access); end if; null; end Initialize; overriding function Is_Package_Body_Declaration_Element (Self : Base_Package_Body_Declaration) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Package_Body_Declaration_Element; overriding function Is_Declaration_Element (Self : Base_Package_Body_Declaration) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Declaration_Element; overriding procedure Visit (Self : not null access Base_Package_Body_Declaration; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Package_Body_Declaration (Self); end Visit; overriding function To_Package_Body_Declaration_Text (Self : aliased in out Package_Body_Declaration) return Program.Elements.Package_Body_Declarations .Package_Body_Declaration_Text_Access is begin return Self'Unchecked_Access; end To_Package_Body_Declaration_Text; overriding function To_Package_Body_Declaration_Text (Self : aliased in out Implicit_Package_Body_Declaration) return Program.Elements.Package_Body_Declarations .Package_Body_Declaration_Text_Access is pragma Unreferenced (Self); begin return null; end To_Package_Body_Declaration_Text; end Program.Nodes.Package_Body_Declarations;
mitchelhaan/ncurses
Ada
6,270
adb
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding -- -- -- -- Terminal_Interface.Curses.Panels -- -- -- -- B O D Y -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998 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 <[email protected]> 1996 -- Version Control: -- $Revision: 1.6 $ -- Binding Version 00.93 ------------------------------------------------------------------------------ with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; with Interfaces.C; package body Terminal_Interface.Curses.Panels is use type Interfaces.C.int; function Create (Win : Window) return Panel is function Newpanel (Win : Window) return Panel; pragma Import (C, Newpanel, "new_panel"); Pan : Panel; begin Pan := Newpanel (Win); if Pan = Null_Panel then raise Panel_Exception; end if; return Pan; end Create; procedure Bottom (Pan : in Panel) is function Bottompanel (Pan : Panel) return C_Int; pragma Import (C, Bottompanel, "bottom_panel"); begin if Bottompanel (Pan) = Curses_Err then raise Panel_Exception; end if; end Bottom; procedure Top (Pan : in Panel) is function Toppanel (Pan : Panel) return C_Int; pragma Import (C, Toppanel, "top_panel"); begin if Toppanel (Pan) = Curses_Err then raise Panel_Exception; end if; end Top; procedure Show (Pan : in Panel) is function Showpanel (Pan : Panel) return C_Int; pragma Import (C, Showpanel, "show_panel"); begin if Showpanel (Pan) = Curses_Err then raise Panel_Exception; end if; end Show; procedure Hide (Pan : in Panel) is function Hidepanel (Pan : Panel) return C_Int; pragma Import (C, Hidepanel, "hide_panel"); begin if Hidepanel (Pan) = Curses_Err then raise Panel_Exception; end if; end Hide; function Get_Window (Pan : Panel) return Window is function Panel_Win (Pan : Panel) return Window; pragma Import (C, Panel_Win, "panel_window"); Win : Window := Panel_Win (Pan); begin if Win = Null_Window then raise Panel_Exception; end if; return Win; end Get_Window; procedure Replace (Pan : in Panel; Win : in Window) is function Replace_Pan (Pan : Panel; Win : Window) return C_Int; pragma Import (C, Replace_Pan, "replace_panel"); begin if Replace_Pan (Pan, Win) = Curses_Err then raise Panel_Exception; end if; end Replace; procedure Move (Pan : in Panel; Line : in Line_Position; Column : in Column_Position) is function Move (Pan : Panel; Line : C_Int; Column : C_Int) return C_Int; pragma Import (C, Move, "move_panel"); begin if Move (Pan, C_Int (Line), C_Int (Column)) = Curses_Err then raise Panel_Exception; end if; end Move; function Is_Hidden (Pan : Panel) return Boolean is function Panel_Hidden (Pan : Panel) return C_Int; pragma Import (C, Panel_Hidden, "panel_hidden"); begin if Panel_Hidden (Pan) = Curses_False then return False; else return True; end if; end Is_Hidden; procedure Delete (Pan : in out Panel) is function Del_Panel (Pan : Panel) return C_Int; pragma Import (C, Del_Panel, "del_panel"); begin if Del_Panel (Pan) = Curses_Err then raise Panel_Exception; end if; Pan := Null_Panel; end Delete; end Terminal_Interface.Curses.Panels;
anthony-arnold/AdaID
Ada
4,547
ads
-- (C) Copyright 2000 by John Halleck, All rights reserved. -- Basic Routines of NSA's Secure Hash Algorithm. -- This is part of a project at http://www.cc.utah.edu/~nahaj/ package SHA.Process_Data is -- If you want to accumulate more than one hash at a time, then -- you'll need to specify a context for each accumulation. type Context is private; -- Current state of the operation. -- What we can put in a buffer. type Bit is mod 2 ** 1; type Byte is mod 2 ** 8; type Word is mod 2 ** 16; type Long is mod 2 ** 32; -- I know that this might not agree with the terminology of the -- underlying machine, but I had to call them something. Bytes_In_Block : constant := 64; -- Strictly speaking this is an internal number and I'd never make it -- visible... but the HMAC standard requires knowledge of it for each -- hash function, so I'm exporting it. type Bit_Index is new Natural range 0 .. Bits_In_Word; -- Exceptions we have: SHA_Not_Initialized : exception; -- Buffer given not initialized. SHA_Second_Initialize : exception; -- Second call to initialize. -- without intervening finalize. SHA_Overflow : exception; -- Not defined for more than 2**64 bits -- (So says the standard.) -- I realize that some folk want to just ignore this exception. While not -- strictly allowed by the standard, the standard doesn't give a way to -- get around the restriction. *** SO *** this exception is carefully -- NOT raised UNTIL the full processing of the input is done. So it is -- perfectly safe to catch and ignore this exception. ---------------------------------------------------------------------------- -- Most folk just want to Digest a string, so we will have this entry -- Point to keep it simple. function Digest_A_String (Given : String) return Digest; --------------------------------------------------------------------------- -- For those that want more control, we provide actual entry points. -- Start out the buffer. procedure Initialize; procedure Initialize (Given : in out Context); -- Procedures to add to the data being hashed. The standard really -- does define the hash in terms of bits. So, in opposition to -- common practice, I'm providing routines -- that can process -- Bytes or Non_Bytes. -- I let you freely intermix the sizes, even if it means partial -- word alignment in the actual buffer. procedure Add (Data : Bit); procedure Add (Data : Bit; Given : in out Context); procedure Add (Data : Byte); procedure Add (Data : Byte; Given : in out Context); procedure Add (Data : Word); procedure Add (Data : Word; Given : in out Context); procedure Add (Data : Long); procedure Add (Data : Long; Given : in out Context); -- Add arbitrary sized data. procedure Add (Data : Long; Size : Bit_Index); procedure Add (Data : Long; Size : Bit_Index; Given : in out Context); -- Get the final digest. function Finalize return Digest; procedure Finalize (Result : out Digest); procedure Finalize (Result : out Digest; Given : in out Context); ------------------------------------------------------------------------------ private -- I couldn't think of any advantage to letting people see the details of -- these structures. And some advantage to being able to change the count -- into an Unsigned_64 on machines that support it. Initial_Context : constant Digest := -- Directly from the standard. (16#67452301#, 16#EFCDAB89#, 16#98BADCFE#, 16#10325476#, 16#C3D2E1F0#); Words_In_Buffer : constant := 16; type Word_Range is new Natural range 0 .. Words_In_Buffer - 1; type Data_Buffer is array (Word_Range) of Unsigned_32; type Context is record Data : Data_Buffer := (others => 0); Count_High : Unsigned_32 := 0; Count_Low : Unsigned_32 := 0; Remaining_Bits : Bit_Index := 32; Next_Word : Word_Range := 0; Current : Digest := Initial_Context; Initialized : Boolean := False; end record; Initial_Value : constant Context := ((others => 0), 0, 0, 32, 0, Initial_Context, False); end SHA.Process_Data;
Black-Photon/Programming-Language-of-the-Month
Ada
1,236
adb
with types; package body rod_control is procedure callback (Control_Rods : in out types.Rod_Array; Temperature : types.Kilojoule; Output : types.Kilojoule) is use types; Diff : Kilojoule; Expected : Kilojoule; begin Diff := Temperature - Last_Temp; Diff := Diff * 4; -- Potential temp might increase by as much as 4 times Expected := Temperature + Diff; if Temperature > 500.000 then for i in (Index) loop Control_Rods(i) := 1.0; end loop; elsif Expected > 500.000 then for i in (Index) loop Control_Rods(i) := 0.8; end loop; -- Aim to keep at around 400KJ (20KJ/s return) elsif Expected > 400.000 then for i in (Index) loop Control_Rods(i) := 0.6; end loop; elsif Expected > 250.000 then for i in (Index) loop Control_Rods(i) := 0.3; end loop; elsif Expected > 100.000 then for i in (Index) loop Control_Rods(i) := 0.2; end loop; end if; Last_Temp := Temperature; end callback; begin null; end rod_control;
reznikmm/torrent
Ada
13,296
adb
-- Copyright (c) 2020 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Ada.Calendar; with Ada.Containers.Hashed_Sets; with Ada.Containers.Ordered_Sets; with Ada.Containers.Vectors; with Ada.Exceptions; with Ada.Text_IO; with Ada.Unchecked_Deallocation; with System.Address_To_Access_Conversions; with System.Storage_Elements; with Torrent.Contexts; with Torrent.Handshakes; with Torrent.Logs; package body Torrent.Initiators is procedure Free is new Ada.Unchecked_Deallocation (Torrent.Connections.Connection'Class, Torrent.Connections.Connection_Access); --------------- -- Initiator -- --------------- task body Initiator is use type Ada.Streams.Stream_Element_Offset; type Socket_Connection is record Socket : GNAT.Sockets.Socket_Type; Addr : GNAT.Sockets.Sock_Addr_Type; Job : Torrent.Downloaders.Downloader_Access; end record; package Socket_Connection_Vectors is new Ada.Containers.Vectors (Positive, Socket_Connection); type Planned_Connection is record Time : Ada.Calendar.Time; Addr : GNAT.Sockets.Sock_Addr_Type; Job : Torrent.Downloaders.Downloader_Access; end record; function Less (Left, Right : Planned_Connection) return Boolean; package Planned_Connection_Sets is new Ada.Containers.Ordered_Sets (Element_Type => Planned_Connection, "<" => Less); type Accepted_Connection is record Socket : GNAT.Sockets.Socket_Type; Address : GNAT.Sockets.Sock_Addr_Type; Data : Torrent.Handshakes.Handshake_Image; Last : Ada.Streams.Stream_Element_Count; Done : Boolean; Session : Torrent.Connections.Connection_Access; end record; package Accepted_Connection_Vectors is new Ada.Containers.Vectors (Positive, Accepted_Connection); procedure Accept_Connection (Server : GNAT.Sockets.Socket_Type; Accepted : in out Accepted_Connection_Vectors.Vector); procedure Read_Handshake (Item : in out Accepted_Connection); function Hash (Item : Torrent.Connections.Connection_Access) return Ada.Containers.Hash_Type; package Connection_Sets is new Ada.Containers.Hashed_Sets (Element_Type => Torrent.Connections.Connection_Access, Hash => Hash, Equivalent_Elements => Torrent.Connections."=", "=" => Torrent.Connections."="); function "+" (Value : Torrent.Connections.Connection_Access) return System.Storage_Elements.Integer_Address; --------- -- "+" -- --------- function "+" (Value : Torrent.Connections.Connection_Access) return System.Storage_Elements.Integer_Address is package Conv is new System.Address_To_Access_Conversions (Object => Torrent.Connections.Connection'Class); begin return System.Storage_Elements.To_Integer (Conv.To_Address (Conv.Object_Pointer (Value))); end "+"; ----------------------- -- Accept_Connection -- ----------------------- procedure Accept_Connection (Server : GNAT.Sockets.Socket_Type; Accepted : in out Accepted_Connection_Vectors.Vector) is Address : GNAT.Sockets.Sock_Addr_Type; Socket : GNAT.Sockets.Socket_Type; begin GNAT.Sockets.Accept_Socket (Server, Socket, Address); pragma Debug (Torrent.Logs.Enabled, Torrent.Logs.Print ("Accepted: " & GNAT.Sockets.Image (Address))); GNAT.Sockets.Set_Socket_Option (Socket => Socket, Level => GNAT.Sockets.Socket_Level, Option => (GNAT.Sockets.Receive_Timeout, 0.0)); Accepted.Append ((Socket, Last => 0, Done => False, Address => Address, others => <>)); end Accept_Connection; ---------- -- Hash -- ---------- function Hash (Item : Torrent.Connections.Connection_Access) return Ada.Containers.Hash_Type is begin return Ada.Containers.Hash_Type'Mod (+Item); end Hash; ---------- -- Less -- ---------- function Less (Left, Right : Planned_Connection) return Boolean is use type Ada.Calendar.Time; function "+" (V : GNAT.Sockets.Sock_Addr_Type) return String renames GNAT.Sockets.Image; begin return Left.Time < Right.Time or else (Left.Time = Right.Time and +Left.Addr < +Right.Addr); end Less; -------------------- -- Read_Handshake -- -------------------- procedure Read_Handshake (Item : in out Accepted_Connection) is use Torrent.Handshakes; use type Ada.Streams.Stream_Element; Last : Ada.Streams.Stream_Element_Count; Job : Torrent.Downloaders.Downloader_Access; begin GNAT.Sockets.Receive_Socket (Item.Socket, Item.Data (Item.Last + 1 .. Item.Data'Last), Last); if Last <= Item.Last then Item.Done := True; -- Connection closed elsif Last = Item.Data'Last then declare Value : constant Handshake_Type := -Item.Data; begin Job := Context.Find_Download (Value.Info_Hash); Item.Done := True; if Value.Length = Header'Length and then Value.Head = Header and then Job not in null then Item.Session := Job.Create_Session (Item.Address); Item.Session.Do_Handshake (Item.Socket, Job.Completed, Inbound => True); end if; end; else Item.Last := Last; end if; exception when E : GNAT.Sockets.Socket_Error => if GNAT.Sockets.Resolve_Exception (E) not in GNAT.Sockets.Resource_Temporarily_Unavailable then Item.Done := True; end if; end Read_Handshake; use type Ada.Calendar.Time; Address : constant GNAT.Sockets.Sock_Addr_Type := (GNAT.Sockets.Family_Inet, GNAT.Sockets.Any_Inet_Addr, GNAT.Sockets.Port_Type (Port)); Server : GNAT.Sockets.Socket_Type; Plan : Planned_Connection_Sets.Set; Work : Socket_Connection_Vectors.Vector; Accepted : Accepted_Connection_Vectors.Vector; Inbound : Connection_Sets.Set; Selector : aliased GNAT.Sockets.Selector_Type; Time : Ada.Calendar.Time := Ada.Calendar.Clock + 20.0; W_Set : GNAT.Sockets.Socket_Set_Type; R_Set : GNAT.Sockets.Socket_Set_Type; Session : Torrent.Connections.Connection_Access; begin GNAT.Sockets.Create_Selector (Selector); GNAT.Sockets.Create_Socket (Server); GNAT.Sockets.Bind_Socket (Server, Address); GNAT.Sockets.Listen_Socket (Server); Top_Loop : loop loop select Recycle.Dequeue (Session); if Inbound.Contains (Session) then Inbound.Delete (Session); Free (Session); else Time := Ada.Calendar.Clock; Plan.Insert ((Time + 300.0, Session.Peer, Torrent.Downloaders.Downloader_Access (Session.Downloader))); end if; else exit; end select; end loop; loop select accept Stop; exit Top_Loop; or accept Connect (Downloader : not null Torrent.Downloaders.Downloader_Access; Address : GNAT.Sockets.Sock_Addr_Type) do Time := Ada.Calendar.Clock; Plan.Insert ((Time, Address, Downloader)); end Connect; or delay until Time; exit; end select; end loop; while not Plan.Is_Empty loop declare Ignore : GNAT.Sockets.Selector_Status; First : constant Planned_Connection := Plan.First_Element; Socket : GNAT.Sockets.Socket_Type; begin exit when First.Time > Time; if First.Job.Is_Leacher then pragma Debug (Torrent.Logs.Enabled, Torrent.Logs.Print ("Connecting: " & GNAT.Sockets.Image (First.Addr))); GNAT.Sockets.Create_Socket (Socket); GNAT.Sockets.Connect_Socket (Socket => Socket, Server => First.Addr, Timeout => 0.0, Status => Ignore); Work.Append ((Socket, First.Addr, First.Job)); end if; Plan.Delete_First; end; end loop; GNAT.Sockets.Empty (W_Set); GNAT.Sockets.Empty (R_Set); GNAT.Sockets.Set (R_Set, Server); for J of Accepted loop GNAT.Sockets.Set (R_Set, J.Socket); end loop; for J of Work loop GNAT.Sockets.Set (W_Set, J.Socket); end loop; if GNAT.Sockets.Is_Empty (W_Set) and GNAT.Sockets.Is_Empty (R_Set) then Time := Ada.Calendar.Clock + 20.0; else declare Status : GNAT.Sockets.Selector_Status; begin GNAT.Sockets.Check_Selector (Selector, R_Set, W_Set, Status, Timeout => 0.2); if Status in GNAT.Sockets.Completed then declare J : Positive := 1; begin if GNAT.Sockets.Is_Set (R_Set, Server) then Accept_Connection (Server, Accepted); end if; while J <= Accepted.Last_Index loop if GNAT.Sockets.Is_Set (R_Set, Accepted (J).Socket) then Read_Handshake (Accepted (J)); if Accepted (J).Done then if Accepted (J).Session in null then GNAT.Sockets.Close_Socket (Accepted (J).Socket); else Inbound.Insert (Accepted (J).Session); Context.Connected (Accepted (J).Session); end if; Accepted.Swap (J, Accepted.Last_Index); Accepted.Delete_Last; else J := J + 1; end if; else J := J + 1; end if; end loop; J := 1; while J <= Work.Last_Index loop if GNAT.Sockets.Is_Set (W_Set, Work (J).Socket) then declare Conn : Torrent.Connections.Connection_Access := Work (J).Job.Create_Session (Work (J).Addr); begin Conn.Do_Handshake (Work (J).Socket, Work (J).Job.Completed, Inbound => False); if Conn.Connected then Context.Connected (Conn); else Free (Conn); Plan.Insert ((Time + 300.0, Work (J).Addr, Work (J).Job)); end if; Work.Swap (J, Work.Last_Index); Work.Delete_Last; end; else J := J + 1; end if; end loop; end; end if; Time := Ada.Calendar.Clock + 1.0; end; end if; end loop Top_Loop; exception when E : others => pragma Debug (Torrent.Logs.Enabled, Torrent.Logs.Print ("Initiator: " & Ada.Exceptions.Exception_Information (E))); Ada.Text_IO.Put_Line ("Initiator: " & Ada.Exceptions.Exception_Information (E)); end Initiator; end Torrent.Initiators;
reznikmm/matreshka
Ada
3,669
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Elements; package ODF.DOM.Text_List_Item_Elements is pragma Preelaborate; type ODF_Text_List_Item is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Text_List_Item_Access is access all ODF_Text_List_Item'Class with Storage_Size => 0; end ODF.DOM.Text_List_Item_Elements;
KDE/syntax-highlighting
Ada
5,485
adb
with Ada.Containers.Vectors; with Ada.Strings; use Ada.Strings; with Put_Title; procedure LAL_DDA is Collection : Repinfo_Collection; A_Basic_Record : Basic_Record := Basic_Record'(A => 42); Another_Basic_Record : Basic_Record := (A => 42); Nix : constant Null_Record := (null record); procedure Process_Type_Decl (Decl : Base_Type_Decl); -- Display all representation information that is available in -- ``Collection`` for this type declaration. procedure Process_Variants (Variants : Variant_Representation_Array; Prefix : String); -- Display all representation information for the given record variants. -- ``Prefix`` is used as a prefix for all printed lines. package Expr_Vectors is new Ada.Containers.Vectors (Positive, Expr); use type Expr_Vectors.Vector; package Expr_Vector_Vectors is new Ada.Containers.Vectors (Positive, Expr_Vectors.Vector); function Test_Discriminants (Decl : Base_Type_Decl) return Expr_Vector_Vectors.Vector; -- Fetch the vector of discriminants to use for testing from nearby Test -- pragmas. procedure Error (Node : Ada_Node'Class; Message : String) with No_Return; -- Abort the App with the given error ``Message``, contextualized using -- ``Node`` 's source location. package App is new Libadalang.Helpers.App (Name => "lal_dda", Description => "Exercize Libadalang's Data_Decomposition API on type declarations", App_Setup => App_Setup, Process_Unit => Process_Unit); package Args is use GNATCOLL.Opt_Parse; package Rep_Info_Files is new Parse_Option_List (App.Args.Parser, "-i", "--rep-info-file", Arg_Type => Unbounded_String, Accumulate => True, Help => "Output for the compiler's -gnatR4j option"); end Args; --------------- -- App_Setup -- --------------- procedure App_Setup (Context : App_Context; Jobs : App_Job_Context_Array) is pragma Unreferenced (Context, Jobs); begin Collection := Load (Filename_Array (Args.Rep_Info_Files.Get)); exception when Exc : Loading_Error => Put_Line ("Loading_Error raised while loading representation information:"); Put_Line (Exception_Message (Exc)); New_Line; end App_Setup; ------------------ -- Process_Unit -- ------------------ procedure Process_Unit (Context : App_Job_Context; Unit : Analysis_Unit) is pragma Unreferenced (Context); function Process (Node : Ada_Node'Class) return Visit_Status; function Process (Node : Ada_Node'Class) return Visit_Status is begin case Node.Kind is when Ada_Base_Type_Decl => Process_Type_Decl (Node.As_Base_Type_Decl); when Ada_Pragma_Node => declare PN : constant Pragma_Node := Node.As_Pragma_Node; Name : constant Text_Type := To_Lower (PN.F_Id.Text); Decl : Ada_Node; begin if Name = "test_object_type" then Decl := PN.Previous_Sibling; if Decl.Kind /= Ada_Object_Decl then Error (Node, "previous declaration must be an object" & " declaration"); end if; Process_Type_Decl (Decl.As_Object_Decl .F_Type_Expr .P_Designated_Type_Decl); end if; if I > 1 then Put (", "); end if; end; when others => null; end case; return Into; end Process; begin Put_Title ('#', "Analyzing " & Ada.Directories.Simple_Name (Unit.Get_Filename)); if Unit.Has_Diagnostics then for D of Unit.Diagnostics loop Put_Line (Unit.Format_GNU_Diagnostic (D)); end loop; New_Line; return; elsif not Unit.Root.Is_Null then Unit.Root.Traverse (Process'Access); end if; end Process_Unit; end LAL_DDA; type Car is record Identity : Long_Long_Integer; Number_Wheels : Positive range 1 .. 16#FF#E1; Number_Wheels : Positive range 16#F.FF#E+2 .. 2#1111_1111#; Paint : Color; Horse_Power_kW : Float range 0.0 .. 2_000.0; Consumption : Float range 0.0 .. 100.0; end record; type Null_Record is null record; type Traffic_Light_Access is access Mutable_Variant_Record; Any_Traffic_Light : Traffic_Light_Access := new Mutable_Variant_Record; Aliased_Traffic_Light : aliased Mutable_Variant_Record; pragma Unchecked_Union (Union); pragma Convention (C, Union); -- optional type Programmer is new Person and Printable with record Skilled_In : Language_List; end record; 3#12.112#e3 3#12.11 use -- ^ invalid 3#12.23#e3 -- ^ invalid 3#12.11ds# -- ^ invalid 1211ds -- ^ invalid
sungyeon/drake
Ada
2,147
adb
pragma Check_Policy (Trace => Ignore); with Ada; -- assertions with System.Unwind.Mapping; with System.Unwind.Occurrences; package body System.Unwind.Handling is pragma Suppress (All_Checks); use type Unwind.Representation.Machine_Occurrence_Access; use type Unwind.Representation.Unwind_Exception_Class; -- force to link System.Unwind.Mapping -- to convert signals or SEH exceptions to standard exceptions. Force_Use : Address := Mapping.Install_Exception_Handler'Address with Export, Convention => Ada, External_Name => "__drake_use_install_exception_handler"; -- implementation procedure Begin_Handler ( Machine_Occurrence : Representation.Machine_Occurrence_Access) is begin pragma Check (Trace, Ada.Debug.Put ("enter")); Occurrences.Set_Current_Machine_Occurrence (Machine_Occurrence); pragma Check (Trace, Ada.Debug.Put ("leave")); end Begin_Handler; procedure End_Handler ( Machine_Occurrence : Representation.Machine_Occurrence_Access) is begin pragma Check (Trace, Ada.Debug.Put ("enter")); pragma Check (Trace, Check => Machine_Occurrence = null or else Ada.Debug.Put ("Machine_Occurrence = null, reraised")); if Machine_Occurrence /= null then Occurrences.Free (Machine_Occurrence); Occurrences.Set_Current_Machine_Occurrence (null); -- in Win32 SEH, the chain may be rollback, so restore it Mapping.Reinstall_Exception_Handler; end if; pragma Check (Trace, Ada.Debug.Put ("leave")); end End_Handler; procedure Set_Exception_Parameter ( X : not null Exception_Occurrence_Access; Machine_Occurrence : not null Representation.Machine_Occurrence_Access) is begin if Machine_Occurrence.Header.exception_class = Representation.GNAT_Exception_Class then Occurrences.Save_Occurrence (X.all, Machine_Occurrence.Occurrence); else Occurrences.Set_Foreign_Occurrence (X.all, Machine_Occurrence); end if; end Set_Exception_Parameter; end System.Unwind.Handling;
riccardo-bernardini/eugen
Ada
586
adb
pragma Ada_2012; package body Latex_Writer.Picture is -------------------- -- Within_Picture -- -------------------- procedure Within_Picture (Output : File_Access; Width : Picture_Length; Heigth : Picture_Length; Callback : access procedure (Output : File_Access)) is begin Put (Output.all, "\begin{picture}" & Picture.Pos (Width, Heigth)); New_Line (Output.all); Callback (Output); New_Line (Output.all); Put_Line (Output.all, "\end{picture}"); end Within_Picture; end Latex_Writer.Picture;
reznikmm/matreshka
Ada
4,575
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Text.Active_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Text_Active_Attribute_Node is begin return Self : Text_Active_Attribute_Node do Matreshka.ODF_Text.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Text_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Text_Active_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Active_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Text_URI, Matreshka.ODF_String_Constants.Active_Attribute, Text_Active_Attribute_Node'Tag); end Matreshka.ODF_Text.Active_Attributes;
reznikmm/matreshka
Ada
4,599
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Draw.Sharpness_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Draw_Sharpness_Attribute_Node is begin return Self : Draw_Sharpness_Attribute_Node do Matreshka.ODF_Draw.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Draw_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Draw_Sharpness_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Sharpness_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Draw_URI, Matreshka.ODF_String_Constants.Sharpness_Attribute, Draw_Sharpness_Attribute_Node'Tag); end Matreshka.ODF_Draw.Sharpness_Attributes;
AaronC98/PlaneSystem
Ada
6,167
adb
------------------------------------------------------------------------------ -- Ada Web Server -- -- -- -- Copyright (C) 2000-2014, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify -- -- it under terms of the GNU General Public License as published by the -- -- Free Software Foundation; either version 3, or (at your option) any -- -- later version. This library is distributed in the hope that it will be -- -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ------------------------------------------------------------------------------ with Ada.Strings.Fixed; with Ada.Strings.Maps; with Ada.Strings.Unbounded; with AWS.Config; with AWS.MIME; with AWS.Resources; with AWS.Server; with AWS.Services.Directory; with AWS.Templates; with AWS.Utils; package body AWS.Services.Page_Server is use Ada.Strings.Unbounded; Browse_Directory : Boolean := False; Cache_Option : Unbounded_String; -- Store the cache options to be sent -------------- -- Callback -- -------------- function Callback (Request : Status.Data) return Response.Data is use Ada.Strings; use type Templates.Translate_Set; WWW_Root : String renames Config.WWW_Root (Server.Config (Server.Get_Current.all)); URI : constant String := Status.URI (Request); Filename : constant String := WWW_Root & URI (2 .. URI'Last); begin if Resources.Is_Regular_File (Filename) then if Cache_Option /= Null_Unbounded_String then return Response.File (Content_Type => MIME.Content_Type (Filename), Filename => Filename, Cache_Control => Messages.Cache_Option (To_String (Cache_Option))); else return Response.File (Content_Type => MIME.Content_Type (Filename), Filename => Filename); end if; elsif Browse_Directory and then Utils.Is_Directory (Filename) then declare Directory_Browser_Page : constant String := Config.Directory_Browser_Page (Server.Config (Server.Get_Current.all)); begin if Cache_Option /= Null_Unbounded_String then return Response.Build (Content_Type => MIME.Text_HTML, Message_Body => Services.Directory.Browse (Filename, Directory_Browser_Page, Request), Cache_Control => Messages.Cache_Option (To_String (Cache_Option))); else return Response.Build (Content_Type => MIME.Text_HTML, Message_Body => Services.Directory.Browse (Filename, Directory_Browser_Page, Request)); end if; end; else if Resources.Is_Regular_File (WWW_Root & "404.thtml") then -- Here we return the 404.thtml page if found. Note that on -- Microsoft IE this page will be displayed only if the total -- page size is bigger than 512 bytes or if it includes at -- leat one image. return Response.Acknowledge (Messages.S404, Templates.Parse (WWW_Root & "404.thtml", +Templates.Assoc ("PAGE", URI))); else return Response.Acknowledge (Messages.S404, "<p>Page '" -- Replace HTML control characters to the HTML inactive symbols -- to avoid correct HTML pages initiated from the client side. -- See http://www.securityfocus.com/bid/7596 & Fixed.Translate (URI, Maps.To_Mapping ("<>&", "{}@")) & "' Not found."); end if; end if; end Callback; ------------------------ -- Directory_Browsing -- ------------------------ procedure Directory_Browsing (Activated : Boolean) is begin Browse_Directory := Activated; end Directory_Browsing; ----------------------- -- Set_Cache_Control -- ----------------------- procedure Set_Cache_Control (Data : Messages.Cache_Data) is begin Cache_Option := To_Unbounded_String (String (Messages.To_Cache_Option (Data))); end Set_Cache_Control; end AWS.Services.Page_Server;
burratoo/Acton
Ada
2,700
adb
------------------------------------------------------------------------------------------ -- -- -- ACTON ANALYSER -- -- -- -- SCHEDULERS -- -- -- -- Copyright (C) 2016-2021, Patrick Bernardi -- -- -- ------------------------------------------------------------------------------------------ with Ada.Wide_Text_IO; use Ada.Wide_Text_IO; with Ada.Strings.Wide_Unbounded.Wide_Text_IO; use Ada.Strings.Wide_Unbounded.Wide_Text_IO; package body Schedulers is procedure Add_Scheduler (Name : in Wide_String; Low_Priority : in Integer; High_Priority : in Integer; Storage_Size : in Integer; Source : in Wide_String; Line : in Asis.Text.Line_Number) is S : constant Scheduler_Info := (Scheduler_Name => To_Unbounded_Wide_String (Name), Low_Priority => Low_Priority, High_Priority => High_Priority, Storage_Size => Storage_Size, Pragma_Location => (Source_Name => To_Unbounded_Wide_String (Source), Line_Number => Line)); begin Schedulers.Insert (S); end Add_Scheduler; procedure Print_Schedulers is W : constant := 15; begin Put_Line (Line_Decoration); New_Line; Put_Line ("SCHEDULERS"); Put_Line (50 * "="); for Scheduler of Schedulers loop Put_Line (Format_Property_String ("Scheduler Name", W) & Scheduler.Scheduler_Name); Put_Line (Format_Property_String ("Pragma Location", W) & Element_Location_Image (Scheduler.Pragma_Location)); Put_Line (Format_Property_String ("Priority_Range", W) & Image (Scheduler.Low_Priority) & " .. " & Image (Scheduler.High_Priority)); Put_Line (Format_Property_String ("Storage Size", W) & Image (Scheduler.Storage_Size) & " bytes"); end loop; Put_Line (50 * "="); New_Line; Put_Line ("Total number of schedulers : " & Image (Integer (Schedulers.Length))); New_Line; Put_Line (Line_Decoration); end Print_Schedulers; end Schedulers;
optikos/oasis
Ada
4,499
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Program.Elements.Expressions; with Program.Lexical_Elements; with Program.Elements.Assignment_Statements; with Program.Element_Visitors; package Program.Nodes.Assignment_Statements is pragma Preelaborate; type Assignment_Statement is new Program.Nodes.Node and Program.Elements.Assignment_Statements.Assignment_Statement and Program.Elements.Assignment_Statements.Assignment_Statement_Text with private; function Create (Variable_Name : not null Program.Elements.Expressions .Expression_Access; Assignment_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Expression : not null Program.Elements.Expressions .Expression_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access) return Assignment_Statement; type Implicit_Assignment_Statement is new Program.Nodes.Node and Program.Elements.Assignment_Statements.Assignment_Statement with private; function Create (Variable_Name : not null Program.Elements.Expressions .Expression_Access; Expression : not null Program.Elements.Expressions .Expression_Access; Is_Part_Of_Implicit : Boolean := False; Is_Part_Of_Inherited : Boolean := False; Is_Part_Of_Instance : Boolean := False) return Implicit_Assignment_Statement with Pre => Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance; private type Base_Assignment_Statement is abstract new Program.Nodes.Node and Program.Elements.Assignment_Statements.Assignment_Statement with record Variable_Name : not null Program.Elements.Expressions .Expression_Access; Expression : not null Program.Elements.Expressions .Expression_Access; end record; procedure Initialize (Self : aliased in out Base_Assignment_Statement'Class); overriding procedure Visit (Self : not null access Base_Assignment_Statement; Visitor : in out Program.Element_Visitors.Element_Visitor'Class); overriding function Variable_Name (Self : Base_Assignment_Statement) return not null Program.Elements.Expressions.Expression_Access; overriding function Expression (Self : Base_Assignment_Statement) return not null Program.Elements.Expressions.Expression_Access; overriding function Is_Assignment_Statement_Element (Self : Base_Assignment_Statement) return Boolean; overriding function Is_Statement_Element (Self : Base_Assignment_Statement) return Boolean; type Assignment_Statement is new Base_Assignment_Statement and Program.Elements.Assignment_Statements.Assignment_Statement_Text with record Assignment_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Semicolon_Token : not null Program.Lexical_Elements .Lexical_Element_Access; end record; overriding function To_Assignment_Statement_Text (Self : aliased in out Assignment_Statement) return Program.Elements.Assignment_Statements .Assignment_Statement_Text_Access; overriding function Assignment_Token (Self : Assignment_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access; overriding function Semicolon_Token (Self : Assignment_Statement) return not null Program.Lexical_Elements.Lexical_Element_Access; type Implicit_Assignment_Statement is new Base_Assignment_Statement with record Is_Part_Of_Implicit : Boolean; Is_Part_Of_Inherited : Boolean; Is_Part_Of_Instance : Boolean; end record; overriding function To_Assignment_Statement_Text (Self : aliased in out Implicit_Assignment_Statement) return Program.Elements.Assignment_Statements .Assignment_Statement_Text_Access; overriding function Is_Part_Of_Implicit (Self : Implicit_Assignment_Statement) return Boolean; overriding function Is_Part_Of_Inherited (Self : Implicit_Assignment_Statement) return Boolean; overriding function Is_Part_Of_Instance (Self : Implicit_Assignment_Statement) return Boolean; end Program.Nodes.Assignment_Statements;
stcarrez/ada-asf
Ada
2,260
adb
----------------------------------------------------------------------- -- asf-security -- ASF Security -- Copyright (C) 2012 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Beans.Objects; with Security.Contexts; use Security; package body ASF.Security is function Has_Permission (Value : in Util.Beans.Objects.Object) return Util.Beans.Objects.Object; -- ------------------------------ -- EL function to check if the given permission name is granted by the current -- security context. -- ------------------------------ function Has_Permission (Value : in Util.Beans.Objects.Object) return Util.Beans.Objects.Object is Name : constant String := Util.Beans.Objects.To_String (Value); begin if Contexts.Has_Permission (Name) then return Util.Beans.Objects.To_Object (True); else return Util.Beans.Objects.To_Object (False); end if; end Has_Permission; -- ------------------------------ -- Register a set of functions in the namespace -- xmlns:fn="http://code.google.com/p/ada-asf/auth" -- Functions: -- hasPermission(NAME) -- Returns True if the permission NAME is granted -- ------------------------------ procedure Set_Functions (Mapper : in out EL.Functions.Function_Mapper'Class) is begin Mapper.Set_Function (Name => HAS_PERMISSION_FN, Namespace => AUTH_NAMESPACE_URI, Func => Has_Permission'Access); end Set_Functions; end ASF.Security;
tum-ei-rcs/StratoX
Ada
2,632
adb
with Ada.Text_IO; use Ada.Text_IO; with Ada.Numerics.Generic_Elementary_Functions; with Interfaces; use Interfaces; procedure main with SPARK_Mode is package Efuncs is new Ada.Numerics.Generic_Elementary_Functions (Interfaces.IEEE_Float_32); package Efuncs64 is new Ada.Numerics.Generic_Elementary_Functions (Interfaces.IEEE_Float_64); machine_has_denorm : constant Boolean := Float'Denorm; pragma Assert (machine_has_denorm); machine_exp_max : constant Integer := Interfaces.IEEE_Float_32'Machine_Emax; float_32bit : constant Boolean := machine_exp_max = 128; pragma assert (float_32bit); -- float 32bit: 1+(significand)*2^(exp), where significand=23bit, exp=8bit signed (-127..128) -- smallest possible significant: 1.0 => smallest possible float: 2^-126 = 1.175E-38 sub1 : Interfaces.IEEE_Float_32 := -1.1E-39; -- starting at ~-38 we get denormals here; compiler warns us sub2 : Interfaces.IEEE_Float_32 := 100.0; res : Interfaces.IEEE_Float_32; sub64 : Interfaces.IEEE_Float_64 := 2.0E-308; sub4 : Interfaces.IEEE_Float_64; begin -- Float Attributes: http://www.adaic.org/resources/add_content/standards/12rm/html/RM-A-5-3.html Put_Line ("Float Info:"); Put_Line ("Machine Radix: " & Integer'Image(Float'Machine_Radix) & ", Machine Mantissa: " & Integer'Image(Float'Machine_Mantissa)); Put_Line ("Machine Exponent: " & Integer'Image(Float'Machine_Emin) & " .. " & Integer'Image(Float'Machine_Emax)); Put_Line ("Machine Denormals: " & Boolean'Image(machine_has_denorm)); Put_Line ("Machine Overflows: " & Boolean'Image(Float'Machine_Overflows)); Put_Line ("Machine Rounds: " & Boolean'Image(Float'Machine_Rounds)); Put_Line ("Signed Zeros: " & Boolean'Image(Float'Signed_Zeros)); Put_Line ("Model Epsilon: " & Float'Image(Float'Model_Epsilon)); Put_Line ("Model Small: " & Float'Image(Float'Model_Small)); Put_Line ("Model Emin: " & Integer'Image(Float'Model_Emin)); Put_Line ("Model Mantissa: " & Integer'Image(Float'Model_Mantissa)); Put_Line ("Safe Range: " & Float'Image(Float'Safe_First) & " .. " & Float'Image(Float'Safe_Last)); pragma Assert (sub1 /= 0.0); -- this is still successful with a denormal sub4 := 1.12E-309; sub4 := Efuncs64.Sin(sub4); -- Put(IEEE_Float_64'Image(sub4)); sub64 := sub64 * sub4; --res := Efuncs.cos (sub1*sub1); --Put_Line ("exp min=" & Integer'Image(machine_exp_min)); res := sub1 - sub2; -- always okay res := sub1 / sub2; -- also okay res := sub1 + 1.0; -- also okay res := sub1 * sub1; pragma Assert (res in -1.0 .. 1.0); res := res * sub1; end main;
gerr135/ada_composition
Ada
5,200
adb
-- -- Tests of lists of private (non-tagged) types -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- with Ada.Command_Line, GNAT.Command_Line; with Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO; with Ada.Containers.Vectors; with lists.Fixed; with lists.Bounded; with lists.Dynamic; with lists.Vectors; procedure Test_list_iface is type Element_Type is new Integer; package ACV is new Ada.Containers.Vectors(Positive, Element_Type); package PL is new Lists(Natural, Element_Type); package PLF is new PL.Fixed; package PLB is new PL.Bounded; package PLD is new PL.Dynamic; package PLV is new PL.Vectors; begin -- main Put_Line("testing Ada.Containers.Vectors.."); declare v : ACV.Vector := ACV.To_Vector(5); begin Put("assigning values .. "); for i in Integer range 1 .. 5 loop v(i) := Element_Type(i); end loop; Put_Line("done;"); Put(" indices: First =" & v.First_Index'img & ", Last =" & v.Last_Index'img); Put_Line(", Length =" & v.Length'img); Put(" values, the 'of loop': "); for n of v loop Put(n'Img); end loop; Put("; direct indexing: "); for i in Positive range 1 .. 5 loop Put(Element_Type'Image(v(i))); end loop; end; New_Line; -- -- New_Line; Put_Line("testing Lists.Fixed.."); declare lf : PLF.List(5); begin Put("assigning values .. "); for i in Integer range 1 .. 5 loop lf(i) := Element_Type(i); end loop; Put_Line("done;"); Put(" indices: First =" & lf.First_Index'img & ", Last =" & lf.Last_Index'img); Put_Line(", Length =" & lf.Length'img); Put(" values, the 'of loop': "); for n of lf loop Put(n'Img); end loop; Put("; direct indexing: "); for i in Positive range 1 .. 5 loop Put(Element_Type'Image(lf(i))); end loop; end; New_Line; -- -- New_Line; Put_Line("testing Lists.Bounded.."); declare lb : PLB.List(5); begin Put("assigning values .. "); for i in Integer range 1 .. 5 loop lb(i) := Element_Type(i); end loop; Put_Line("done;"); Put(" indices: First =" & lb.First_Index'img & ", Last =" & lb.Last_Index'img); Put_Line(", Length =" & lb.Length'img); Put(" values, the 'of loop': "); for n of lb loop Put(n'Img); end loop; Put("; direct indexing: "); for i in Positive range 1 .. 5 loop Put(Element_Type'Image(lb(i))); end loop; end; New_Line; -- -- New_Line; Put_Line("testing Lists.Dynamic.."); declare ld : PLD.List := PLD.To_Vector(5); begin Put("assigning values .. "); for i in Integer range 1 .. 5 loop ld(i) := Element_Type(i); end loop; Put_Line("done;"); Put(" indices: First =" & ld.First_Index'img & ", Last =" & ld.Last_Index'img); Put_Line(", Length =" & ld.Length'img); Put(" values, the 'of loop': "); for n of ld loop Put(n'Img); end loop; Put("; direct indexing: "); for i in Positive range 1 .. 5 loop Put(Element_Type'Image(ld(i))); end loop; end; New_Line; -- -- New_Line; Put_Line("testing Lists.Vectors .."); declare lv : PLV.List := PLV.To_Vector(5); begin Put("assigning values .. "); for i in Integer range 1 .. 5 loop lv(i) := Element_Type(i); end loop; Put_Line("done;"); Put(" indices: First =" & lv.First_Index'img & ", Last =" & lv.Last_Index'img); Put_Line(", Length =" & Ada.Containers.Count_Type'Image(lv.Length)); -- apparently ACV.Vector methods are not masked enough here.. Put(" values, the 'of loop': "); for n of lv loop Put(n'Img); end loop; Put("; direct indexing: "); for i in Positive range 1 .. 5 loop Put(Element_Type'Image(lv(i))); end loop; end; New_Line; -- -- New_Line; Put_Line("testing List_Interface'Class .."); declare lc : PL.List_Interface'Class := PLD.To_Vector(5); begin Put("assigning values .. "); for i in Integer range 1 .. 5 loop lc(i) := Element_Type(i); end loop; Put_Line("done;"); Put(" indices: First =" & lc.First_Index'img & ", Last =" & lc.Last_Index'img); Put_Line(", Length =" & lc.Length'img); Put(" values, the 'of loop': "); for n of lc loop Put(n'Img); end loop; Put("; direct indexing: "); for i in Positive range 1 .. 5 loop Put(Element_Type'Image(lc(i))); end loop; end; New_Line; end Test_List_iface;
reznikmm/matreshka
Ada
4,049
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Text_Sort_By_Position_Attributes; package Matreshka.ODF_Text.Sort_By_Position_Attributes is type Text_Sort_By_Position_Attribute_Node is new Matreshka.ODF_Text.Abstract_Text_Attribute_Node and ODF.DOM.Text_Sort_By_Position_Attributes.ODF_Text_Sort_By_Position_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Text_Sort_By_Position_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Text_Sort_By_Position_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Text.Sort_By_Position_Attributes;
zhmu/ananas
Ada
2,731
adb
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S Y S T E M . E X C E P T I O N S . M A C H I N E -- -- -- -- B o d y -- -- -- -- Copyright (C) 2013-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ package body System.Exceptions.Machine is function New_Occurrence return GNAT_GCC_Exception_Access is Res : GNAT_GCC_Exception_Access; begin Res := new GNAT_GCC_Exception; Res.Header.Class := GNAT_Exception_Class; Res.Header.Unwinder_Cache. Reserved1 := 0; return Res; end New_Occurrence; end System.Exceptions.Machine;
AdaCore/libadalang
Ada
215
ads
with Foo; with Foo2; package Root.Pkg is type X is private; protected Nested is procedure Proc; end Nested; use Foo; private type X is record Y, Z : Integer; end record; end Root.Pkg;
reznikmm/matreshka
Ada
10,565
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2017, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with Matreshka.Internals.Strings; package AMF.Internals.Tables.Standard_Profile_L3_String_Data_00 is -- "extension_Metamodel" MS_0000 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 19, Length => 19, Value => (16#0065#, 16#0078#, 16#0074#, 16#0065#, 16#006E#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, 16#005F#, 16#004D#, 16#0065#, 16#0074#, 16#0061#, 16#006D#, 16#006F#, 16#0064#, 16#0065#, 16#006C#, others => 16#0000#), others => <>); -- "Model_SystemModel" MS_0001 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#004D#, 16#006F#, 16#0064#, 16#0065#, 16#006C#, 16#005F#, 16#0053#, 16#0079#, 16#0073#, 16#0074#, 16#0065#, 16#006D#, 16#004D#, 16#006F#, 16#0064#, 16#0065#, 16#006C#, others => 16#0000#), others => <>); -- "extension_SystemModel" MS_0002 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 21, Length => 21, Value => (16#0065#, 16#0078#, 16#0074#, 16#0065#, 16#006E#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, 16#005F#, 16#0053#, 16#0079#, 16#0073#, 16#0074#, 16#0065#, 16#006D#, 16#004D#, 16#006F#, 16#0064#, 16#0065#, 16#006C#, others => 16#0000#), others => <>); -- "BuildComponent" MS_0003 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0042#, 16#0075#, 16#0069#, 16#006C#, 16#0064#, 16#0043#, 16#006F#, 16#006D#, 16#0070#, 16#006F#, 16#006E#, 16#0065#, 16#006E#, 16#0074#, others => 16#0000#), others => <>); -- "http://www.omg.org/spec/UML/20100901/StandardProfileL3" MS_0004 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 63, Unused => 54, Length => 54, Value => (16#0068#, 16#0074#, 16#0074#, 16#0070#, 16#003A#, 16#002F#, 16#002F#, 16#0077#, 16#0077#, 16#0077#, 16#002E#, 16#006F#, 16#006D#, 16#0067#, 16#002E#, 16#006F#, 16#0072#, 16#0067#, 16#002F#, 16#0073#, 16#0070#, 16#0065#, 16#0063#, 16#002F#, 16#0055#, 16#004D#, 16#004C#, 16#002F#, 16#0032#, 16#0030#, 16#0031#, 16#0030#, 16#0030#, 16#0039#, 16#0030#, 16#0031#, 16#002F#, 16#0053#, 16#0074#, 16#0061#, 16#006E#, 16#0064#, 16#0061#, 16#0072#, 16#0064#, 16#0050#, 16#0072#, 16#006F#, 16#0066#, 16#0069#, 16#006C#, 16#0065#, 16#004C#, 16#0033#, others => 16#0000#), others => <>); -- "base_Model" MS_0005 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 10, Length => 10, Value => (16#0062#, 16#0061#, 16#0073#, 16#0065#, 16#005F#, 16#004D#, 16#006F#, 16#0064#, 16#0065#, 16#006C#, others => 16#0000#), others => <>); -- "base_Component" MS_0006 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 14, Length => 14, Value => (16#0062#, 16#0061#, 16#0073#, 16#0065#, 16#005F#, 16#0043#, 16#006F#, 16#006D#, 16#0070#, 16#006F#, 16#006E#, 16#0065#, 16#006E#, 16#0074#, others => 16#0000#), others => <>); -- "SystemModel" MS_0007 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 11, Length => 11, Value => (16#0053#, 16#0079#, 16#0073#, 16#0074#, 16#0065#, 16#006D#, 16#004D#, 16#006F#, 16#0064#, 16#0065#, 16#006C#, others => 16#0000#), others => <>); -- "StandardProfileL3" MS_0008 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 17, Length => 17, Value => (16#0053#, 16#0074#, 16#0061#, 16#006E#, 16#0064#, 16#0061#, 16#0072#, 16#0064#, 16#0050#, 16#0072#, 16#006F#, 16#0066#, 16#0069#, 16#006C#, 16#0065#, 16#004C#, 16#0033#, others => 16#0000#), others => <>); -- "Model_Metamodel" MS_0009 : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 15, Length => 15, Value => (16#004D#, 16#006F#, 16#0064#, 16#0065#, 16#006C#, 16#005F#, 16#004D#, 16#0065#, 16#0074#, 16#0061#, 16#006D#, 16#006F#, 16#0064#, 16#0065#, 16#006C#, others => 16#0000#), others => <>); -- "org.omg.xmi.nsPrefix" MS_000A : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 23, Unused => 20, Length => 20, Value => (16#006F#, 16#0072#, 16#0067#, 16#002E#, 16#006F#, 16#006D#, 16#0067#, 16#002E#, 16#0078#, 16#006D#, 16#0069#, 16#002E#, 16#006E#, 16#0073#, 16#0050#, 16#0072#, 16#0065#, 16#0066#, 16#0069#, 16#0078#, others => 16#0000#), others => <>); -- "Component_BuildComponent" MS_000B : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 31, Unused => 24, Length => 24, Value => (16#0043#, 16#006F#, 16#006D#, 16#0070#, 16#006F#, 16#006E#, 16#0065#, 16#006E#, 16#0074#, 16#005F#, 16#0042#, 16#0075#, 16#0069#, 16#006C#, 16#0064#, 16#0043#, 16#006F#, 16#006D#, 16#0070#, 16#006F#, 16#006E#, 16#0065#, 16#006E#, 16#0074#, others => 16#0000#), others => <>); -- "extension_BuildComponent" MS_000C : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 31, Unused => 24, Length => 24, Value => (16#0065#, 16#0078#, 16#0074#, 16#0065#, 16#006E#, 16#0073#, 16#0069#, 16#006F#, 16#006E#, 16#005F#, 16#0042#, 16#0075#, 16#0069#, 16#006C#, 16#0064#, 16#0043#, 16#006F#, 16#006D#, 16#0070#, 16#006F#, 16#006E#, 16#0065#, 16#006E#, 16#0074#, others => 16#0000#), others => <>); -- "Metamodel" MS_000D : aliased Matreshka.Internals.Strings.Shared_String := (Capacity => 15, Unused => 9, Length => 9, Value => (16#004D#, 16#0065#, 16#0074#, 16#0061#, 16#006D#, 16#006F#, 16#0064#, 16#0065#, 16#006C#, others => 16#0000#), others => <>); end AMF.Internals.Tables.Standard_Profile_L3_String_Data_00;
Heziode/lsystem-editor
Ada
3,274
adb
------------------------------------------------------------------------------- -- LSE -- L-System Editor -- Author: Heziode -- -- License: -- MIT License -- -- Copyright (c) 2018 Quentin Dauprat (Heziode) <[email protected]> -- -- Permission is hereby granted, free of charge, to any person obtaining a -- copy of this software and associated documentation files (the "Software"), -- to deal in the Software without restriction, including without limitation -- the rights to use, copy, modify, merge, publish, distribute, sublicense, -- and/or sell copies of the Software, and to permit persons to whom the -- Software is furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------- with Glib; package body LSE.IO.Drawing_Area is function Initialize (Cr : Cairo.Cairo_Context) return Instance is This : Instance; begin This.Cr := Cr; return This; end Initialize; procedure Configure (This : in out Instance; Turtle : LSE.Model.IO.Turtle.Instance) is use Glib; begin Move_To (This.Cr, Gdouble (Turtle.Get_Offset_X + Turtle.Get_Margin_Right), Gdouble (Turtle.Get_Offset_Y + Turtle.Get_Margin_Bottom)); end Configure; procedure Draw (This : in out Instance) is begin Stroke (This.Cr); Show_Page (This.Cr); end Draw; procedure Forward (This : in out Instance; Coordinate : LSE.Utils.Coordinate_2D.Coordinate; Trace : Boolean := False) is use Glib; begin if Trace then Rel_Line_To (This.Cr, Gdouble (Coordinate.Get_X), Gdouble (Coordinate.Get_Y)); else Rel_Move_To (This.Cr, Gdouble (Coordinate.Get_X), Gdouble (Coordinate.Get_Y)); end if; end Forward; procedure Rotate_Clockwise (This : in out Instance) is begin null; end Rotate_Clockwise; procedure Rotate_Anticlockwise (This : in out Instance) is begin null; end Rotate_Anticlockwise; procedure UTurn (This : in out Instance) is begin null; end UTurn; procedure Position_Save (This : in out Instance) is begin null; end Position_Save; procedure Position_Restore (This : in out Instance; X, Y : Fixed_Point) is use Glib; begin Rel_Move_To (This.Cr, Gdouble (X), Gdouble (Y)); end Position_Restore; end LSE.IO.Drawing_Area;
twdroeger/ada-awa
Ada
3,335
ads
----------------------------------------------------------------------- -- awa-mail-client -- Mail client interface -- Copyright (C) 2012 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Properties; -- The <b>AWA.Mail.Clients</b> package defines a mail client API used by the mail module. -- It defines two interfaces that must be implemented. This allows to have an implementation -- based on an external application such as <tt>sendmail</tt> and other implementation that -- use an SMTP connection. package AWA.Mail.Clients is type Recipient_Type is (TO, CC, BCC); -- ------------------------------ -- Mail Message -- ------------------------------ -- The <b>Mail_Message</b> represents an abstract mail message that can be initialized -- before being sent. type Mail_Message is limited interface; type Mail_Message_Access is access all Mail_Message'Class; -- Set the <tt>From</tt> part of the message. procedure Set_From (Message : in out Mail_Message; Name : in String; Address : in String) is abstract; -- Add a recipient for the message. procedure Add_Recipient (Message : in out Mail_Message; Kind : in Recipient_Type; Name : in String; Address : in String) is abstract; -- Set the subject of the message. procedure Set_Subject (Message : in out Mail_Message; Subject : in String) is abstract; -- Set the body of the message. procedure Set_Body (Message : in out Mail_Message; Content : in String) is abstract; -- Send the email message. procedure Send (Message : in out Mail_Message) is abstract; -- ------------------------------ -- Mail Manager -- ------------------------------ -- The <b>Mail_Manager</b> is the entry point to create a new mail message -- and be able to send it. type Mail_Manager is limited interface; type Mail_Manager_Access is access all Mail_Manager'Class; -- Create a new mail message. function Create_Message (Manager : in Mail_Manager) return Mail_Message_Access is abstract; -- Factory to create the mail manager. The mail manager implementation is identified by -- the <b>Name</b>. It is configured according to the properties defined in <b>Props</b>. -- Returns null if the mail manager identified by the name is not supported. function Factory (Name : in String; Props : in Util.Properties.Manager'Class) return Mail_Manager_Access; end AWA.Mail.Clients;
psyomn/ash
Ada
1,626
ads
-- Copyright 2019 Simon Symeonidis (psyomn) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Ada.Exceptions; use Ada.Exceptions; with GNAT.Traceback.Symbolic; use GNAT.Traceback.Symbolic; with Ada.Text_IO; use Ada.Text_IO; package Common_Utils is -- TODO: I'm not sure if we should really care about inlines. Maybe they -- make sense in the functionality bellow, but I would like to empirically -- see if any of these make sense. procedure Empty_String_Range (S : String; First : out Positive; Last : out Positive) with Inline; procedure Empty_String (S : in out String) with Inline; function Header_String (Field : String; Value : String) return String with Inline; function Header_String (Field : String; Value : Integer) return String with Inline; function Integer_To_Trimmed_String (I : Integer) return String with Inline; function Concat_Null_Strings (S1, S2 : String) return String; procedure Print_Exception (E : Exception_Occurrence; Message : String); end Common_Utils;
stcarrez/dynamo
Ada
29,031
ads
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . S P A N _ B E G I N N I N G -- -- -- -- S p e c -- -- -- -- Copyright (C) 1995-2012, Free Software Foundation, Inc. -- -- -- -- ASIS-for-GNAT is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 2, or (at your option) any later -- -- version. ASIS-for-GNAT is distributed in the hope that it will be use- -- -- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- -- -- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -- -- Public License for more details. You should have received a copy of the -- -- GNU General Public License distributed with ASIS-for-GNAT; see file -- -- COPYING. If not, write to the Free Software Foundation, 51 Franklin -- -- Street, Fifth Floor, Boston, MA 02110-1301, USA. -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the -- -- Software Engineering Laboratory of the Swiss Federal Institute of -- -- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the -- -- Scientific Research Computer Center of Moscow State University (SRCC -- -- MSU), Russia, with funding partially provided by grants from the Swiss -- -- National Science Foundation and the Swiss Academy of Engineering -- -- Sciences. ASIS-for-GNAT is now maintained by AdaCore -- -- (http://www.adacore.com). -- -- -- ------------------------------------------------------------------------------ with Asis; with A4G.Int_Knds; use A4G.Int_Knds; with Types; use Types; package A4G.Span_Beginning is function Set_Image_Beginning (E : Asis.Element) return Source_Ptr; -- The driver function for computing the beginning of the element image -- in the GNAT source text buffer. In case if the argument is a labeled -- statement returns the baginning of the first attachecd label. Otherwise -- calls the element-kind-specific function for computing the image -- beginning -- The functions below compute the beginning of the text image for some -- specific set of ELement kinds/ function Subunit_Beginning (E : Asis.Element) return Source_Ptr; function Private_Unit_Beginning (E : Asis.Element) return Source_Ptr; -- Assuming that E is an element representing the top Unit element of a -- subunit or of a library item representing a private unit, returns the -- source pointer to the beginning of the keyword SEPARATE or PRIVATE -- accordingly. function No_Search (E : Asis.Element) return Source_Ptr; -- That is, we can just use Sloc from the node the Element is based upon. function Search_Identifier_Beginning (E : Asis.Element) return Source_Ptr; -- A special processing is needed for an identifier representing the -- attribute designator in pseudo-attribute-reference in an attribute -- definition clause and for 'Class attribute in aspect indication function Search_Subtype_Indication_Beginning (E : Asis.Element) return Source_Ptr; -- If the subtype mark is an expanded name, we have to look for its prefix function Defining_Identifier_Beginning (E : Asis.Element) return Source_Ptr; -- Returns the beginning of A_Defining_Identifier elements. In case of -- labels we have to get rid of '<<' function Short_Circuit_Beginning (E : Asis.Element) return Source_Ptr; -- Returns the beginning of short circuit expression function Membership_Test_Beginning (E : Asis.Element) return Source_Ptr; -- Returns the beginning of membership test expression function Null_Component_Beginning (E : Asis.Element) return Source_Ptr; -- In case of A_Nil_Component element Sloc of its Node points to -- "record" (it's easy) or to variant (it's a pain) function Search_Prefix_Beginning (E : Asis.Element) return Source_Ptr; -- Is needed when the Argument has a "prefix" in its structure, but Sloc -- points somewhere inside the elemen structure -- --|A2005 start function Possible_Null_Exclusion_Beginning (E : Asis.Element) return Source_Ptr; -- Should be used for constructs that can contain null_exclusion function Possible_Overriding_Indicator_Beginning (E : Asis.Element) return Source_Ptr; -- Is supposed to be used for some of the constructs that can contain -- overriding_indicator -- --|A2005 end function Component_And_Parameter_Declaration_Beginning (E : Asis.Element) return Source_Ptr; function Exception_Declaration_Beginning (E : Asis.Element) return Source_Ptr; function Derived_Definition_Beginning (E : Asis.Element) return Source_Ptr; function Type_Definition_Beginning (E : Asis.Element) return Source_Ptr; function Interface_Definition_Beginning (E : Asis.Element) return Source_Ptr; function Tagged_Type_Definition_Beginning (E : Asis.Element) return Source_Ptr; function Simple_Expression_Range_Beginning (E : Asis.Element) return Source_Ptr; function Component_Definition_Beginning (E : Asis.Element) return Source_Ptr; function Search_Left_Parenthesis_After (E : Asis.Element) return Source_Ptr; -- Is needed when the Element does not have its "own" node (in particular, -- for A_Known_Discriminant_Part Element) function Private_Extension_Definition_Beginning (E : Asis.Element) return Source_Ptr; function Private_Type_Definition_Beginning (E : Asis.Element) return Source_Ptr; function Explicit_Dereference_Beginning (E : Asis.Element) return Source_Ptr; function Function_Call_Beginning (E : Asis.Element) return Source_Ptr; function Indexed_Component_Beginning (E : Asis.Element) return Source_Ptr; function Component_Association_Beginning (E : Asis.Element) return Source_Ptr; function Association_Beginning (E : Asis.Element) return Source_Ptr; function Parenthesized_Expression_Beginning (E : Asis.Element) return Source_Ptr; function Assignment_Statement_Beginning (E : Asis.Element) return Source_Ptr; function Named_Statement_Beginning (E : Asis.Element) return Source_Ptr; -- Takes care of loop and block names function Call_Statement_Beginning (E : Asis.Element) return Source_Ptr; function While_Loop_Statement_Beginning (E : Asis.Element) return Source_Ptr; function For_Loop_Statement_Beginning (E : Asis.Element) return Source_Ptr; function Else_Path_Beginning (E : Asis.Element) return Source_Ptr; function With_Clause_Beginning (E : Asis.Element) return Source_Ptr; function Component_Clause_Beginning (E : Asis.Element) return Source_Ptr; function Subprogram_Spec_Beginning (E : Asis.Element) return Source_Ptr; function Formal_Object_Declaration_Beginning (E : Asis.Element) return Source_Ptr; function A_Then_Abort_Path_Beginning (E : Asis.Element) return Source_Ptr; function Select_Alternative_Beginning (E : Asis.Element) return Source_Ptr; -- --|A2015 start function Case_Expression_Path_Beginning (E : Asis.Element) return Source_Ptr; function If_Expression_Beginning (E : Asis.Element) return Source_Ptr; function Conditional_Expression_Path_Beginning (E : Asis.Element) return Source_Ptr; function An_Else_Expression_Path_Beginning (E : Asis.Element) return Source_Ptr; -- --|A2015 end -- The look-up table below defines the mapping from Element kinds onto -- specific routines for computing the Element image beginning type Set_Source_Location_type is access function (E : Asis.Element) return Source_Ptr; Switch : array (Internal_Element_Kinds) of Set_Source_Location_type := ( An_All_Calls_Remote_Pragma .. -- An_Asynchronous_Pragma -- An_Atomic_Pragma -- An_Atomic_Components_Pragma -- An_Attach_Handler_Pragma -- A_Controlled_Pragma -- A_Convention_Pragma -- An_Elaborate_All_Pragma -- An_Elaborate_Body_Pragma -- An_Export_Pragma -- An_Import_Pragma -- An_Inline_Pragma -- An_Inspection_Point_Pragma -- An_Interrupt_Handler_Pragma -- An_Interrupt_Priority_Pragma -- A_List_Pragma -- A_Locking_Policy_Pragma -- A_Normalize_Scalars_Pragma -- An_Optimize_Pragma -- A_Pack_Pragma -- A_Page_Pragma -- A_Preelaborate_Pragma -- A_Priority_Pragma -- A_Pure_Pragma -- A_Queuing_Policy_Pragma -- A_Remote_Call_Interface_Pragma -- A_Remote_Types_Pragma -- A_Restrictions_Pragma -- A_Reviewable_Pragma -- A_Shared_Passive_Pragma -- A_Suppress_Pragma -- A_Task_Dispatching_Policy_Pragma -- A_Volatile_Pragma -- A_Volatile_Components_Pragma -- An_Implementation_Defined_Pragma An_Unknown_Pragma => No_Search'Access, A_Defining_Identifier => Defining_Identifier_Beginning'Access, A_Defining_Character_Literal .. -- A_Defining_Enumeration_Literal -- A_Defining_Or_Operator -- A_Defining_Xor_Operator -- A_Defining_Equal_Operator -- A_Defining_Not_Equal_Operator -- A_Defining_Less_Than_Operator -- A_Defining_Less_Than_Or_Equal_Operator -- A_Defining_Greater_Than_Operator -- A_Defining_Greater_Than_Or_Equal_Operator -- A_Defining_Plus_Operator -- A_Defining_Minus_Operator -- A_Defining_Concatenate_Operator -- A_Defining_Unary_Plus_Operator -- A_Defining_Unary_Minus_Operator -- A_Defining_Multiply_Operator -- A_Defining_Divide_Operator -- A_Defining_Mod_Operator -- A_Defining_Rem_Operator -- A_Defining_Exponentiate_Operator -- A_Defining_Abs_Operator A_Defining_Not_Operator => No_Search'Access, A_Defining_Expanded_Name => Search_Prefix_Beginning'Access, An_Ordinary_Type_Declaration .. -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- An_Incomplete_Type_Declaration -- A_Private_Type_Declaration -- A_Private_Extension_Declaration -- A_Subtype_Declaration -- A_Variable_Declaration -- A_Constant_Declaration -- A_Deferred_Constant_Declaration -- A_Single_Task_Declaration -- A_Single_Protected_Declaration -- An_Integer_Number_Decl -- A_Real_Number_Declaration -- An_Enumeration_Literal_Specification A_Discriminant_Specification => No_Search'Access, A_Component_Declaration => Component_And_Parameter_Declaration_Beginning'Access, A_Loop_Parameter_Specification => No_Search'Access, -- --|A2012 start A_Generalized_Iterator_Specification => No_Search'Access, -- ??? An_Element_Iterator_Specification => No_Search'Access, -- ??? -- --|A2012 end A_Procedure_Declaration .. A_Function_Declaration => Subprogram_Spec_Beginning'Access, -- --|A2005 start A_Null_Procedure_Declaration => Subprogram_Spec_Beginning'Access, -- --|A2005 end -- --|A2012 start An_Expression_Function_Declaration => Subprogram_Spec_Beginning'Access, -- --|A2012 end A_Parameter_Specification => Component_And_Parameter_Declaration_Beginning'Access, A_Procedure_Body_Declaration .. A_Function_Body_Declaration => Subprogram_Spec_Beginning'Access, A_Package_Declaration .. -- A_Package_Body_Declaration -- An_Object_Renaming_Declaration -- An_Exception_Renaming_Declaration A_Package_Renaming_Declaration => No_Search'Access, A_Procedure_Renaming_Declaration => Subprogram_Spec_Beginning'Access, A_Function_Renaming_Declaration => Subprogram_Spec_Beginning'Access, A_Generic_Package_Renaming_Declaration .. -- A_Generic_Procedure_Renaming_Declaration -- A_Generic_Function_Renaming_Declaration -- A_Task_Body_Declaration A_Protected_Body_Declaration => No_Search'Access, An_Entry_Declaration => Possible_Overriding_Indicator_Beginning'Access, An_Entry_Body_Declaration .. An_Entry_Index_Specification => No_Search'Access, A_Procedure_Body_Stub .. A_Function_Body_Stub => Subprogram_Spec_Beginning'Access, A_Package_Body_Stub .. -- A_Task_Body_Stub A_Protected_Body_Stub => No_Search'Access, An_Exception_Declaration => Exception_Declaration_Beginning'Access, A_Choice_Parameter_Specification .. -- A_Generic_Procedure_Declaration -- A_Generic_Function_Declaration -- A_Generic_Package_Declaration A_Package_Instantiation => No_Search'Access, A_Procedure_Instantiation .. A_Function_Instantiation => Possible_Overriding_Indicator_Beginning'Access, A_Formal_Object_Declaration => Formal_Object_Declaration_Beginning'Access, A_Formal_Type_Declaration .. -- A_Formal_Procedure_Declaration -- A_Formal_Function_Declaration -- A_Formal_Package_Declaration A_Formal_Package_Declaration_With_Box => No_Search'Access, A_Derived_Type_Definition => Derived_Definition_Beginning'Access, A_Derived_Record_Extension_Definition => Derived_Definition_Beginning'Access, An_Enumeration_Type_Definition .. -- A_Signed_Integer_Type_Definition -- A_Modular_Type_Definition --------------------------------------------------------- -- !!! They all are implicit and cannot have image -- | -- |-> A_Root_Integer_Definition -- |-> A_Root_Real_Definition -- |-> A_Root_Fixed_Definition -- |-> A_Universal_Integer_Definition -- |-> A_Universal_Real_Definition -- +-> A_Universal_Fixed_Definition --------------------------------------------------------- -- A_Floating_Point_Definition -- An_Ordinary_Fixed_Point_Definition -- A_Decimal_Fixed_Point_Definition -- An_Unconstrained_Array_Definition A_Constrained_Array_Definition => No_Search'Access, A_Record_Type_Definition => Type_Definition_Beginning'Access, A_Tagged_Record_Type_Definition => Tagged_Type_Definition_Beginning'Access, -- --|A2005 start An_Ordinary_Interface .. -- A_Limited_Interface, -- A_Task_Interface, -- A_Protected_Interface, A_Synchronized_Interface => Interface_Definition_Beginning'Access, -- --|A2005 end A_Pool_Specific_Access_To_Variable .. -- An_Access_To_Variable -- An_Access_To_Constant -- An_Access_To_Procedure -- An_Access_To_Protected_Procedure -- An_Access_To_Function An_Access_To_Protected_Function => No_Search'Access, A_Subtype_Indication => Search_Subtype_Indication_Beginning'Access, A_Range_Attribute_Reference => Search_Prefix_Beginning'Access, A_Simple_Expression_Range => Simple_Expression_Range_Beginning'Access, A_Digits_Constraint .. -- A_Delta_Constraint -- An_Index_Constraint A_Discriminant_Constraint => No_Search'Access, A_Component_Definition => Component_Definition_Beginning'Access, A_Discrete_Subtype_Indication_As_Subtype_Definition => Search_Subtype_Indication_Beginning'Access, A_Discrete_Range_Attribute_Reference_As_Subtype_Definition => Search_Prefix_Beginning'Access, A_Discrete_Simple_Expression_Range_As_Subtype_Definition => Simple_Expression_Range_Beginning'Access, A_Discrete_Subtype_Indication => Search_Subtype_Indication_Beginning'Access, A_Discrete_Range_Attribute_Reference => Search_Prefix_Beginning'Access, A_Discrete_Simple_Expression_Range => Simple_Expression_Range_Beginning'Access, An_Unknown_Discriminant_Part .. A_Known_Discriminant_Part => Search_Left_Parenthesis_After'Access, A_Record_Definition .. A_Null_Record_Definition => No_Search'Access, A_Null_Component => Null_Component_Beginning'Access, A_Variant_Part .. -- A_Variant An_Others_Choice => No_Search'Access, -- --|A2005 start An_Anonymous_Access_To_Variable .. -- An_Anonymous_Access_To_Constant, -- An_Anonymous_Access_To_Procedure, -- An_Anonymous_Access_To_Protected_Procedure, -- An_Anonymous_Access_To_Function, An_Anonymous_Access_To_Protected_Function => Possible_Null_Exclusion_Beginning'Access, -- --|A2005 end A_Private_Type_Definition => Private_Type_Definition_Beginning'Access, A_Tagged_Private_Type_Definition => Private_Type_Definition_Beginning'Access, A_Private_Extension_Definition => Private_Extension_Definition_Beginning'Access, A_Task_Definition => No_Search'Access, A_Protected_Definition => No_Search'Access, A_Formal_Private_Type_Definition => Private_Type_Definition_Beginning'Access, A_Formal_Tagged_Private_Type_Definition => Private_Type_Definition_Beginning'Access, A_Formal_Derived_Type_Definition => Derived_Definition_Beginning'Access, A_Formal_Discrete_Type_Definition => No_Search'Access, A_Formal_Signed_Integer_Type_Definition .. -- A_Formal_Modular_Type_Definition -- A_Formal_Floating_Point_Definition -- A_Formal_Ordinary_Fixed_Point_Definition A_Formal_Decimal_Fixed_Point_Definition => No_Search'Access, A_Formal_Ordinary_Interface .. -- A_Formal_Limited_Interface -- A_Formal_Task_Interface -- A_Formal_Protected_Interface A_Formal_Synchronized_Interface => Interface_Definition_Beginning'Access, A_Formal_Unconstrained_Array_Definition .. -- A_Formal_Constrained_Array_Definition -- A_Formal_Pool_Specific_Access_To_Variable -- A_Formal_Access_To_Variable -- A_Formal_Access_To_Constant -- A_Formal_Access_To_Procedure -- A_Formal_Access_To_Protected_Procedure -- A_Formal_Access_To_Function A_Formal_Access_To_Protected_Function => No_Search'Access, An_Aspect_Specification => No_Search'Access, An_Integer_Literal .. -- A_Real_Literal A_String_Literal => No_Search'Access, An_Identifier => Search_Identifier_Beginning'Access, An_And_Operator .. -- An_Or_Operator -- An_Xor_Operator -- An_Equal_Operator -- A_Not_Equal_Operator -- A_Less_Than_Operator -- A_Less_Than_Or_Equal_Operator -- A_Greater_Than_Operator -- A_Greater_Than_Or_Equal_Operator -- A_Plus_Operator -- A_Minus_Operator -- A_Concatenate_Operator -- A_Unary_Plus_Operator -- A_Unary_Minus_Operator -- A_Multiply_Operator -- A_Divide_Operator -- A_Mod_Operator -- A_Rem_Operator -- An_Exponentiate_Operator -- An_Abs_Operator -- A_Not_Operator -- A_Character_Literal An_Enumeration_Literal => No_Search'Access, An_Explicit_Dereference => Explicit_Dereference_Beginning'Access, A_Function_Call => Function_Call_Beginning'Access, An_Indexed_Component => Indexed_Component_Beginning'Access, A_Slice => Indexed_Component_Beginning'Access, A_Selected_Component .. -- An_Access_Attribute -- An_Address_Attribute -- An_Adjacent_Attribute -- An_Aft_Attribute -- An_Alignment_Attribute -- A_Base_Attribute -- A_Bit_Order_Attribute -- A_Body_Version_Attribute -- A_Callable_Attribute -- A_Caller_Attribute -- A_Ceiling_Attribute -- A_Class_Attribute -- A_Component_Size_Attribute -- A_Compose_Attribute -- A_Constrained_Attribute -- A_Copy_Sign_Attribute -- A_Count_Attribute -- A_Definite_Attribute -- A_Delta_Attribute -- A_Denorm_Attribute -- A_Digits_Attribute -- An_Exponent_Attribute -- An_External_Tag_Attribute -- A_First_Attribute -- A_First_Bit_Attribute -- A_Floor_Attribute -- A_Fore_Attribute -- A_Fraction_Attribute -- An_Identity_Attribute -- An_Image_Attribute -- An_Input_Attribute -- A_Last_Attribute -- A_Last_Bit_Attribute -- A_Leading_Part_Attribute -- A_Length_Attribute -- A_Machine_Attribute -- A_Machine_Emax_Attribute -- A_Machine_Emin_Attribute -- A_Machine_Mantissa_Attribute -- A_Machine_Overflows_Attribute -- A_Machine_Radix_Attribute -- A_Machine_Rounds_Attribute -- A_Max_Attribute -- A_Max_Size_In_Storage_Elements_Attribute -- A_Min_Attribute -- A_Model_Attribute -- A_Model_Emin_Attribute -- A_Model_Epsilon_Attribute -- A_Model_Mantissa_Attribute -- A_Model_Small_Attribute -- A_Modulus_Attribute -- An_Output_Attribute -- A_Partition_ID_Attribute -- A_Pos_Attribute -- A_Position_Attribute -- A_Pred_Attribute -- A_Range_Attribute -- A_Read_Attribute -- A_Remainder_Attribute -- A_Round_Attribute -- A_Rounding_Attribute -- A_Safe_First_Attribute -- A_Safe_Last_Attribute -- A_Scale_Attribute -- A_Scaling_Attribute -- A_Signed_Zeros_Attribute -- A_Size_Attribute -- A_Small_Attribute -- A_Storage_Pool_Attribute -- A_Storage_Size_Attribute -- A_Succ_Attribute -- A_Tag_Attribute -- A_Terminated_Attribute -- A_Truncation_Attribute -- An_Unbiased_Rounding_Attribute -- An_Unchecked_Access_Attribute -- A_Val_Attribute -- A_Valid_Attribute -- A_Value_Attribute -- A_Version_Attribute -- A_Wide_Image_Attribute -- A_Wide_Value_Attribute -- A_Wide_Width_Attribute -- A_Width_Attribute -- A_Write_Attribute -- An_Implementation_Defined_Attribute An_Unknown_Attribute => Search_Prefix_Beginning'Access, A_Record_Aggregate .. -- An_Extension_Aggregate -- An_Positional_Array_Aggregate A_Named_Array_Aggregate => No_Search'Access, An_And_Then_Short_Circuit .. An_Or_Else_Short_Circuit => Short_Circuit_Beginning'Access, An_In_Membership_Test .. A_Not_In_Membership_Test => Membership_Test_Beginning'Access, A_Null_Literal => No_Search'Access, A_Parenthesized_Expression => Parenthesized_Expression_Beginning'Access, A_Type_Conversion => Search_Prefix_Beginning'Access, A_Qualified_Expression => Search_Prefix_Beginning'Access, An_Allocation_From_Subtype => No_Search'Access, An_Allocation_From_Qualified_Expression => No_Search'Access, -- --|A2012 start A_Case_Expression => No_Search'Access, An_If_Expression => If_Expression_Beginning'Access, -- --|A2012 end A_Pragma_Argument_Association => Association_Beginning'Access, A_Discriminant_Association => Association_Beginning'Access, A_Record_Component_Association => Component_Association_Beginning'Access, An_Array_Component_Association => Component_Association_Beginning'Access, A_Parameter_Association => Association_Beginning'Access, A_Generic_Association => No_Search'Access, A_Null_Statement => No_Search'Access, An_Assignment_Statement => Assignment_Statement_Beginning'Access, An_If_Statement => No_Search'Access, A_Case_Statement => No_Search'Access, A_Loop_Statement => Named_Statement_Beginning'Access, A_While_Loop_Statement => While_Loop_Statement_Beginning'Access, A_For_Loop_Statement => For_Loop_Statement_Beginning'Access, A_Block_Statement => Named_Statement_Beginning'Access, An_Exit_Statement => No_Search'Access, A_Goto_Statement => No_Search'Access, A_Procedure_Call_Statement => Call_Statement_Beginning'Access, A_Return_Statement => No_Search'Access, An_Accept_Statement => No_Search'Access, An_Entry_Call_Statement => Call_Statement_Beginning'Access, A_Requeue_Statement .. -- A_Requeue_Statement_With_Abort -- A_Delay_Until_Statement -- A_Delay_Relative_Statement -- A_Terminate_Alternative_Statement -- A_Selective_Accept_Statement -- A_Timed_Entry_Call_Statement -- A_Conditional_Entry_Call_Statement -- An_Asynchronous_Select_Statement -- An_Abort_Statement -- A_Raise_Statement -- A_Code_Statement -- An_If_Path -- NOTE: There is no explicit node in GNAT AST tree corresponding to -- this Internal_Element_Kind's. It's supposed that corresponding -- Element's record field contains Source_Ptr type value that points to -- word IF. -- If it isn't so, we should change this part. -- I believe it's more correct to have A_Then_Path in spite of -- An_If_Path which should point to the word THEN. An_Elsif_Path => No_Search'Access, An_Else_Path => Else_Path_Beginning'Access, A_Case_Path => No_Search'Access, A_Select_Path .. -- NOTE: There is no explicit node in GNAT AST tree corresponding to -- this Internal_Element_Kind's. It's supposed that corresponding -- Element's record field contains Source_Ptr type value that -- points to word SELECT. -- If it isn't so, we should change this part. An_Or_Path => Select_Alternative_Beginning'Access, -- NOTE: There is no explicit node in GNAT AST tree corresponding to -- this Internal_Element_Kind's. It's supposed that corresponding -- Element's record field contains Source_Ptr type value that points to -- word OR. If it isn't so, we should change this part. A_Then_Abort_Path => A_Then_Abort_Path_Beginning'Access, -- --|A2015 start A_Case_Expression_Path => Case_Expression_Path_Beginning'Access, An_If_Expression_Path .. An_Elsif_Expression_Path => Conditional_Expression_Path_Beginning'Access, An_Else_Expression_Path => An_Else_Expression_Path_Beginning'Access, -- --|A2015 end A_Use_Package_Clause .. -- A_Use_Type_Clause A_Use_All_Type_Clause => No_Search'Access, -- Ada 2012 A_With_Clause => With_Clause_Beginning'Access, An_Attribute_Definition_Clause .. -- An_Enumeration_Representation_Clause -- A_Record_Representation_Clause An_At_Clause => No_Search'Access, A_Component_Clause => Component_Clause_Beginning'Access, An_Exception_Handler => No_Search'Access, others => No_Search'Access); end A4G.Span_Beginning;
shintakezou/drake
Ada
4,576
adb
with System.Debug; -- assertions with C.basetsd; with C.winbase; with C.windef; with C.winnt; package body System.System_Allocators is pragma Suppress (All_Checks); use type Storage_Elements.Storage_Offset; use type C.windef.WINBOOL; -- use type C.basetsd.SIZE_T; -- use type C.windef.DWORD; function Round_Up (Size : C.basetsd.SIZE_T) return C.basetsd.SIZE_T; function Round_Up (Size : C.basetsd.SIZE_T) return C.basetsd.SIZE_T is use type C.basetsd.SIZE_T; Result : C.basetsd.SIZE_T; begin -- do round up here since HeapSize always returns the same size -- that is passed to HeapAlloc -- heap memory is separated to 16, 24, 32... by Windows heap manager if Size < 16 then Result := 16; else Result := (Size + 7) and not 7; end if; return Result; end Round_Up; -- implementation function Allocate (Size : Storage_Elements.Storage_Count) return Address is begin return Address ( C.winbase.HeapAlloc ( C.winbase.GetProcessHeap, 0, Round_Up (C.basetsd.SIZE_T (Size)))); end Allocate; function Allocate ( Size : Storage_Elements.Storage_Count; Alignment : Storage_Elements.Storage_Count) return Address is Result : Address := Allocate (Size); begin if Result mod Alignment /= 0 then Free (Result); Result := Null_Address; end if; -- Should it use aligned_malloc/aligned_free? return Result; end Allocate; procedure Free (Storage_Address : Address) is Success : C.windef.WINBOOL; begin Success := C.winbase.HeapFree ( C.winbase.GetProcessHeap, 0, C.windef.LPVOID (Storage_Address)); pragma Check (Debug, Check => Success /= C.windef.FALSE or else Debug.Runtime_Error ("HeapFree failed")); end Free; function Reallocate ( Storage_Address : Address; Size : Storage_Elements.Storage_Count) return Address is Actual_Size : constant C.basetsd.SIZE_T := Round_Up (C.basetsd.SIZE_T (Size)); Heap : constant C.winnt.HANDLE := C.winbase.GetProcessHeap; Result : Address; begin Result := Address ( C.winbase.HeapReAlloc ( Heap, 0, C.windef.LPVOID (Storage_Address), Actual_Size)); if Result = Null_Address then if Storage_Address = Null_Address then -- Reallocate (null, ...) Result := Address (C.winbase.HeapAlloc (Heap, 0, Actual_Size)); end if; end if; return Result; end Reallocate; function Page_Size return Storage_Elements.Storage_Count is Info : aliased C.winbase.SYSTEM_INFO; begin C.winbase.GetSystemInfo (Info'Access); return Storage_Elements.Storage_Offset (Info.dwPageSize); end Page_Size; function Map ( Storage_Address : Address; Size : Storage_Elements.Storage_Count) return Address is use type C.windef.DWORD; Mapped_Address : C.windef.LPVOID; begin if Storage_Address /= Null_Address then -- VirtualAlloc and VirtualFree should be one-to-one correspondence return Null_Address; end if; Mapped_Address := C.winbase.VirtualAlloc ( C.windef.LPVOID (Null_Address), C.basetsd.SIZE_T (Size), C.winnt.MEM_RESERVE or C.winnt.MEM_COMMIT, C.winnt.PAGE_READWRITE); return Address (Mapped_Address); end Map; procedure Unmap ( Storage_Address : Address; Size : Storage_Elements.Storage_Count) is begin declare Success : C.windef.WINBOOL; begin Success := C.winbase.VirtualFree ( C.windef.LPVOID (Storage_Address), C.basetsd.SIZE_T (Size), C.winnt.MEM_DECOMMIT); pragma Check (Debug, Check => Success /= C.windef.FALSE or else Debug.Runtime_Error ( "VirtualFree (..., MEM_DECOMMIT) failed")); end; declare Success : C.windef.WINBOOL; begin Success := C.winbase.VirtualFree ( C.windef.LPVOID (Storage_Address), 0, C.winnt.MEM_RELEASE); pragma Check (Debug, Check => Success /= C.windef.FALSE or else Debug.Runtime_Error ( "VirtualFree (..., MEM_RELEASE) failed")); end; end Unmap; end System.System_Allocators;
jrcarter/Ada_GUI
Ada
5,550
adb
-- -- -- package Object.Tasking Copyright (c) Dmitry A. Kazakov -- -- Implementation Luebeck -- -- Winter, 2009 -- -- Multiple tasking version -- -- Last revision : 10:33 11 May 2019 -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public License as -- -- published by the Free Software Foundation; either version 2 of -- -- the License, or (at your option) any later version. This 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 -- -- General Public License for more details. You should have -- -- received a copy of the GNU General Public License along with -- -- this library; if not, write to the Free Software Foundation, -- -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- -- -- -- 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. -- --____________________________________________________________________-- with Ada.Exceptions; use Ada.Exceptions; with Ada.Tags; use Ada.Tags; with Ada.Unchecked_Deallocation; with System; use type System.Address; package body Object is Decrement_Error : exception; protected Lock is procedure Decrement ( Object : in out Entity'Class; New_Value : out Natural ); procedure Increment (Object : in out Entity'Class); private pragma Inline (Decrement); pragma Inline (Increment); end Lock; protected body Lock is procedure Decrement ( Object : in out Entity'Class; New_Value : out Natural ) is begin if Object.Use_Count = 0 then raise Decrement_Error; else Object.Use_Count := Object.Use_Count - 1; New_Value := Object.Use_Count; end if; end Decrement; procedure Increment (Object : in out Entity'Class) is begin Object.Use_Count := Object.Use_Count + 1; end Increment; end Lock; function Equal ( Left : Entity; Right : Entity'Class; Flag : Boolean := False ) return Boolean is begin if Flag or else Right in Entity then return Left'Address = Right'Address; else return Equal (Right, Left, True); end if; end Equal; procedure Finalize (Object : in out Entity) is begin if 0 /= Object.Use_Count then Raise_Exception ( Program_Error'Identity, ( Ada.Tags.Expanded_Name (Entity'Class (Object)'Tag) & " is still in use" ) ); end if; end Finalize; procedure Decrement_Count ( Object : in out Entity; Use_Count : out Natural ) is begin Lock.Decrement (Object, Use_Count); exception when Decrement_Error => Raise_Exception ( Program_Error'Identity, ( Ada.Tags.Expanded_Name (Entity'Class (Object)'Tag) & " has zero count" ) ); end Decrement_Count; procedure Increment_Count (Object : in out Entity) is begin Lock.Increment (Object); end Increment_Count; procedure Initialize (Object : in out Entity) is begin null; end Initialize; function Less ( Left : Entity; Right : Entity'Class; Flag : Boolean := False ) return Boolean is begin if Flag or else Right in Entity then return Left'Address < Right'Address; else return not ( Less (Right, Left, True) or else Equal (Right, Left, True) ); end if; end Less; procedure Put_Traceback (Object : Entity'Class) is begin null; end Put_Traceback; procedure Release (Ptr : in out Entity_Ptr) is procedure Free is new Ada.Unchecked_Deallocation (Entity'Class, Entity_Ptr); begin if Ptr /= null then declare Object : Entity'Class renames Ptr.all; Count : Natural; begin Decrement_Count (Object, Count); if Count > 0 then return; end if; end; Free (Ptr); end if; end Release; procedure Set_Trace_File (File : String) is begin null; end Set_Trace_File; end Object;
pdaxrom/Kino2
Ada
3,559
ads
------------------------------------------------------------------------------ -- -- -- GNAT ncurses Binding Samples -- -- -- -- Sample.Keyboard_Handler -- -- -- -- S P E C -- -- -- ------------------------------------------------------------------------------ -- Copyright (c) 1998 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 -- Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en -- Version Control -- $Revision: 1.8 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; -- This package contains a centralized keyboard handler used throughout -- this example. The handler establishes a timeout mechanism that provides -- periodical updates of the common header lines used in this example. -- package Sample.Keyboard_Handler is function Get_Key (Win : Window := Standard_Window) return Real_Key_Code; -- The central routine for handling keystrokes. procedure Init_Keyboard_Handler; -- Initialize the keyboard end Sample.Keyboard_Handler;
stcarrez/dynamo
Ada
11,978
ads
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . U T I L -- -- -- -- S p e c -- -- -- -- Copyright (C) 2001-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Utilities for use in processing project files package Prj.Util is function Executable_Of (Project : Project_Id; Shared : Shared_Project_Tree_Data_Access; Main : File_Name_Type; Index : Int; Ada_Main : Boolean := True; Language : String := ""; Include_Suffix : Boolean := True) return File_Name_Type; -- Return the value of the attribute Builder'Executable for file Main in -- the project Project, if it exists. If there is no attribute Executable -- for Main, remove the suffix from Main; then, if the attribute -- Executable_Suffix is specified, add this suffix, otherwise add the -- standard executable suffix for the platform. -- -- If Include_Suffix is true, then the ".exe" suffix (or any suffix defined -- in the config) will be added. The suffix defined by the user in his own -- project file is always taken into account. Otherwise, such a suffix is -- not added. In particular, the prefix should not be added if you are -- potentially testing for cross-platforms, since the suffix might not be -- known (its default value comes from the ...-gnatmake prefix). -- -- What is Ada_Main??? -- What is Language??? procedure Put (Into_List : in out Name_List_Index; From_List : String_List_Id; In_Tree : Project_Tree_Ref; Lower_Case : Boolean := False); -- Append a name list to a string list -- Describe parameters??? procedure Duplicate (This : in out Name_List_Index; Shared : Shared_Project_Tree_Data_Access); -- Duplicate a name list function Value_Of (Variable : Variable_Value; Default : String) return String; -- Get the value of a single string variable. If Variable is a string list, -- is Nil_Variable_Value,or is defaulted, return Default. function Value_Of (Index : Name_Id; In_Array : Array_Element_Id; Shared : Shared_Project_Tree_Data_Access) return Name_Id; -- Get a single string array component. Returns No_Name if there is no -- component Index, if In_Array is null, or if the component is a String -- list. Depending on the attribute (only attributes may be associative -- arrays) the index may or may not be case sensitive. If the index is not -- case sensitive, it is first set to lower case before the search in the -- associative array. function Value_Of (Index : Name_Id; Src_Index : Int := 0; In_Array : Array_Element_Id; Shared : Shared_Project_Tree_Data_Access; Force_Lower_Case_Index : Boolean := False; Allow_Wildcards : Boolean := False) return Variable_Value; -- Get a string array component (single String or String list). Returns -- Nil_Variable_Value if no component Index or if In_Array is null. -- -- Depending on the attribute (only attributes may be associative arrays) -- the index may or may not be case sensitive. If the index is not case -- sensitive, it is first set to lower case before the search in the -- associative array. function Value_Of (Name : Name_Id; Index : Int := 0; Attribute_Or_Array_Name : Name_Id; In_Package : Package_Id; Shared : Shared_Project_Tree_Data_Access; Force_Lower_Case_Index : Boolean := False; Allow_Wildcards : Boolean := False) return Variable_Value; -- In a specific package: -- - if there exists an array Attribute_Or_Array_Name with an index Name, -- returns the corresponding component (depending on the attribute, the -- index may or may not be case sensitive, see previous function), -- - otherwise if there is a single attribute Attribute_Or_Array_Name, -- returns this attribute, -- - otherwise, returns Nil_Variable_Value. -- If In_Package is null, returns Nil_Variable_Value. function Value_Of (Index : Name_Id; In_Array : Name_Id; In_Arrays : Array_Id; Shared : Shared_Project_Tree_Data_Access) return Name_Id; -- Get a string array component in an array of an array list. Returns -- No_Name if there is no component Index, if In_Arrays is null, if -- In_Array is not found in In_Arrays or if the component is a String list. function Value_Of (Name : Name_Id; In_Arrays : Array_Id; Shared : Shared_Project_Tree_Data_Access) return Array_Element_Id; -- Returns a specified array in an array list. Returns No_Array_Element -- if In_Arrays is null or if Name is not the name of an array in -- In_Arrays. The caller must ensure that Name is in lower case. function Value_Of (Name : Name_Id; In_Packages : Package_Id; Shared : Shared_Project_Tree_Data_Access) return Package_Id; -- Returns a specified package in a package list. Returns No_Package -- if In_Packages is null or if Name is not the name of a package in -- Package_List. The caller must ensure that Name is in lower case. function Value_Of (Variable_Name : Name_Id; In_Variables : Variable_Id; Shared : Shared_Project_Tree_Data_Access) return Variable_Value; -- Returns a specified variable in a variable list. Returns null if -- In_Variables is null or if Variable_Name is not the name of a -- variable in In_Variables. Caller must ensure that Name is lower case. procedure Write_Str (S : String; Max_Length : Positive; Separator : Character); -- Output string S using Output.Write_Str. If S is too long to fit in one -- line of Max_Length, cut it in several lines, using Separator as the last -- character of each line, if possible. type Text_File is limited private; -- Represents a text file (default is invalid text file) function Is_Valid (File : Text_File) return Boolean; -- Returns True if File designates an open text file that has not yet been -- closed. procedure Open (File : out Text_File; Name : String); -- Open a text file to read (File is invalid if text file cannot be opened) procedure Create (File : out Text_File; Name : String); -- Create a text file to write (File is invalid if text file cannot be -- created). function End_Of_File (File : Text_File) return Boolean; -- Returns True if the end of the text file File has been reached. Fails if -- File is invalid. Return True if File is an out file. procedure Get_Line (File : Text_File; Line : out String; Last : out Natural); -- Reads a line from an open text file (fails if File is invalid or in an -- out file). procedure Put (File : Text_File; S : String); procedure Put_Line (File : Text_File; Line : String); -- Output a string or a line to an out text file (fails if File is invalid -- or in an in file). procedure Close (File : in out Text_File); -- Close an open text file. File becomes invalid. Fails if File is already -- invalid or if an out file cannot be closed successfully. ----------------------- -- Source info files -- ----------------------- procedure Write_Source_Info_File (Tree : Project_Tree_Ref); -- Create a new source info file, with the path name specified in the -- project tree data. Issue a warning if it is not possible to create -- the new file. procedure Read_Source_Info_File (Tree : Project_Tree_Ref); -- Check if there is a source info file specified for the project Tree. If -- so, attempt to read it. If the file exists and is successfully read, set -- the flag Source_Info_File_Exists to True for the tree. type Source_Info_Data is record Project : Name_Id; Language : Name_Id; Kind : Source_Kind; Display_Path_Name : Name_Id; Path_Name : Name_Id; Unit_Name : Name_Id := No_Name; Index : Int := 0; Naming_Exception : Naming_Exception_Type := No; end record; -- Data read from a source info file for a single source type Source_Info is access all Source_Info_Data; No_Source_Info : constant Source_Info := null; type Source_Info_Iterator is private; -- Iterator to get the sources for a single project procedure Initialize (Iter : out Source_Info_Iterator; For_Project : Name_Id); -- Initialize Iter for the project function Source_Info_Of (Iter : Source_Info_Iterator) return Source_Info; -- Get the source info for the source corresponding to the current value of -- the iterator. Returns No_Source_Info if there is no source corresponding -- to the iterator. procedure Next (Iter : in out Source_Info_Iterator); -- Advance the iterator to the next source in the project generic with procedure Action (Source : Source_Id); procedure For_Interface_Sources (Tree : Project_Tree_Ref; Project : Project_Id); -- Call Action for every sources that are needed to use Project. This is -- either the sources corresponding to the units in attribute Interfaces -- or all sources of the project. Note that only the bodies that are -- needed (because the unit is generic or contains some inline pragmas) -- are handled. This routine must be called only when the project has -- been built successfully. private type Text_File_Data is record FD : File_Descriptor := Invalid_FD; Out_File : Boolean := False; Buffer : String (1 .. 1_000); Buffer_Len : Natural := 0; Cursor : Natural := 0; End_Of_File_Reached : Boolean := False; end record; type Text_File is access Text_File_Data; type Source_Info_Iterator is record Info : Source_Info; Next : Natural; end record; end Prj.Util;
onox/sdlada
Ada
3,441
adb
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2013-2018 Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- with Ada.Unchecked_Conversion; with Interfaces.C.Strings; with SDL.Error; with System; package body SDL.Libraries is package C renames Interfaces.C; procedure Load (Self : out Handles; Name : in String) is function SDL_Load_Object (C_Str : in C.Strings.chars_ptr) return Internal_Handle_Access with Import => True, Convention => C, External_Name => "SDL_LoadObject"; C_Str : C.Strings.chars_ptr := C.Strings.New_String (Name); begin Self.Internal := SDL_Load_Object (C_Str); C.Strings.Free (C_Str); if Self.Internal = null then raise Library_Error with SDL.Error.Get; end if; end Load; procedure Unload (Self : in out Handles) is procedure SDL_Unload_Object (H : in Internal_Handle_Access) with Import => True, Convention => C, External_Name => "SDL_UnloadObject"; begin SDL_Unload_Object (Self.Internal); Self.Internal := null; end Unload; function Load_Sub_Program (From_Library : in Handles) return Access_To_Sub_Program is -- TODO: How can I get rid of this Address use? function To_Sub_Program is new Ada.Unchecked_Conversion (Source => System.Address, Target => Access_To_Sub_Program); function SDL_Load_Function (H : in Internal_Handle_Access; N : in C.Strings.chars_ptr) return System.Address with Import => True, Convention => C, External_Name => "SDL_LoadFunction"; C_Str : C.Strings.chars_ptr := C.Strings.New_String (Name); Func_Ptr : constant System.Address := SDL_Load_Function (From_Library.Internal, C_Str); use type System.Address; begin C.Strings.Free (C_Str); if Func_Ptr = System.Null_Address then raise Library_Error with SDL.Error.Get; end if; -- return To_Sub_Program (Func_Ptr); return To_Sub_Program (Func_Ptr); end Load_Sub_Program; overriding procedure Finalize (Self : in out Handles) is begin -- In case the user has already called Unload or Finalize on a derived type. if Self.Internal /= null then Unload (Self); end if; end Finalize; end SDL.Libraries;
AdaCore/Ada_Drivers_Library
Ada
11,666
adb
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- -- This file is based on: -- -- @file stm32f746g_discovery_audio.c -- -- @author MCD Application Team -- ------------------------------------------------------------------------------ with HAL; use HAL; with STM32; use STM32; with STM32.Device; use STM32.Device; with STM32.Board; use STM32.Board; with STM32.GPIO; use STM32.GPIO; with STM32.DMA; use STM32.DMA; with STM32.SAI; use STM32.SAI; with STM32.Setup; package body Audio is Audio_SAI : SAI_Controller renames SAI_2; SAI2_MCLK_A : GPIO_Point renames PI4; SAI2_SCK_A : GPIO_Point renames PI5; SAI2_SD_A : GPIO_Point renames PI6; SAI2_SD_B : GPIO_Point renames PG10; SAI2_FS_A : GPIO_Point renames PI7; SAI_Pins : constant GPIO_Points := (SAI2_MCLK_A, SAI2_SCK_A, SAI2_SD_A, SAI2_SD_B, SAI2_FS_A); SAI_Pins_AF : GPIO_Alternate_Function renames GPIO_AF_SAI2_10; -- SAI in/out conf SAI_Out_Block : SAI_Block renames Block_A; -- SAI_In_Block : SAI_Block renames Block_B; procedure Set_Audio_Clock (Freq : Audio_Frequency); procedure Initialize_Audio_Out_Pins; procedure Initialize_SAI_Out (Freq : Audio_Frequency); procedure Initialize_Audio_I2C; --------------------- -- Set_Audio_Clock -- --------------------- procedure Set_Audio_Clock (Freq : Audio_Frequency) is begin -- Two groups of frequencies: the 44kHz family and the 48kHz family -- The Actual audio frequency is calculated then with the following -- formula: -- Master_Clock = 256 * FS = SAI_CK / Master_Clock_Divider -- We need to find a value of SAI_CK that allows such integer master -- clock divider case Freq is when Audio_Freq_11kHz | Audio_Freq_22kHz | Audio_Freq_32kHz | Audio_Freq_44kHz => -- HSE/PLLM = 1MHz = PLLI2S VCO Input Configure_SAI_I2S_Clock (Audio_SAI, PLLI2SN => 429, -- VCO Output = 429MHz PLLI2SQ => 2, -- SAI Clk(First level) = 214.5 MHz PLLI2SDIVQ => 19); -- I2S Clk = 215.4 / 19 = 11.289 MHz when Audio_Freq_8kHz | Audio_Freq_16kHz | Audio_Freq_48kHz | Audio_Freq_96kHz => Configure_SAI_I2S_Clock (Audio_SAI, PLLI2SN => 344, -- VCO Output = 344MHz PLLI2SQ => 7, -- SAI Clk(First level) = 49.142 MHz PLLI2SDIVQ => 1); -- I2S Clk = 49.142 MHz end case; end Set_Audio_Clock; ------------------------------- -- Initialize_Audio_Out_Pins -- ------------------------------- procedure Initialize_Audio_Out_Pins is begin Enable_Clock (Audio_SAI); Enable_Clock (SAI_Pins); Configure_IO (SAI_Pins, (Mode => Mode_AF, AF => SAI_Pins_AF, AF_Output_Type => Push_Pull, AF_Speed => Speed_High, Resistors => Floating)); Enable_Clock (Audio_DMA); -- Configure the DMA channel to the SAI peripheral Disable (Audio_DMA, Audio_DMA_Out_Stream); Configure (Audio_DMA, Audio_DMA_Out_Stream, (Channel => Audio_DMA_Out_Channel, Direction => Memory_To_Peripheral, Increment_Peripheral_Address => False, Increment_Memory_Address => True, Peripheral_Data_Format => HalfWords, Memory_Data_Format => HalfWords, Operation_Mode => Circular_Mode, Priority => Priority_High, FIFO_Enabled => True, FIFO_Threshold => FIFO_Threshold_Full_Configuration, Memory_Burst_Size => Memory_Burst_Single, Peripheral_Burst_Size => Peripheral_Burst_Single)); Clear_All_Status (Audio_DMA, Audio_DMA_Out_Stream); end Initialize_Audio_Out_Pins; ------------------------ -- Initialize_SAI_Out -- ------------------------ procedure Initialize_SAI_Out (Freq : Audio_Frequency) is begin STM32.SAI.Disable (Audio_SAI, SAI_Out_Block); STM32.SAI.Configure_Audio_Block (Audio_SAI, SAI_Out_Block, Frequency => Audio_Frequency'Enum_Rep (Freq), Stereo_Mode => Stereo, Mode => Master_Transmitter, MCD_Enabled => True, Protocol => Free_Protocol, Data_Size => Data_16b, Endianness => Data_MSB_First, Clock_Strobing => Clock_Strobing_Rising_Edge, Synchronization => Asynchronous_Mode, Output_Drive => Drive_Immediate, FIFO_Threshold => FIFO_1_Quarter_Full); STM32.SAI.Configure_Block_Frame (Audio_SAI, SAI_Out_Block, Frame_Length => 64, Frame_Active => 32, Frame_Sync => FS_Frame_And_Channel_Identification, FS_Polarity => FS_Active_Low, FS_Offset => Before_First_Bit); STM32.SAI.Configure_Block_Slot (Audio_SAI, SAI_Out_Block, First_Bit_Offset => 0, Slot_Size => Data_Size, Number_Of_Slots => 4, Enabled_Slots => Slot_0 or Slot_2); STM32.SAI.Enable (Audio_SAI, SAI_Out_Block); end Initialize_SAI_Out; -------------------------- -- Initialize_Audio_I2C -- -------------------------- procedure Initialize_Audio_I2C is begin STM32.Setup.Setup_I2C_Master (Port => Audio_I2C, SDA => Audio_I2C_SDA, SCL => Audio_I2C_SCL, SDA_AF => Audio_I2C_AF, SCL_AF => Audio_I2C_AF, Clock_Speed => 100_000); end Initialize_Audio_I2C; ---------------- -- Initialize -- ---------------- procedure Initialize_Audio_Out (This : in out WM8994_Audio_Device; Volume : Audio_Volume; Frequency : Audio_Frequency) is begin STM32.SAI.Deinitialize (Audio_SAI, SAI_Out_Block); Set_Audio_Clock (Frequency); -- Initialize the SAI Initialize_Audio_Out_Pins; Initialize_SAI_Out (Frequency); -- Initialize the I2C Port to send commands to the driver Initialize_Audio_I2C; if This.Device.Read_ID /= WM8994.WM8994_ID then raise Constraint_Error with "Invalid ID received from the Audio Code"; end if; This.Device.Reset; This.Device.Init (Input => WM8994.No_Input, Output => WM8994.Auto, Volume => UInt8 (Volume), Frequency => WM8994.Audio_Frequency'Enum_Val (Audio_Frequency'Enum_Rep (Frequency))); end Initialize_Audio_Out; ---------- -- Play -- ---------- procedure Play (This : in out WM8994_Audio_Device; Buffer : Audio_Buffer) is begin This.Device.Play; Start_Transfer_with_Interrupts (This => Audio_DMA, Stream => Audio_DMA_Out_Stream, Source => Buffer (Buffer'First)'Address, Destination => Audio_SAI.ADR'Address, Data_Count => Buffer'Length, Enabled_Interrupts => (Half_Transfer_Complete_Interrupt => True, Transfer_Complete_Interrupt => True, others => False)); Enable_DMA (Audio_SAI, SAI_Out_Block); if not Enabled (Audio_SAI, SAI_Out_Block) then Enable (Audio_SAI, SAI_Out_Block); end if; end Play; ----------- -- Pause -- ----------- procedure Pause (This : in out WM8994_Audio_Device) is begin This.Device.Pause; DMA_Pause (Audio_SAI, SAI_Out_Block); end Pause; ------------ -- Resume -- ------------ procedure Resume (This : in out WM8994_Audio_Device) is begin This.Device.Resume; DMA_Resume (Audio_SAI, SAI_Out_Block); end Resume; ---------- -- Stop -- ---------- procedure Stop (This : in out WM8994_Audio_Device) is begin This.Device.Stop (WM8994.Stop_Power_Down_Sw); DMA_Stop (Audio_SAI, SAI_Out_Block); STM32.DMA.Disable (Audio_DMA, Audio_DMA_Out_Stream); STM32.DMA.Clear_All_Status (Audio_DMA, Audio_DMA_Out_Stream); end Stop; ---------------- -- Set_Volume -- ---------------- procedure Set_Volume (This : in out WM8994_Audio_Device; Volume : Audio_Volume) is begin This.Device.Set_Volume (UInt8 (Volume)); end Set_Volume; ------------------- -- Set_Frequency -- ------------------- procedure Set_Frequency (This : in out WM8994_Audio_Device; Frequency : Audio_Frequency) is pragma Unreferenced (This); begin Set_Audio_Clock (Frequency); STM32.SAI.Disable (Audio_SAI, SAI_Out_Block); Initialize_SAI_Out (Frequency); STM32.SAI.Enable (Audio_SAI, SAI_Out_Block); end Set_Frequency; end Audio;
zhmu/ananas
Ada
433
ads
-- { dg-do compile } -- { dg-options "-O" } with Discr4_Pkg; use Discr4_Pkg; package Discr4 is type Data is record Val : Rec; Set : Boolean; end record; type Pair is record Lower, Upper : Data; end record; function Build (L, U : Rec) return Pair is ((L, True), (U, False)); C1 : constant Pair := Build (Rec_One, Rec_Three); C2 : constant Pair := Build (Get (0), Rec_Three); end Discr4;
gspu/synth
Ada
26,398
adb
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt with Ada.Text_IO; with JohnnyText; with Signals; with Unix; package body Display is package JT renames JohnnyText; package SIG renames Signals; package TIO renames Ada.Text_IO; ---------------------- -- launch_monitor -- ---------------------- function launch_monitor (num_builders : builders) return Boolean is begin if not Start_Curses_Mode then TIO.Put_Line ("Failed to enter curses modes"); return False; end if; if not TIC.Has_Colors or else not establish_colors then Return_To_Text_Mode; TIO.Put_Line ("The TERM environment variable value (" & Unix.env_variable_value ("TERM") & ") does not support colors."); TIO.Put_Line ("Falling back to text mode."); return False; end if; begin TIC.Set_Echo_Mode (False); TIC.Set_Raw_Mode (True); TIC.Set_Cbreak_Mode (True); TIC.Set_Cursor_Visibility (Visibility => cursor_vis); exception when TIC.Curses_Exception => Return_To_Text_Mode; return False; end; builders_used := Integer (num_builders); if not launch_summary_zone or else not launch_builders_zone or else not launch_actions_zone then terminate_monitor; return False; end if; draw_static_summary_zone; draw_static_builders_zone; Refresh_Zone (summary); Refresh_Zone (builder); return True; end launch_monitor; ------------------------- -- terminate_monitor -- ------------------------- procedure terminate_monitor is ok : Boolean := True; begin -- zone_window can't be used because Delete will modify Win variable begin TIC.Delete (Win => zone_summary); TIC.Delete (Win => zone_builders); TIC.Delete (Win => zone_actions); exception when TIC.Curses_Exception => ok := False; end; if ok then Return_To_Text_Mode; end if; end terminate_monitor; ----------------------------------- -- set_full_redraw_next_update -- ----------------------------------- procedure set_full_redraw_next_update is begin draw_static_summary_zone; draw_static_builders_zone; for zone in zones'Range loop begin TIC.Redraw (Win => zone_window (zone)); exception when TIC.Curses_Exception => null; end; end loop; end set_full_redraw_next_update; --------------------------- -- launch_summary_zone -- --------------------------- function launch_summary_zone return Boolean is begin zone_summary := TIC.Create (Number_Of_Lines => 2, Number_Of_Columns => app_width, First_Line_Position => 0, First_Column_Position => 0); return True; exception when TIC.Curses_Exception => return False; end launch_summary_zone; -------------------------------- -- draw_static_summary_zone -- -------------------------------- procedure draw_static_summary_zone is line1 : constant appline := custom_message (message => " Total Built Ignored " & " Load 0.00 Pkg/hour ", attribute => bright, pen_color => c_sumlabel); line2 : constant appline := custom_message (message => " Left Failed Skipped " & " Swap 0.0% Impulse 00:00:00 ", attribute => bright, pen_color => c_sumlabel); begin Scrawl (summary, line1, 0); Scrawl (summary, line2, 1); end draw_static_summary_zone; ---------------------------- -- launch_builders_zone -- ---------------------------- function launch_builders_zone return Boolean is hghtint : constant Integer := 4 + builders_used; height : constant TIC.Line_Position := TIC.Line_Position (hghtint); begin zone_builders := TIC.Create (Number_Of_Lines => height, Number_Of_Columns => app_width, First_Line_Position => 2, First_Column_Position => 0); return True; exception when TIC.Curses_Exception => return False; end launch_builders_zone; --------------------------------- -- draw_static_builders_zone -- --------------------------------- procedure draw_static_builders_zone is hghtint : constant Integer := 4 + builders_used; height : constant TIC.Line_Position := TIC.Line_Position (hghtint); lastrow : constant TIC.Line_Position := inc (height, -1); dmsg : constant String (appline'Range) := (others => '='); dashes : constant appline := custom_message (message => dmsg, attribute => bright, pen_color => c_dashes); headtxt : constant appline := custom_message (message => " ID Duration Build Phase Origin " & " Lines ", attribute => normal, pen_color => c_tableheader); begin Scrawl (builder, dashes, 0); Scrawl (builder, dashes, 2); Scrawl (builder, dashes, lastrow); if SIG.graceful_shutdown_requested then Scrawl (builder, shutdown_message, 1); else Scrawl (builder, headtxt, 1); end if; for z in 3 .. inc (lastrow, -1) loop Scrawl (builder, blank_line, z); end loop; end draw_static_builders_zone; --------------------------- -- launch_actions_zone -- --------------------------- function launch_actions_zone return Boolean is consumed : constant Integer := builders_used + 4 + 2; viewpos : constant TIC.Line_Position := TIC.Line_Position (consumed); difference : Integer := 0 - consumed; use type TIC.Line_Position; begin historyheight := inc (TIC.Lines, difference); -- Make sure history window lines range from 10 to 50 if historyheight < 10 then historyheight := 10; elsif historyheight > TIC.Line_Position (cyclic_range'Last) then historyheight := TIC.Line_Position (cyclic_range'Last); end if; zone_actions := TIC.Create (Number_Of_Lines => historyheight, Number_Of_Columns => app_width, First_Line_Position => viewpos, First_Column_Position => 0); return True; exception when TIC.Curses_Exception => return False; end launch_actions_zone; ----------- -- inc -- ----------- function inc (X : TIC.Line_Position; by : Integer) return TIC.Line_Position is use type TIC.Line_Position; begin return X + TIC.Line_Position (by); end inc; ----------------- -- summarize -- ----------------- procedure summarize (data : summary_rec) is function pad (S : String; amount : Positive := 5) return String; procedure colorado (S : String; color : TIC.Color_Pair; col : TIC.Column_Position; row : TIC.Line_Position; dim : Boolean := False); remaining : constant Integer := data.Initially - data.Built - data.Failed - data.Ignored - data.Skipped; function pad (S : String; amount : Positive := 5) return String is result : String (1 .. amount) := (others => ' '); slen : constant Natural := S'Length; begin if slen <= amount then result (1 .. slen) := S; else result := S (S'First .. S'First + amount - 1); end if; return result; end pad; procedure colorado (S : String; color : TIC.Color_Pair; col : TIC.Column_Position; row : TIC.Line_Position; dim : Boolean := False) is info : TIC.Attributed_String := custom_message (message => S, attribute => emphasis (dim), pen_color => color); begin Scrawl (summary, info, row, col); end colorado; L1F1 : constant String := pad (JT.int2str (data.Initially)); L1F2 : constant String := pad (JT.int2str (data.Built)); L1F3 : constant String := pad (JT.int2str (data.Ignored)); L1F4 : fivelong; L1F5 : constant String := pad (JT.int2str (data.pkg_hour), 4); L2F1 : constant String := pad (JT.int2str (remaining)); L2F2 : constant String := pad (JT.int2str (data.Failed)); L2F3 : constant String := pad (JT.int2str (data.Skipped)); L2F4 : fivelong; L2F5 : constant String := pad (JT.int2str (data.impulse), 4); begin if data.swap = 100.0 then L2F4 := " 100%"; elsif data.swap > 100.0 then L2F4 := " n/a"; else L2F4 := fmtpc (data.swap, True); end if; if data.load >= 100.0 then L1F4 := pad (JT.int2str (Integer (data.load))); else L1F4 := fmtload (data.load); end if; colorado (L1F1, c_standard, 7, 0); colorado (L1F2, c_success, 21, 0); colorado (L1F3, c_ignored, 36, 0); colorado (L1F4, c_standard, 48, 0, True); colorado (L1F5, c_standard, 64, 0, True); colorado (L2F1, c_standard, 7, 1); colorado (L2F2, c_failure, 21, 1); colorado (L2F3, c_skipped, 36, 1); colorado (L2F4, c_standard, 48, 1, True); colorado (L2F5, c_standard, 64, 1, True); colorado (data.elapsed, c_elapsed, 70, 1); Refresh_Zone (summary); end summarize; ----------------------- -- update_builder -- ----------------------- procedure update_builder (BR : builder_rec) is procedure colorado (S : String; color : TIC.Color_Pair; col : TIC.Column_Position; row : TIC.Line_Position; dim : Boolean := False); procedure print_id; row : TIC.Line_Position := inc (TIC.Line_Position (BR.id), 2); procedure print_id is info : TIC.Attributed_String := custom_message (message => BR.slavid, attribute => c_slave (BR.id).attribute, pen_color => c_slave (BR.id).palette); begin Scrawl (builder, info, row, 1); end print_id; procedure colorado (S : String; color : TIC.Color_Pair; col : TIC.Column_Position; row : TIC.Line_Position; dim : Boolean := False) is info : TIC.Attributed_String := custom_message (message => S, attribute => emphasis (dim), pen_color => color); begin Scrawl (builder, info, row, col); end colorado; begin if SIG.graceful_shutdown_requested then Scrawl (builder, shutdown_message, 1); end if; print_id; colorado (BR.Elapsed, c_standard, 5, row, True); colorado (BR.phase, c_bldphase, 15, row, True); colorado (BR.origin, c_origin, 32, row, False); colorado (BR.LLines, c_standard, 71, row, True); end update_builder; ------------------------------ -- refresh_builder_window -- ------------------------------ procedure refresh_builder_window is begin Refresh_Zone (builder); end refresh_builder_window; ---------------------- -- insert_history -- ---------------------- procedure insert_history (HR : history_rec) is begin if history_arrow = cyclic_range'Last then history_arrow := cyclic_range'First; else history_arrow := history_arrow + 1; end if; history (history_arrow) := HR; end insert_history; ------------------------------ -- refresh_history_window -- ------------------------------ procedure refresh_history_window is procedure clear_row (row : TIC.Line_Position); procedure colorado (S : String; color : TIC.Color_Pair; col : TIC.Column_Position; row : TIC.Line_Position; dim : Boolean := False); function col_action (status : String) return TIC.Color_Pair; procedure print_id (id : builders; sid : String; row : TIC.Line_Position; status : String); procedure clear_row (row : TIC.Line_Position) is begin Scrawl (action, blank_line, row); end clear_row; procedure colorado (S : String; color : TIC.Color_Pair; col : TIC.Column_Position; row : TIC.Line_Position; dim : Boolean := False) is info : TIC.Attributed_String := custom_message (message => S, attribute => emphasis (dim), pen_color => color); begin Scrawl (action, info, row, col); end colorado; function col_action (status : String) return TIC.Color_Pair is begin if status = "shutdown" then return c_shutdown; elsif status = "success " then return c_success; elsif status = "failure " then return c_failure; elsif status = "skipped " then return c_skipped; elsif status = "ignored " then return c_ignored; else return c_standard; end if; end col_action; procedure print_id (id : builders; sid : String; row : TIC.Line_Position; status : String) is bracket : TIC.Attributed_String := custom_message (message => "[--]", attribute => normal, pen_color => c_standard); bindex : Positive := 2; begin if status /= "skipped " and then status /= "ignored " then for index in sid'Range loop bracket (bindex) := (Attr => c_slave (id).attribute, Color => c_slave (id).palette, Ch => sid (index)); bindex := bindex + 1; end loop; end if; Scrawl (action, bracket, row, 10); end print_id; arrow : cyclic_range := history_arrow; maxrow : Natural; row : TIC.Line_Position; begin -- historyheight guaranteed to be no bigger than cyclic_range maxrow := Integer (historyheight) - 1; for rowindex in 0 .. maxrow loop row := TIC.Line_Position (rowindex); if history (arrow).established then colorado (history (arrow).run_elapsed, c_standard, 1, row, True); print_id (id => history (arrow).id, sid => history (arrow).slavid, row => row, status => history (arrow).action); colorado (history (arrow).action, col_action (history (arrow).action), 15, row); colorado (history (arrow).origin, c_origin, 24, row); colorado (history (arrow).pkg_elapsed, c_standard, 70, row, True); else clear_row (row); end if; if arrow = cyclic_range'First then arrow := cyclic_range'Last; else arrow := arrow - 1; end if; end loop; Refresh_Zone (action); end refresh_history_window; ------------------------ -- establish_colors -- ------------------------ function establish_colors return Boolean is begin TIC.Start_Color; begin TIC.Init_Pair (TIC.Color_Pair (1), TIC.White, TIC.Black); TIC.Init_Pair (TIC.Color_Pair (2), TIC.Green, TIC.Black); TIC.Init_Pair (TIC.Color_Pair (3), TIC.Red, TIC.Black); TIC.Init_Pair (TIC.Color_Pair (4), TIC.Yellow, TIC.Black); TIC.Init_Pair (TIC.Color_Pair (5), TIC.Black, TIC.Black); TIC.Init_Pair (TIC.Color_Pair (6), TIC.Cyan, TIC.Black); TIC.Init_Pair (TIC.Color_Pair (7), TIC.Blue, TIC.Black); TIC.Init_Pair (TIC.Color_Pair (8), TIC.Magenta, TIC.Black); TIC.Init_Pair (TIC.Color_Pair (9), TIC.Blue, TIC.White); exception when TIC.Curses_Exception => return False; end; c_standard := TIC.Color_Pair (1); c_success := TIC.Color_Pair (2); c_failure := TIC.Color_Pair (3); c_ignored := TIC.Color_Pair (4); c_skipped := TIC.Color_Pair (5); c_sumlabel := TIC.Color_Pair (6); c_dashes := TIC.Color_Pair (7); c_elapsed := TIC.Color_Pair (4); c_tableheader := TIC.Color_Pair (1); c_origin := TIC.Color_Pair (6); c_bldphase := TIC.Color_Pair (4); c_shutdown := TIC.Color_Pair (1); c_advisory := TIC.Color_Pair (4); c_slave (1).palette := TIC.Color_Pair (1); -- white / Black c_slave (1).attribute := bright; c_slave (2).palette := TIC.Color_Pair (2); -- light green / Black c_slave (2).attribute := bright; c_slave (3).palette := TIC.Color_Pair (4); -- yellow / Black c_slave (3).attribute := bright; c_slave (4).palette := TIC.Color_Pair (8); -- light magenta / Black c_slave (4).attribute := bright; c_slave (5).palette := TIC.Color_Pair (3); -- light red / Black c_slave (5).attribute := bright; c_slave (6).palette := TIC.Color_Pair (7); -- light blue / Black c_slave (6).attribute := bright; c_slave (7).palette := TIC.Color_Pair (6); -- light cyan / Black c_slave (7).attribute := bright; c_slave (8).palette := TIC.Color_Pair (5); -- dark grey / Black c_slave (8).attribute := bright; c_slave (9).palette := TIC.Color_Pair (1); -- light grey / Black c_slave (9).attribute := normal; c_slave (10).palette := TIC.Color_Pair (2); -- light green / Black c_slave (10).attribute := normal; c_slave (11).palette := TIC.Color_Pair (4); -- brown / Black c_slave (11).attribute := normal; c_slave (12).palette := TIC.Color_Pair (8); -- dark magenta / Black c_slave (12).attribute := normal; c_slave (13).palette := TIC.Color_Pair (3); -- dark red / Black c_slave (13).attribute := normal; c_slave (14).palette := TIC.Color_Pair (7); -- dark blue / Black c_slave (14).attribute := normal; c_slave (15).palette := TIC.Color_Pair (6); -- dark cyan / Black c_slave (15).attribute := normal; c_slave (16).palette := TIC.Color_Pair (9); -- white / dark blue c_slave (16).attribute := normal; for bld in builders (17) .. builders (32) loop c_slave (bld) := c_slave (bld - 16); c_slave (bld).attribute.Under_Line := True; end loop; for bld in builders (33) .. builders (64) loop c_slave (bld) := c_slave (bld - 32); end loop; return True; end establish_colors; ------------------------------------------------------------------------ -- zone_window ------------------------------------------------------------------------ function zone_window (zone : zones) return TIC.Window is begin case zone is when builder => return zone_builders; when summary => return zone_summary; when action => return zone_actions; end case; end zone_window; ------------------------------------------------------------------------ -- Scrawl ------------------------------------------------------------------------ procedure Scrawl (zone : zones; information : TIC.Attributed_String; at_line : TIC.Line_Position; at_column : TIC.Column_Position := 0) is begin TIC.Add (Win => zone_window (zone), Line => at_line, Column => at_column, Str => information, Len => information'Length); exception when TIC.Curses_Exception => null; end Scrawl; ------------------------------------------------------------------------ -- Return_To_Text_Mode ------------------------------------------------------------------------ procedure Return_To_Text_Mode is begin TIC.End_Windows; exception when TIC.Curses_Exception => null; end Return_To_Text_Mode; ------------------------------------------------------------------------ -- Refresh_Zone ------------------------------------------------------------------------ procedure Refresh_Zone (zone : zones) is begin TIC.Refresh (Win => zone_window (zone)); exception when TIC.Curses_Exception => null; end Refresh_Zone; ------------------------------------------------------------------------ -- Start_Curses_Mode ------------------------------------------------------------------------ function Start_Curses_Mode return Boolean is begin TIC.Init_Screen; return True; exception when TIC.Curses_Exception => return False; end Start_Curses_Mode; ------------------------------------------------------------------------ -- blank_line ------------------------------------------------------------------------ function blank_line return appline is space : TIC.Attributed_Character := (Attr => TIC.Normal_Video, Color => c_standard, Ch => ' '); product : appline := (others => space); begin return product; end blank_line; ------------------------------------------------------------------------ -- custom_message ------------------------------------------------------------------------ function custom_message (message : String; attribute : TIC.Character_Attribute_Set; pen_color : TIC.Color_Pair) return TIC.Attributed_String is product : TIC.Attributed_String (1 .. message'Length); pindex : Positive := 1; begin for index in message'Range loop product (pindex) := (Attr => attribute, Color => pen_color, Ch => message (index)); pindex := pindex + 1; end loop; return product; end custom_message; ------------------------------------------------------------------------ -- shutdown_message ------------------------------------------------------------------------ function shutdown_message return appline is data : constant String := " Graceful shutdown in progress, " & "so no new tasks will be started. "; product : appline := custom_message (message => data, attribute => bright, pen_color => c_advisory); begin return product; end shutdown_message; ------------------------------------------------------------------------ -- emphasis ------------------------------------------------------------------------ function emphasis (dimmed : Boolean) return TIC.Character_Attribute_Set is begin if dimmed then return normal; else return bright; end if; end emphasis; ------------------------------------------------------------------------ -- fmtpc ------------------------------------------------------------------------ function fmtpc (f : Float; percent : Boolean) return fivelong is type loadtype is delta 0.01 digits 4; result : fivelong := (others => ' '); raw1 : constant loadtype := loadtype (f); raw2 : constant String := raw1'Img; raw3 : constant String := raw2 (2 .. raw2'Last); rlen : constant Natural := raw3'Length; start : constant Natural := 6 - rlen; begin result (start .. 5) := raw3; if percent then result (5) := '%'; end if; return result; end fmtpc; ------------------------------------------------------------------------ -- fmtload ------------------------------------------------------------------------ function fmtload (f : Float) return fivelong is type loadtype is delta 0.01 digits 4; result : fivelong := (others => ' '); begin if f < 100.0 then return fmtpc (f, False); elsif f < 1000.0 then declare type loadtype is delta 0.1 digits 4; raw1 : constant loadtype := loadtype (f); begin return JT.trim (raw1'Img); end; elsif f < 10000.0 then declare raw1 : constant Integer := Integer (f); begin -- preceded by space, 1000.0 .. 9999.99, should be 5 chars return raw1'Img; end; elsif f < 100000.0 then declare raw1 : constant Integer := Integer (f); begin -- 100000.0 .. 99999.9 return JT.trim (raw1'Img); end; else return "100k+"; end if; exception when others => return "ERROR"; end fmtload; end Display;
optikos/oasis
Ada
5,827
adb
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- package body Program.Nodes.Task_Body_Stubs is function Create (Task_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Body_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access; Is_Token : not null Program.Lexical_Elements .Lexical_Element_Access; Separate_Token : not null 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 Task_Body_Stub is begin return Result : Task_Body_Stub := (Task_Token => Task_Token, Body_Token => Body_Token, Name => Name, Is_Token => Is_Token, Separate_Token => Separate_Token, With_Token => With_Token, Aspects => Aspects, Semicolon_Token => Semicolon_Token, Enclosing_Element => null) do Initialize (Result); end return; end Create; function Create (Name : not null Program.Elements.Defining_Identifiers .Defining_Identifier_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_Task_Body_Stub is begin return Result : Implicit_Task_Body_Stub := (Name => Name, 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 Name (Self : Base_Task_Body_Stub) return not null Program.Elements.Defining_Identifiers .Defining_Identifier_Access is begin return Self.Name; end Name; overriding function Aspects (Self : Base_Task_Body_Stub) return Program.Elements.Aspect_Specifications .Aspect_Specification_Vector_Access is begin return Self.Aspects; end Aspects; overriding function Task_Token (Self : Task_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Task_Token; end Task_Token; overriding function Body_Token (Self : Task_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Body_Token; end Body_Token; overriding function Is_Token (Self : Task_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Is_Token; end Is_Token; overriding function Separate_Token (Self : Task_Body_Stub) return not null Program.Lexical_Elements.Lexical_Element_Access is begin return Self.Separate_Token; end Separate_Token; overriding function With_Token (Self : Task_Body_Stub) return Program.Lexical_Elements.Lexical_Element_Access is begin return Self.With_Token; end With_Token; overriding function Semicolon_Token (Self : Task_Body_Stub) 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_Task_Body_Stub) return Boolean is begin return Self.Is_Part_Of_Implicit; end Is_Part_Of_Implicit; overriding function Is_Part_Of_Inherited (Self : Implicit_Task_Body_Stub) return Boolean is begin return Self.Is_Part_Of_Inherited; end Is_Part_Of_Inherited; overriding function Is_Part_Of_Instance (Self : Implicit_Task_Body_Stub) return Boolean is begin return Self.Is_Part_Of_Instance; end Is_Part_Of_Instance; procedure Initialize (Self : aliased in out Base_Task_Body_Stub'Class) is begin Set_Enclosing_Element (Self.Name, Self'Unchecked_Access); for Item in Self.Aspects.Each_Element loop Set_Enclosing_Element (Item.Element, Self'Unchecked_Access); end loop; null; end Initialize; overriding function Is_Task_Body_Stub_Element (Self : Base_Task_Body_Stub) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Task_Body_Stub_Element; overriding function Is_Declaration_Element (Self : Base_Task_Body_Stub) return Boolean is pragma Unreferenced (Self); begin return True; end Is_Declaration_Element; overriding procedure Visit (Self : not null access Base_Task_Body_Stub; Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is begin Visitor.Task_Body_Stub (Self); end Visit; overriding function To_Task_Body_Stub_Text (Self : aliased in out Task_Body_Stub) return Program.Elements.Task_Body_Stubs.Task_Body_Stub_Text_Access is begin return Self'Unchecked_Access; end To_Task_Body_Stub_Text; overriding function To_Task_Body_Stub_Text (Self : aliased in out Implicit_Task_Body_Stub) return Program.Elements.Task_Body_Stubs.Task_Body_Stub_Text_Access is pragma Unreferenced (Self); begin return null; end To_Task_Body_Stub_Text; end Program.Nodes.Task_Body_Stubs;
reznikmm/matreshka
Ada
16,414
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.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_Messages is ------------------- -- Enter_Element -- ------------------- overriding procedure Enter_Element (Self : not null access constant UML_Message_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_Message (AMF.UML.Messages.UML_Message_Access (Self), Control); end if; end Enter_Element; ------------------- -- Leave_Element -- ------------------- overriding procedure Leave_Element (Self : not null access constant UML_Message_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_Message (AMF.UML.Messages.UML_Message_Access (Self), Control); end if; end Leave_Element; ------------------- -- Visit_Element -- ------------------- overriding procedure Visit_Element (Self : not null access constant UML_Message_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_Message (Visitor, AMF.UML.Messages.UML_Message_Access (Self), Control); end if; end Visit_Element; ------------------ -- Get_Argument -- ------------------ overriding function Get_Argument (Self : not null access constant UML_Message_Proxy) return AMF.UML.Value_Specifications.Collections.Ordered_Set_Of_UML_Value_Specification is begin return AMF.UML.Value_Specifications.Collections.Wrap (AMF.Internals.Element_Collections.Wrap (AMF.Internals.Tables.UML_Attributes.Internal_Get_Argument (Self.Element))); end Get_Argument; ------------------- -- Get_Connector -- ------------------- overriding function Get_Connector (Self : not null access constant UML_Message_Proxy) return AMF.UML.Connectors.UML_Connector_Access is begin return AMF.UML.Connectors.UML_Connector_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Connector (Self.Element))); end Get_Connector; ------------------- -- Set_Connector -- ------------------- overriding procedure Set_Connector (Self : not null access UML_Message_Proxy; To : AMF.UML.Connectors.UML_Connector_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Connector (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Connector; --------------------- -- Get_Interaction -- --------------------- overriding function Get_Interaction (Self : not null access constant UML_Message_Proxy) return AMF.UML.Interactions.UML_Interaction_Access is begin return AMF.UML.Interactions.UML_Interaction_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Interaction (Self.Element))); end Get_Interaction; --------------------- -- Set_Interaction -- --------------------- overriding procedure Set_Interaction (Self : not null access UML_Message_Proxy; To : AMF.UML.Interactions.UML_Interaction_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Interaction (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Interaction; ---------------------- -- Get_Message_Kind -- ---------------------- overriding function Get_Message_Kind (Self : not null access constant UML_Message_Proxy) return AMF.UML.UML_Message_Kind is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Message_Kind (Self.Element); end Get_Message_Kind; ---------------------- -- Get_Message_Sort -- ---------------------- overriding function Get_Message_Sort (Self : not null access constant UML_Message_Proxy) return AMF.UML.UML_Message_Sort is begin return AMF.Internals.Tables.UML_Attributes.Internal_Get_Message_Sort (Self.Element); end Get_Message_Sort; ---------------------- -- Set_Message_Sort -- ---------------------- overriding procedure Set_Message_Sort (Self : not null access UML_Message_Proxy; To : AMF.UML.UML_Message_Sort) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Message_Sort (Self.Element, To); end Set_Message_Sort; ----------------------- -- Get_Receive_Event -- ----------------------- overriding function Get_Receive_Event (Self : not null access constant UML_Message_Proxy) return AMF.UML.Message_Ends.UML_Message_End_Access is begin return AMF.UML.Message_Ends.UML_Message_End_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Receive_Event (Self.Element))); end Get_Receive_Event; ----------------------- -- Set_Receive_Event -- ----------------------- overriding procedure Set_Receive_Event (Self : not null access UML_Message_Proxy; To : AMF.UML.Message_Ends.UML_Message_End_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Receive_Event (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Receive_Event; -------------------- -- Get_Send_Event -- -------------------- overriding function Get_Send_Event (Self : not null access constant UML_Message_Proxy) return AMF.UML.Message_Ends.UML_Message_End_Access is begin return AMF.UML.Message_Ends.UML_Message_End_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Send_Event (Self.Element))); end Get_Send_Event; -------------------- -- Set_Send_Event -- -------------------- overriding procedure Set_Send_Event (Self : not null access UML_Message_Proxy; To : AMF.UML.Message_Ends.UML_Message_End_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Send_Event (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Send_Event; ------------------- -- Get_Signature -- ------------------- overriding function Get_Signature (Self : not null access constant UML_Message_Proxy) return AMF.UML.Named_Elements.UML_Named_Element_Access is begin return AMF.UML.Named_Elements.UML_Named_Element_Access (AMF.Internals.Helpers.To_Element (AMF.Internals.Tables.UML_Attributes.Internal_Get_Signature (Self.Element))); end Get_Signature; ------------------- -- Set_Signature -- ------------------- overriding procedure Set_Signature (Self : not null access UML_Message_Proxy; To : AMF.UML.Named_Elements.UML_Named_Element_Access) is begin AMF.Internals.Tables.UML_Attributes.Internal_Set_Signature (Self.Element, AMF.Internals.Helpers.To_Element (AMF.Elements.Element_Access (To))); end Set_Signature; --------------------------- -- Get_Client_Dependency -- --------------------------- overriding function Get_Client_Dependency (Self : not null access constant UML_Message_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_Message_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_Message_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_Message_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_Message_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; ------------------ -- Message_Kind -- ------------------ overriding function Message_Kind (Self : not null access constant UML_Message_Proxy) return AMF.UML.UML_Message_Kind is begin -- Generated stub: replace with real body! pragma Compile_Time_Warning (Standard.True, "Message_Kind unimplemented"); raise Program_Error with "Unimplemented procedure UML_Message_Proxy.Message_Kind"; return Message_Kind (Self); end Message_Kind; ------------------------- -- All_Owning_Packages -- ------------------------- overriding function All_Owning_Packages (Self : not null access constant UML_Message_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_Message_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_Message_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_Message_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_Message_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_Message_Proxy.Namespace"; return Namespace (Self); end Namespace; end AMF.Internals.UML_Messages;
MatrixMike/AdaDemo1
Ada
668
adb
with Ada.Text_IO; use Ada.Text_IO; --05.02.2018 20:19:12 --http://www.radford.edu/nokie/classes/320/Tour/procs.funcs.html procedure demo is procedure printlines (numLines, numChars : Natural; c : Character) is begin for i in 1 .. numLines loop for j in 1 .. numChars loop -- put('x'); Put (c); end loop; New_Line; end loop; end printlines; --procedure half(given: natural) is --begin -- Put_Line(given / 2 ); --end half; -- no need for declare here upper : constant Integer := 12; begin printlines (2, upper, '='); -- do something printlines (3, 20, '-'); -- half (10) ; end demo;
twdroeger/ada-awa
Ada
36,397
ads
----------------------------------------------------------------------- -- AWA.Workspaces.Models -- AWA.Workspaces.Models ----------------------------------------------------------------------- -- File generated by ada-gen DO NOT MODIFY -- Template used: templates/model/package-spec.xhtml -- Ada Generator: https://ada-gen.googlecode.com/svn/trunk Revision 1095 ----------------------------------------------------------------------- -- Copyright (C) 2019 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- pragma Warnings (Off); with ADO.Sessions; with ADO.Objects; with ADO.Statements; with ADO.SQL; with ADO.Schemas; with ADO.Queries; with ADO.Queries.Loaders; with Ada.Calendar; with Ada.Containers.Vectors; with Ada.Strings.Unbounded; with Util.Beans.Objects; with Util.Beans.Basic.Lists; with AWA.Users.Models; with Util.Beans.Methods; pragma Warnings (On); package AWA.Workspaces.Models is pragma Style_Checks ("-mr"); type Workspace_Ref is new ADO.Objects.Object_Ref with null record; type Workspace_Member_Ref is new ADO.Objects.Object_Ref with null record; type Invitation_Ref is new ADO.Objects.Object_Ref with null record; type Workspace_Feature_Ref is new ADO.Objects.Object_Ref with null record; -- -------------------- -- The workspace controls the features available in the application -- for a set of users: the workspace members. A user could create -- several workspaces and be part of several workspaces that other -- users have created. -- -------------------- -- Create an object key for Workspace. function Workspace_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key; -- Create an object key for Workspace from a string. -- Raises Constraint_Error if the string cannot be converted into the object key. function Workspace_Key (Id : in String) return ADO.Objects.Object_Key; Null_Workspace : constant Workspace_Ref; function "=" (Left, Right : Workspace_Ref'Class) return Boolean; -- Set the workspace identifier procedure Set_Id (Object : in out Workspace_Ref; Value : in ADO.Identifier); -- Get the workspace identifier function Get_Id (Object : in Workspace_Ref) return ADO.Identifier; -- function Get_Version (Object : in Workspace_Ref) return Integer; -- procedure Set_Create_Date (Object : in out Workspace_Ref; Value : in Ada.Calendar.Time); -- function Get_Create_Date (Object : in Workspace_Ref) return Ada.Calendar.Time; -- procedure Set_Owner (Object : in out Workspace_Ref; Value : in AWA.Users.Models.User_Ref'Class); -- function Get_Owner (Object : in Workspace_Ref) return AWA.Users.Models.User_Ref'Class; -- Load the entity identified by 'Id'. -- Raises the NOT_FOUND exception if it does not exist. procedure Load (Object : in out Workspace_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier); -- Load the entity identified by 'Id'. -- Returns True in <b>Found</b> if the object was found and False if it does not exist. procedure Load (Object : in out Workspace_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean); -- Find and load the entity. overriding procedure Find (Object : in out Workspace_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); -- Save the entity. If the entity does not have an identifier, an identifier is allocated -- and it is inserted in the table. Otherwise, only data fields which have been changed -- are updated. overriding procedure Save (Object : in out Workspace_Ref; Session : in out ADO.Sessions.Master_Session'Class); -- Delete the entity. overriding procedure Delete (Object : in out Workspace_Ref; Session : in out ADO.Sessions.Master_Session'Class); overriding function Get_Value (From : in Workspace_Ref; Name : in String) return Util.Beans.Objects.Object; -- Table definition WORKSPACE_TABLE : constant ADO.Schemas.Class_Mapping_Access; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Workspace_Ref); -- Copy of the object. procedure Copy (Object : in Workspace_Ref; Into : in out Workspace_Ref); -- -------------------- -- The workspace member indicates the users who -- are part of the workspace. The join_date is NULL when -- a user was invited but has not accepted the invitation. -- -------------------- -- Create an object key for Workspace_Member. function Workspace_Member_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key; -- Create an object key for Workspace_Member from a string. -- Raises Constraint_Error if the string cannot be converted into the object key. function Workspace_Member_Key (Id : in String) return ADO.Objects.Object_Key; Null_Workspace_Member : constant Workspace_Member_Ref; function "=" (Left, Right : Workspace_Member_Ref'Class) return Boolean; -- procedure Set_Id (Object : in out Workspace_Member_Ref; Value : in ADO.Identifier); -- function Get_Id (Object : in Workspace_Member_Ref) return ADO.Identifier; -- Set the date when the user has joined the workspace. procedure Set_Join_Date (Object : in out Workspace_Member_Ref; Value : in ADO.Nullable_Time); -- Get the date when the user has joined the workspace. function Get_Join_Date (Object : in Workspace_Member_Ref) return ADO.Nullable_Time; -- Set the member role. procedure Set_Role (Object : in out Workspace_Member_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String); procedure Set_Role (Object : in out Workspace_Member_Ref; Value : in String); -- Get the member role. function Get_Role (Object : in Workspace_Member_Ref) return Ada.Strings.Unbounded.Unbounded_String; function Get_Role (Object : in Workspace_Member_Ref) return String; -- procedure Set_Member (Object : in out Workspace_Member_Ref; Value : in AWA.Users.Models.User_Ref'Class); -- function Get_Member (Object : in Workspace_Member_Ref) return AWA.Users.Models.User_Ref'Class; -- procedure Set_Workspace (Object : in out Workspace_Member_Ref; Value : in AWA.Workspaces.Models.Workspace_Ref'Class); -- function Get_Workspace (Object : in Workspace_Member_Ref) return AWA.Workspaces.Models.Workspace_Ref'Class; -- Load the entity identified by 'Id'. -- Raises the NOT_FOUND exception if it does not exist. procedure Load (Object : in out Workspace_Member_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier); -- Load the entity identified by 'Id'. -- Returns True in <b>Found</b> if the object was found and False if it does not exist. procedure Load (Object : in out Workspace_Member_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean); -- Find and load the entity. overriding procedure Find (Object : in out Workspace_Member_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); -- Save the entity. If the entity does not have an identifier, an identifier is allocated -- and it is inserted in the table. Otherwise, only data fields which have been changed -- are updated. overriding procedure Save (Object : in out Workspace_Member_Ref; Session : in out ADO.Sessions.Master_Session'Class); -- Delete the entity. overriding procedure Delete (Object : in out Workspace_Member_Ref; Session : in out ADO.Sessions.Master_Session'Class); overriding function Get_Value (From : in Workspace_Member_Ref; Name : in String) return Util.Beans.Objects.Object; -- Table definition WORKSPACE_MEMBER_TABLE : constant ADO.Schemas.Class_Mapping_Access; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Workspace_Member_Ref); -- Copy of the object. procedure Copy (Object : in Workspace_Member_Ref; Into : in out Workspace_Member_Ref); -- Create an object key for Invitation. function Invitation_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key; -- Create an object key for Invitation from a string. -- Raises Constraint_Error if the string cannot be converted into the object key. function Invitation_Key (Id : in String) return ADO.Objects.Object_Key; Null_Invitation : constant Invitation_Ref; function "=" (Left, Right : Invitation_Ref'Class) return Boolean; -- Set the invitation identifier. procedure Set_Id (Object : in out Invitation_Ref; Value : in ADO.Identifier); -- Get the invitation identifier. function Get_Id (Object : in Invitation_Ref) return ADO.Identifier; -- Get version optimistic lock. function Get_Version (Object : in Invitation_Ref) return Integer; -- Set date when the invitation was created and sent. procedure Set_Create_Date (Object : in out Invitation_Ref; Value : in Ada.Calendar.Time); -- Get date when the invitation was created and sent. function Get_Create_Date (Object : in Invitation_Ref) return Ada.Calendar.Time; -- Set the email address to which the invitation was sent. procedure Set_Email (Object : in out Invitation_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String); procedure Set_Email (Object : in out Invitation_Ref; Value : in String); -- Get the email address to which the invitation was sent. function Get_Email (Object : in Invitation_Ref) return Ada.Strings.Unbounded.Unbounded_String; function Get_Email (Object : in Invitation_Ref) return String; -- Set the invitation message. procedure Set_Message (Object : in out Invitation_Ref; Value : in Ada.Strings.Unbounded.Unbounded_String); procedure Set_Message (Object : in out Invitation_Ref; Value : in String); -- Get the invitation message. function Get_Message (Object : in Invitation_Ref) return Ada.Strings.Unbounded.Unbounded_String; function Get_Message (Object : in Invitation_Ref) return String; -- Set the date when the invitation was accepted. procedure Set_Acceptance_Date (Object : in out Invitation_Ref; Value : in ADO.Nullable_Time); -- Get the date when the invitation was accepted. function Get_Acceptance_Date (Object : in Invitation_Ref) return ADO.Nullable_Time; -- Set the workspace where the user is invited. procedure Set_Workspace (Object : in out Invitation_Ref; Value : in AWA.Workspaces.Models.Workspace_Ref'Class); -- Get the workspace where the user is invited. function Get_Workspace (Object : in Invitation_Ref) return AWA.Workspaces.Models.Workspace_Ref'Class; -- procedure Set_Access_Key (Object : in out Invitation_Ref; Value : in AWA.Users.Models.Access_Key_Ref'Class); -- function Get_Access_Key (Object : in Invitation_Ref) return AWA.Users.Models.Access_Key_Ref'Class; -- Set the user being invited. procedure Set_Invitee (Object : in out Invitation_Ref; Value : in AWA.Users.Models.User_Ref'Class); -- Get the user being invited. function Get_Invitee (Object : in Invitation_Ref) return AWA.Users.Models.User_Ref'Class; -- procedure Set_Inviter (Object : in out Invitation_Ref; Value : in AWA.Users.Models.User_Ref'Class); -- function Get_Inviter (Object : in Invitation_Ref) return AWA.Users.Models.User_Ref'Class; -- procedure Set_Member (Object : in out Invitation_Ref; Value : in AWA.Workspaces.Models.Workspace_Member_Ref'Class); -- function Get_Member (Object : in Invitation_Ref) return AWA.Workspaces.Models.Workspace_Member_Ref'Class; -- Load the entity identified by 'Id'. -- Raises the NOT_FOUND exception if it does not exist. procedure Load (Object : in out Invitation_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier); -- Load the entity identified by 'Id'. -- Returns True in <b>Found</b> if the object was found and False if it does not exist. procedure Load (Object : in out Invitation_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean); -- Find and load the entity. overriding procedure Find (Object : in out Invitation_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); -- Save the entity. If the entity does not have an identifier, an identifier is allocated -- and it is inserted in the table. Otherwise, only data fields which have been changed -- are updated. overriding procedure Save (Object : in out Invitation_Ref; Session : in out ADO.Sessions.Master_Session'Class); -- Delete the entity. overriding procedure Delete (Object : in out Invitation_Ref; Session : in out ADO.Sessions.Master_Session'Class); overriding function Get_Value (From : in Invitation_Ref; Name : in String) return Util.Beans.Objects.Object; -- Table definition INVITATION_TABLE : constant ADO.Schemas.Class_Mapping_Access; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Invitation_Ref); -- Copy of the object. procedure Copy (Object : in Invitation_Ref; Into : in out Invitation_Ref); -- Create an object key for Workspace_Feature. function Workspace_Feature_Key (Id : in ADO.Identifier) return ADO.Objects.Object_Key; -- Create an object key for Workspace_Feature from a string. -- Raises Constraint_Error if the string cannot be converted into the object key. function Workspace_Feature_Key (Id : in String) return ADO.Objects.Object_Key; Null_Workspace_Feature : constant Workspace_Feature_Ref; function "=" (Left, Right : Workspace_Feature_Ref'Class) return Boolean; -- procedure Set_Id (Object : in out Workspace_Feature_Ref; Value : in ADO.Identifier); -- function Get_Id (Object : in Workspace_Feature_Ref) return ADO.Identifier; -- procedure Set_Limit (Object : in out Workspace_Feature_Ref; Value : in Integer); -- function Get_Limit (Object : in Workspace_Feature_Ref) return Integer; -- procedure Set_Workspace (Object : in out Workspace_Feature_Ref; Value : in AWA.Workspaces.Models.Workspace_Ref'Class); -- function Get_Workspace (Object : in Workspace_Feature_Ref) return AWA.Workspaces.Models.Workspace_Ref'Class; -- Load the entity identified by 'Id'. -- Raises the NOT_FOUND exception if it does not exist. procedure Load (Object : in out Workspace_Feature_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier); -- Load the entity identified by 'Id'. -- Returns True in <b>Found</b> if the object was found and False if it does not exist. procedure Load (Object : in out Workspace_Feature_Ref; Session : in out ADO.Sessions.Session'Class; Id : in ADO.Identifier; Found : out Boolean); -- Find and load the entity. overriding procedure Find (Object : in out Workspace_Feature_Ref; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); -- Save the entity. If the entity does not have an identifier, an identifier is allocated -- and it is inserted in the table. Otherwise, only data fields which have been changed -- are updated. overriding procedure Save (Object : in out Workspace_Feature_Ref; Session : in out ADO.Sessions.Master_Session'Class); -- Delete the entity. overriding procedure Delete (Object : in out Workspace_Feature_Ref; Session : in out ADO.Sessions.Master_Session'Class); overriding function Get_Value (From : in Workspace_Feature_Ref; Name : in String) return Util.Beans.Objects.Object; -- Table definition WORKSPACE_FEATURE_TABLE : constant ADO.Schemas.Class_Mapping_Access; -- Internal method to allocate the Object_Record instance overriding procedure Allocate (Object : in out Workspace_Feature_Ref); -- Copy of the object. procedure Copy (Object : in Workspace_Feature_Ref; Into : in out Workspace_Feature_Ref); Query_Member_In_Role : constant ADO.Queries.Query_Definition_Access; -- -------------------- -- The Member_Info describes a member of the workspace. -- -------------------- type Member_Info is new Util.Beans.Basic.Bean with record -- the member identifier. Id : ADO.Identifier; -- the user identifier. User_Id : ADO.Identifier; -- the user name. Name : Ada.Strings.Unbounded.Unbounded_String; -- the user email address. Email : Ada.Strings.Unbounded.Unbounded_String; -- the user's role. Role : Ada.Strings.Unbounded.Unbounded_String; -- the date when the user joined the workspace. Join_Date : ADO.Nullable_Time; -- the date when the invitation was sent to the user. Invite_Date : ADO.Nullable_Time; end record; -- Get the bean attribute identified by the name. overriding function Get_Value (From : in Member_Info; Name : in String) return Util.Beans.Objects.Object; -- Set the bean attribute identified by the name. overriding procedure Set_Value (Item : in out Member_Info; Name : in String; Value : in Util.Beans.Objects.Object); package Member_Info_Beans is new Util.Beans.Basic.Lists (Element_Type => Member_Info); package Member_Info_Vectors renames Member_Info_Beans.Vectors; subtype Member_Info_List_Bean is Member_Info_Beans.List_Bean; type Member_Info_List_Bean_Access is access all Member_Info_List_Bean; -- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>. procedure List (Object : in out Member_Info_List_Bean'Class; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class); subtype Member_Info_Vector is Member_Info_Vectors.Vector; -- Run the query controlled by <b>Context</b> and append the list in <b>Object</b>. procedure List (Object : in out Member_Info_Vector; Session : in out ADO.Sessions.Session'Class; Context : in out ADO.Queries.Context'Class); Query_Workspace_Member_List : constant ADO.Queries.Query_Definition_Access; -- -------------------- -- Operation to load the invitation. -- -------------------- type Invitation_Bean is abstract new AWA.Workspaces.Models.Invitation_Ref and Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record Key : Ada.Strings.Unbounded.Unbounded_String; end record; -- This bean provides some methods that can be used in a Method_Expression. overriding function Get_Method_Bindings (From : in Invitation_Bean) return Util.Beans.Methods.Method_Binding_Array_Access; -- Get the bean attribute identified by the name. overriding function Get_Value (From : in Invitation_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the bean attribute identified by the name. overriding procedure Set_Value (Item : in out Invitation_Bean; Name : in String; Value : in Util.Beans.Objects.Object); procedure Load (Bean : in out Invitation_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract; procedure Accept_Invitation (Bean : in out Invitation_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract; procedure Send (Bean : in out Invitation_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract; -- -------------------- -- load the list of members. -- -------------------- type Member_List_Bean is abstract limited new Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with record -- the number of members per page. Page_Size : Integer; -- the number of pages. Count : Integer; -- the current page number. Page : Integer; end record; -- This bean provides some methods that can be used in a Method_Expression. overriding function Get_Method_Bindings (From : in Member_List_Bean) return Util.Beans.Methods.Method_Binding_Array_Access; -- Get the bean attribute identified by the name. overriding function Get_Value (From : in Member_List_Bean; Name : in String) return Util.Beans.Objects.Object; -- Set the bean attribute identified by the name. overriding procedure Set_Value (Item : in out Member_List_Bean; Name : in String; Value : in Util.Beans.Objects.Object); procedure Load (Bean : in out Member_List_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract; -- -------------------- -- load the member information. -- -------------------- type Member_Bean is abstract new AWA.Workspaces.Models.Workspace_Member_Ref and Util.Beans.Basic.Bean and Util.Beans.Methods.Method_Bean with null record; -- This bean provides some methods that can be used in a Method_Expression. overriding function Get_Method_Bindings (From : in Member_Bean) return Util.Beans.Methods.Method_Binding_Array_Access; -- Set the bean attribute identified by the name. overriding procedure Set_Value (Item : in out Member_Bean; Name : in String; Value : in Util.Beans.Objects.Object); procedure Load (Bean : in out Member_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract; procedure Delete (Bean : in out Member_Bean; Outcome : in out Ada.Strings.Unbounded.Unbounded_String) is abstract; private WORKSPACE_NAME : aliased constant String := "awa_workspace"; COL_0_1_NAME : aliased constant String := "id"; COL_1_1_NAME : aliased constant String := "version"; COL_2_1_NAME : aliased constant String := "create_date"; COL_3_1_NAME : aliased constant String := "owner_id"; WORKSPACE_DEF : aliased constant ADO.Schemas.Class_Mapping := (Count => 4, Table => WORKSPACE_NAME'Access, Members => ( 1 => COL_0_1_NAME'Access, 2 => COL_1_1_NAME'Access, 3 => COL_2_1_NAME'Access, 4 => COL_3_1_NAME'Access) ); WORKSPACE_TABLE : constant ADO.Schemas.Class_Mapping_Access := WORKSPACE_DEF'Access; Null_Workspace : constant Workspace_Ref := Workspace_Ref'(ADO.Objects.Object_Ref with null record); type Workspace_Impl is new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER, Of_Class => WORKSPACE_DEF'Access) with record Version : Integer; Create_Date : Ada.Calendar.Time; Owner : AWA.Users.Models.User_Ref; end record; type Workspace_Access is access all Workspace_Impl; overriding procedure Destroy (Object : access Workspace_Impl); overriding procedure Find (Object : in out Workspace_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); overriding procedure Load (Object : in out Workspace_Impl; Session : in out ADO.Sessions.Session'Class); procedure Load (Object : in out Workspace_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class); overriding procedure Save (Object : in out Workspace_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Create (Object : in out Workspace_Impl; Session : in out ADO.Sessions.Master_Session'Class); overriding procedure Delete (Object : in out Workspace_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Set_Field (Object : in out Workspace_Ref'Class; Impl : out Workspace_Access); WORKSPACE_MEMBER_NAME : aliased constant String := "awa_workspace_member"; COL_0_2_NAME : aliased constant String := "id"; COL_1_2_NAME : aliased constant String := "join_date"; COL_2_2_NAME : aliased constant String := "role"; COL_3_2_NAME : aliased constant String := "member_id"; COL_4_2_NAME : aliased constant String := "workspace_id"; WORKSPACE_MEMBER_DEF : aliased constant ADO.Schemas.Class_Mapping := (Count => 5, Table => WORKSPACE_MEMBER_NAME'Access, Members => ( 1 => COL_0_2_NAME'Access, 2 => COL_1_2_NAME'Access, 3 => COL_2_2_NAME'Access, 4 => COL_3_2_NAME'Access, 5 => COL_4_2_NAME'Access) ); WORKSPACE_MEMBER_TABLE : constant ADO.Schemas.Class_Mapping_Access := WORKSPACE_MEMBER_DEF'Access; Null_Workspace_Member : constant Workspace_Member_Ref := Workspace_Member_Ref'(ADO.Objects.Object_Ref with null record); type Workspace_Member_Impl is new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER, Of_Class => WORKSPACE_MEMBER_DEF'Access) with record Join_Date : ADO.Nullable_Time; Role : Ada.Strings.Unbounded.Unbounded_String; Member : AWA.Users.Models.User_Ref; Workspace : AWA.Workspaces.Models.Workspace_Ref; end record; type Workspace_Member_Access is access all Workspace_Member_Impl; overriding procedure Destroy (Object : access Workspace_Member_Impl); overriding procedure Find (Object : in out Workspace_Member_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); overriding procedure Load (Object : in out Workspace_Member_Impl; Session : in out ADO.Sessions.Session'Class); procedure Load (Object : in out Workspace_Member_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class); overriding procedure Save (Object : in out Workspace_Member_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Create (Object : in out Workspace_Member_Impl; Session : in out ADO.Sessions.Master_Session'Class); overriding procedure Delete (Object : in out Workspace_Member_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Set_Field (Object : in out Workspace_Member_Ref'Class; Impl : out Workspace_Member_Access); INVITATION_NAME : aliased constant String := "awa_invitation"; COL_0_3_NAME : aliased constant String := "id"; COL_1_3_NAME : aliased constant String := "version"; COL_2_3_NAME : aliased constant String := "create_date"; COL_3_3_NAME : aliased constant String := "email"; COL_4_3_NAME : aliased constant String := "message"; COL_5_3_NAME : aliased constant String := "acceptance_date"; COL_6_3_NAME : aliased constant String := "workspace_id"; COL_7_3_NAME : aliased constant String := "access_key_id"; COL_8_3_NAME : aliased constant String := "invitee_id"; COL_9_3_NAME : aliased constant String := "inviter_id"; COL_10_3_NAME : aliased constant String := "member_id"; INVITATION_DEF : aliased constant ADO.Schemas.Class_Mapping := (Count => 11, Table => INVITATION_NAME'Access, Members => ( 1 => COL_0_3_NAME'Access, 2 => COL_1_3_NAME'Access, 3 => COL_2_3_NAME'Access, 4 => COL_3_3_NAME'Access, 5 => COL_4_3_NAME'Access, 6 => COL_5_3_NAME'Access, 7 => COL_6_3_NAME'Access, 8 => COL_7_3_NAME'Access, 9 => COL_8_3_NAME'Access, 10 => COL_9_3_NAME'Access, 11 => COL_10_3_NAME'Access) ); INVITATION_TABLE : constant ADO.Schemas.Class_Mapping_Access := INVITATION_DEF'Access; Null_Invitation : constant Invitation_Ref := Invitation_Ref'(ADO.Objects.Object_Ref with null record); type Invitation_Impl is new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER, Of_Class => INVITATION_DEF'Access) with record Version : Integer; Create_Date : Ada.Calendar.Time; Email : Ada.Strings.Unbounded.Unbounded_String; Message : Ada.Strings.Unbounded.Unbounded_String; Acceptance_Date : ADO.Nullable_Time; Workspace : AWA.Workspaces.Models.Workspace_Ref; Access_Key : AWA.Users.Models.Access_Key_Ref; Invitee : AWA.Users.Models.User_Ref; Inviter : AWA.Users.Models.User_Ref; Member : AWA.Workspaces.Models.Workspace_Member_Ref; end record; type Invitation_Access is access all Invitation_Impl; overriding procedure Destroy (Object : access Invitation_Impl); overriding procedure Find (Object : in out Invitation_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); overriding procedure Load (Object : in out Invitation_Impl; Session : in out ADO.Sessions.Session'Class); procedure Load (Object : in out Invitation_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class); overriding procedure Save (Object : in out Invitation_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Create (Object : in out Invitation_Impl; Session : in out ADO.Sessions.Master_Session'Class); overriding procedure Delete (Object : in out Invitation_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Set_Field (Object : in out Invitation_Ref'Class; Impl : out Invitation_Access); WORKSPACE_FEATURE_NAME : aliased constant String := "awa_workspace_feature"; COL_0_4_NAME : aliased constant String := "id"; COL_1_4_NAME : aliased constant String := "limit"; COL_2_4_NAME : aliased constant String := "workspace_id"; WORKSPACE_FEATURE_DEF : aliased constant ADO.Schemas.Class_Mapping := (Count => 3, Table => WORKSPACE_FEATURE_NAME'Access, Members => ( 1 => COL_0_4_NAME'Access, 2 => COL_1_4_NAME'Access, 3 => COL_2_4_NAME'Access) ); WORKSPACE_FEATURE_TABLE : constant ADO.Schemas.Class_Mapping_Access := WORKSPACE_FEATURE_DEF'Access; Null_Workspace_Feature : constant Workspace_Feature_Ref := Workspace_Feature_Ref'(ADO.Objects.Object_Ref with null record); type Workspace_Feature_Impl is new ADO.Objects.Object_Record (Key_Type => ADO.Objects.KEY_INTEGER, Of_Class => WORKSPACE_FEATURE_DEF'Access) with record Limit : Integer; Workspace : AWA.Workspaces.Models.Workspace_Ref; end record; type Workspace_Feature_Access is access all Workspace_Feature_Impl; overriding procedure Destroy (Object : access Workspace_Feature_Impl); overriding procedure Find (Object : in out Workspace_Feature_Impl; Session : in out ADO.Sessions.Session'Class; Query : in ADO.SQL.Query'Class; Found : out Boolean); overriding procedure Load (Object : in out Workspace_Feature_Impl; Session : in out ADO.Sessions.Session'Class); procedure Load (Object : in out Workspace_Feature_Impl; Stmt : in out ADO.Statements.Query_Statement'Class; Session : in out ADO.Sessions.Session'Class); overriding procedure Save (Object : in out Workspace_Feature_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Create (Object : in out Workspace_Feature_Impl; Session : in out ADO.Sessions.Master_Session'Class); overriding procedure Delete (Object : in out Workspace_Feature_Impl; Session : in out ADO.Sessions.Master_Session'Class); procedure Set_Field (Object : in out Workspace_Feature_Ref'Class; Impl : out Workspace_Feature_Access); package File_1 is new ADO.Queries.Loaders.File (Path => "workspace-permissions.xml", Sha1 => "9B2B599473F75F92CB5AB5045675E4CCEF926543"); package Def_Member_In_Role is new ADO.Queries.Loaders.Query (Name => "member-in-role", File => File_1.File'Access); Query_Member_In_Role : constant ADO.Queries.Query_Definition_Access := Def_Member_In_Role.Query'Access; package File_2 is new ADO.Queries.Loaders.File (Path => "member-list.xml", Sha1 => "D92F1CB6DBE47F7A72E83CD4AE8E39F2048D0728"); package Def_Memberinfo_Workspace_Member_List is new ADO.Queries.Loaders.Query (Name => "workspace-member-list", File => File_2.File'Access); Query_Workspace_Member_List : constant ADO.Queries.Query_Definition_Access := Def_Memberinfo_Workspace_Member_List.Query'Access; end AWA.Workspaces.Models;
pat-rogers/LmcpGen
Ada
26,671
ads
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S T R I N G S . U N B O U N D E D -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2021, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package provides an implementation of Ada.Strings.Unbounded that uses -- reference counts to implement copy on modification (rather than copy on -- assignment). This is significantly more efficient on many targets. -- This version is supported on: -- - all Alpha platforms -- - all ia64 platforms -- - all PowerPC platforms -- - all SPARC V9 platforms -- - all x86 platforms -- - all x86_64 platforms -- This package uses several techniques to increase speed: -- - Implicit sharing or copy-on-write. An Unbounded_String contains only -- the reference to the data which is shared between several instances. -- The shared data is reallocated only when its value is changed and -- the object mutation can't be used or it is inefficient to use it. -- - Object mutation. Shared data object can be reused without memory -- reallocation when all of the following requirements are met: -- - the shared data object is no longer used by anyone else; -- - the size is sufficient to store the new value; -- - the gap after reuse is less than a defined threshold. -- - Memory preallocation. Most of used memory allocation algorithms -- align allocated segments on the some boundary, thus some amount of -- additional memory can be preallocated without any impact. Such -- preallocated memory can used later by Append/Insert operations -- without reallocation. -- Reference counting uses GCC builtin atomic operations, which allows safe -- sharing of internal data between Ada tasks. Nevertheless, this does not -- make objects of Unbounded_String thread-safe: an instance cannot be -- accessed by several tasks simultaneously. with Ada.Strings.Maps; private with Ada.Finalization; private with System.Atomic_Counters; private with Ada.Strings.Text_Buffers; package Ada.Strings.Unbounded with Initial_Condition => Length (Null_Unbounded_String) = 0 is pragma Preelaborate; pragma Unevaluated_Use_Of_Old (Allow); type Unbounded_String is private; pragma Preelaborable_Initialization (Unbounded_String); Null_Unbounded_String : constant Unbounded_String; function Length (Source : Unbounded_String) return Natural with Global => null; type String_Access is access all String; procedure Free (X : in out String_Access); -------------------------------------------------------- -- Conversion, Concatenation, and Selection Functions -- -------------------------------------------------------- function To_Unbounded_String (Source : String) return Unbounded_String with Post => Length (To_Unbounded_String'Result) = Source'Length and then (for all J in 1 .. Length (To_Unbounded_String'Result) => Element (To_Unbounded_String'Result, J) = Source (Source'First - 1 + J)), Global => null; function To_Unbounded_String (Length : Natural) return Unbounded_String with Post => Ada.Strings.Unbounded.Length (To_Unbounded_String'Result) = Length, Global => null; function To_String (Source : Unbounded_String) return String with Post => To_String'Result'First = 1 and then To_String'Result'Length = Length (Source) and then (for all J in 1 .. Length (Source) => Element (Source, J) = To_String'Result (J)), Global => null; procedure Set_Unbounded_String (Target : out Unbounded_String; Source : String) with Global => null; pragma Ada_05 (Set_Unbounded_String); procedure Append (Source : in out Unbounded_String; New_Item : Unbounded_String) with Pre => Length (New_Item) <= Natural'Last - Length (Source), Post => Length (Source) = Length (Source)'Old + Length (New_Item) and then -- prior content is unchanged (for all J in 1 .. Length (Source)'Old => Element (Source, J) = Element (Source'Old, J)) and then -- new content matches New_Item Unbounded_Slice (Source, Length (Source)'Old + 1, Length (Source)'Old + Length (New_Item)) = New_Item, Global => null; procedure Append (Source : in out Unbounded_String; New_Item : String) with Pre => New_Item'Length <= Natural'Last - Length (Source), Post => Length (Source) = Length (Source)'Old + New_Item'Length and then -- prior content is unchanged (for all J in 1 .. Length (Source)'Old => Element (Source, J) = Element (Source'Old, J)) and then -- new content matches New_Item Slice (Source, Length (Source)'Old + 1, Length (Source)'Old + New_Item'Length) = New_Item, Global => null; procedure Append (Source : in out Unbounded_String; New_Item : Character) with Pre => Length (Source) < Natural'Last, Post => Length (Source) = Length (Source)'Old + 1 and then -- prior content is unchanged (for all J in 1 .. Length (Source)'Old => Element (Source, J) = Element (Source'Old, J)) -- new content matches New_Item and then Element (Source, Length (Source)) = New_Item, Global => null; function "&" (Left : Unbounded_String; Right : Unbounded_String) return Unbounded_String with Pre => Length (Right) <= Natural'Last - Length (Left), Post => Length ("&"'Result) = Length (Left) + Length (Right), Global => null; function "&" (Left : Unbounded_String; Right : String) return Unbounded_String with Pre => Right'Length <= Natural'Last - Length (Left), Post => Length ("&"'Result) = Length (Left) + Right'Length, Global => null; function "&" (Left : String; Right : Unbounded_String) return Unbounded_String with Pre => Left'Length <= Natural'Last - Length (Right), Post => Length ("&"'Result) = Left'Length + Length (Right), Global => null; function "&" (Left : Unbounded_String; Right : Character) return Unbounded_String with Pre => Length (Left) < Natural'Last, Post => Length ("&"'Result) = Length (Left) + 1, Global => null; function "&" (Left : Character; Right : Unbounded_String) return Unbounded_String with Pre => Length (Right) < Natural'Last, Post => Length ("&"'Result) = Length (Right) + 1, Global => null; function Element (Source : Unbounded_String; Index : Positive) return Character with Pre => Index <= Length (Source), Global => null; procedure Replace_Element (Source : in out Unbounded_String; Index : Positive; By : Character) with Pre => Index <= Length (Source), Post => Length (Source) = Length (Source)'Old, Global => null; function Slice (Source : Unbounded_String; Low : Positive; High : Natural) return String with Pre => Low - 1 <= Length (Source) and then High <= Length (Source), Post => Slice'Result'Length = Natural'Max (0, High - Low + 1) and then Slice'Result'First = Low and then Slice'Result'Last = High and then (for all J in Low .. High => Element (Source, J) = Slice'Result (J)), Global => null; function Unbounded_Slice (Source : Unbounded_String; Low : Positive; High : Natural) return Unbounded_String with Pre => Low - 1 <= Length (Source) and then High <= Length (Source), Post => Length (Unbounded_Slice'Result) = Natural'Max (0, High - Low + 1) and then (for all J in 0 .. High - Low => Element (Source, Low + J) = Element (Unbounded_Slice'Result, 1 + J)), Global => null; pragma Ada_05 (Unbounded_Slice); procedure Unbounded_Slice (Source : Unbounded_String; Target : out Unbounded_String; Low : Positive; High : Natural) with Pre => Low - 1 <= Length (Source) and then High <= Length (Source), Post => Length (Target) = Natural'Max (0, High - Low + 1), Global => null; pragma Ada_05 (Unbounded_Slice); function "=" (Left : Unbounded_String; Right : Unbounded_String) return Boolean with Global => null; function "=" (Left : Unbounded_String; Right : String) return Boolean with Global => null; function "=" (Left : String; Right : Unbounded_String) return Boolean with Global => null; function "<" (Left : Unbounded_String; Right : Unbounded_String) return Boolean with Global => null; function "<" (Left : Unbounded_String; Right : String) return Boolean with Global => null; function "<" (Left : String; Right : Unbounded_String) return Boolean with Global => null; function "<=" (Left : Unbounded_String; Right : Unbounded_String) return Boolean with Global => null; function "<=" (Left : Unbounded_String; Right : String) return Boolean with Global => null; function "<=" (Left : String; Right : Unbounded_String) return Boolean with Global => null; function ">" (Left : Unbounded_String; Right : Unbounded_String) return Boolean with Global => null; function ">" (Left : Unbounded_String; Right : String) return Boolean with Global => null; function ">" (Left : String; Right : Unbounded_String) return Boolean with Global => null; function ">=" (Left : Unbounded_String; Right : Unbounded_String) return Boolean with Global => null; function ">=" (Left : Unbounded_String; Right : String) return Boolean with Global => null; function ">=" (Left : String; Right : Unbounded_String) return Boolean with Global => null; ------------------------ -- Search Subprograms -- ------------------------ function Index (Source : Unbounded_String; Pattern : String; Going : Direction := Forward; Mapping : Maps.Character_Mapping := Maps.Identity) return Natural with Pre => Pattern'Length /= 0, Global => null; function Index (Source : Unbounded_String; Pattern : String; Going : Direction := Forward; Mapping : Maps.Character_Mapping_Function) return Natural with Pre => Pattern'Length /= 0, Global => null; function Index (Source : Unbounded_String; Set : Maps.Character_Set; Test : Membership := Inside; Going : Direction := Forward) return Natural with Global => null; function Index (Source : Unbounded_String; Pattern : String; From : Positive; Going : Direction := Forward; Mapping : Maps.Character_Mapping := Maps.Identity) return Natural with Pre => (if Length (Source) /= 0 then From <= Length (Source)) and then Pattern'Length /= 0, Global => null; pragma Ada_05 (Index); function Index (Source : Unbounded_String; Pattern : String; From : Positive; Going : Direction := Forward; Mapping : Maps.Character_Mapping_Function) return Natural with Pre => (if Length (Source) /= 0 then From <= Length (Source)) and then Pattern'Length /= 0, Global => null; pragma Ada_05 (Index); function Index (Source : Unbounded_String; Set : Maps.Character_Set; From : Positive; Test : Membership := Inside; Going : Direction := Forward) return Natural with Pre => (if Length (Source) /= 0 then From <= Length (Source)), Global => null; pragma Ada_05 (Index); function Index_Non_Blank (Source : Unbounded_String; Going : Direction := Forward) return Natural with Global => null; function Index_Non_Blank (Source : Unbounded_String; From : Positive; Going : Direction := Forward) return Natural with Pre => (if Length (Source) /= 0 then From <= Length (Source)), Global => null; pragma Ada_05 (Index_Non_Blank); function Count (Source : Unbounded_String; Pattern : String; Mapping : Maps.Character_Mapping := Maps.Identity) return Natural with Pre => Pattern'Length /= 0, Global => null; function Count (Source : Unbounded_String; Pattern : String; Mapping : Maps.Character_Mapping_Function) return Natural with Pre => Pattern'Length /= 0, Global => null; function Count (Source : Unbounded_String; Set : Maps.Character_Set) return Natural with Global => null; procedure Find_Token (Source : Unbounded_String; Set : Maps.Character_Set; From : Positive; Test : Membership; First : out Positive; Last : out Natural) with Pre => (if Length (Source) /= 0 then From <= Length (Source)), Global => null; pragma Ada_2012 (Find_Token); procedure Find_Token (Source : Unbounded_String; Set : Maps.Character_Set; Test : Membership; First : out Positive; Last : out Natural) with Global => null; ------------------------------------ -- String Translation Subprograms -- ------------------------------------ function Translate (Source : Unbounded_String; Mapping : Maps.Character_Mapping) return Unbounded_String with Post => Length (Translate'Result) = Length (Source), Global => null; procedure Translate (Source : in out Unbounded_String; Mapping : Maps.Character_Mapping) with Post => Length (Source) = Length (Source)'Old, Global => null; function Translate (Source : Unbounded_String; Mapping : Maps.Character_Mapping_Function) return Unbounded_String with Post => Length (Translate'Result) = Length (Source), Global => null; procedure Translate (Source : in out Unbounded_String; Mapping : Maps.Character_Mapping_Function) with Post => Length (Source) = Length (Source)'Old, Global => null; --------------------------------------- -- String Transformation Subprograms -- --------------------------------------- function Replace_Slice (Source : Unbounded_String; Low : Positive; High : Natural; By : String) return Unbounded_String with Pre => Low - 1 <= Length (Source) and then (if High >= Low then Low - 1 <= Natural'Last - By'Length - Natural'Max (Length (Source) - High, 0) else Length (Source) <= Natural'Last - By'Length), Contract_Cases => (High >= Low => Length (Replace_Slice'Result) = Low - 1 + By'Length + Natural'Max (Length (Source)'Old - High, 0), others => Length (Replace_Slice'Result) = Length (Source)'Old + By'Length), Global => null; procedure Replace_Slice (Source : in out Unbounded_String; Low : Positive; High : Natural; By : String) with Pre => Low - 1 <= Length (Source) and then (if High >= Low then Low - 1 <= Natural'Last - By'Length - Natural'Max (Length (Source) - High, 0) else Length (Source) <= Natural'Last - By'Length), Contract_Cases => (High >= Low => Length (Source) = Low - 1 + By'Length + Natural'Max (Length (Source)'Old - High, 0), others => Length (Source) = Length (Source)'Old + By'Length), Global => null; function Insert (Source : Unbounded_String; Before : Positive; New_Item : String) return Unbounded_String with Pre => Before - 1 <= Length (Source) and then New_Item'Length <= Natural'Last - Length (Source), Post => Length (Insert'Result) = Length (Source) + New_Item'Length, Global => null; procedure Insert (Source : in out Unbounded_String; Before : Positive; New_Item : String) with Pre => Before - 1 <= Length (Source) and then New_Item'Length <= Natural'Last - Length (Source), Post => Length (Source) = Length (Source)'Old + New_Item'Length, Global => null; function Overwrite (Source : Unbounded_String; Position : Positive; New_Item : String) return Unbounded_String with Pre => Position - 1 <= Length (Source) and then (if New_Item'Length /= 0 then New_Item'Length <= Natural'Last - (Position - 1)), Post => Length (Overwrite'Result) = Natural'Max (Length (Source), Position - 1 + New_Item'Length), Global => null; procedure Overwrite (Source : in out Unbounded_String; Position : Positive; New_Item : String) with Pre => Position - 1 <= Length (Source) and then (if New_Item'Length /= 0 then New_Item'Length <= Natural'Last - (Position - 1)), Post => Length (Source) = Natural'Max (Length (Source)'Old, Position - 1 + New_Item'Length), Global => null; function Delete (Source : Unbounded_String; From : Positive; Through : Natural) return Unbounded_String with Pre => (if Through <= From then From - 1 <= Length (Source)), Contract_Cases => (Through >= From => Length (Delete'Result) = Length (Source) - (Through - From + 1), others => Length (Delete'Result) = Length (Source)), Global => null; procedure Delete (Source : in out Unbounded_String; From : Positive; Through : Natural) with Pre => (if Through <= From then From - 1 <= Length (Source)), Contract_Cases => (Through >= From => Length (Source) = Length (Source)'Old - (Through - From + 1), others => Length (Source) = Length (Source)'Old), Global => null; function Trim (Source : Unbounded_String; Side : Trim_End) return Unbounded_String with Post => Length (Trim'Result) <= Length (Source), Global => null; procedure Trim (Source : in out Unbounded_String; Side : Trim_End) with Post => Length (Source) <= Length (Source)'Old, Global => null; function Trim (Source : Unbounded_String; Left : Maps.Character_Set; Right : Maps.Character_Set) return Unbounded_String with Post => Length (Trim'Result) <= Length (Source), Global => null; procedure Trim (Source : in out Unbounded_String; Left : Maps.Character_Set; Right : Maps.Character_Set) with Post => Length (Source) <= Length (Source)'Old, Global => null; function Head (Source : Unbounded_String; Count : Natural; Pad : Character := Space) return Unbounded_String with Post => Length (Head'Result) = Count, Global => null; procedure Head (Source : in out Unbounded_String; Count : Natural; Pad : Character := Space) with Post => Length (Source) = Count, Global => null; function Tail (Source : Unbounded_String; Count : Natural; Pad : Character := Space) return Unbounded_String with Post => Length (Tail'Result) = Count, Global => null; procedure Tail (Source : in out Unbounded_String; Count : Natural; Pad : Character := Space) with Post => Length (Source) = Count, Global => null; function "*" (Left : Natural; Right : Character) return Unbounded_String with Pre => Left <= Natural'Last, Post => Length ("*"'Result) = Left, Global => null; function "*" (Left : Natural; Right : String) return Unbounded_String with Pre => (if Left /= 0 then Right'Length <= Natural'Last / Left), Post => Length ("*"'Result) = Left * Right'Length, Global => null; function "*" (Left : Natural; Right : Unbounded_String) return Unbounded_String with Pre => (if Left /= 0 then Length (Right) <= Natural'Last / Left), Post => Length ("*"'Result) = Left * Length (Right), Global => null; private pragma Inline (Length); package AF renames Ada.Finalization; type Shared_String (Max_Length : Natural) is limited record Counter : System.Atomic_Counters.Atomic_Counter; -- Reference counter Last : Natural := 0; Data : String (1 .. Max_Length); -- Last is the index of last significant element of the Data. All -- elements with larger indexes are currently insignificant. end record; type Shared_String_Access is access all Shared_String; procedure Reference (Item : not null Shared_String_Access); -- Increment reference counter. -- Do nothing if Item points to Empty_Shared_String. procedure Unreference (Item : not null Shared_String_Access); -- Decrement reference counter, deallocate Item when counter goes to zero. -- Do nothing if Item points to Empty_Shared_String. function Can_Be_Reused (Item : not null Shared_String_Access; Length : Natural) return Boolean; -- Returns True if Shared_String can be reused. There are two criteria when -- Shared_String can be reused: its reference counter must be one (thus -- Shared_String is owned exclusively) and its size is sufficient to -- store string with specified length effectively. function Allocate (Required_Length : Natural; Reserved_Length : Natural := 0) return not null Shared_String_Access; -- Allocates new Shared_String. Actual maximum length of allocated object -- is at least the specified required length. Additional storage is -- allocated to allow to store up to the specified reserved length when -- possible. Returns reference to Empty_Shared_String when requested length -- is zero. Empty_Shared_String : aliased Shared_String (0); function To_Unbounded (S : String) return Unbounded_String renames To_Unbounded_String; -- This renames are here only to be used in the pragma Stream_Convert type Unbounded_String is new AF.Controlled with record Reference : not null Shared_String_Access := Empty_Shared_String'Access; end record with Put_Image => Put_Image; procedure Put_Image (S : in out Ada.Strings.Text_Buffers.Root_Buffer_Type'Class; V : Unbounded_String); pragma Stream_Convert (Unbounded_String, To_Unbounded, To_String); -- Provide stream routines without dragging in Ada.Streams pragma Finalize_Storage_Only (Unbounded_String); -- Finalization is required only for freeing storage overriding procedure Initialize (Object : in out Unbounded_String); overriding procedure Adjust (Object : in out Unbounded_String); overriding procedure Finalize (Object : in out Unbounded_String); pragma Inline (Initialize, Adjust); Null_Unbounded_String : constant Unbounded_String := (AF.Controlled with Reference => Empty_Shared_String'Access); ------------- -- Element -- ------------- function Element (Source : Unbounded_String; Index : Positive) return Character is (Source.Reference.Data (Index)); end Ada.Strings.Unbounded;
sungyeon/drake
Ada
241
adb
with System.Formatting.Float; package body System.Fore is function Fore (Lo, Hi : Long_Long_Float) return Natural is begin return Formatting.Float.Fore_Digits_Width (Lo, Hi) + 1; -- including sign end Fore; end System.Fore;
godunko/adawebpack
Ada
3,200
ads
------------------------------------------------------------------------------ -- -- -- AdaWebPack -- -- -- ------------------------------------------------------------------------------ -- Copyright © 2020, Vadim Godunko -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- 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 WASM.Objects; limited with Web.Message_Events; limited with Web.UI_Events.Mouse_Events; package Web.DOM.Events is pragma Preelaborate; type Event is new WASM.Objects.Object_Reference with null record; function As_Mouse_Event (Self : Event'Class) return Web.UI_Events.Mouse_Events.Mouse_Event; function As_Message_Event (Self : Event'Class) return Web.Message_Events.Message_Event; end Web.DOM.Events;
AdaCore/libadalang
Ada
414
adb
procedure Main is procedure F (X : access procedure (Y : Integer)); procedure F (X : access procedure (Y : Integer)) is begin null; end F; --% node.p_canonical_part() procedure G (X : access function (Y : Integer) return Integer); procedure G (X : access function (Y : Integer) return Integer) is begin null; end G; --% node.p_canonical_part() begin null; end Main;
reznikmm/matreshka
Ada
8,427
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ pragma Ada_2012; private with Ada.Finalization; with League.Holders; with League.Strings; private with Matreshka.Internals.SQL_Drivers.Dummy; package SQL.Queries is type SQL_Query is tagged private; procedure Bind_Value (Self : in out SQL_Query'Class; Name : League.Strings.Universal_String; Value : League.Holders.Holder; Direction : Parameter_Directions := In_Parameter); -- Set the placeholder Name to be bound to value Value in the prepared -- statement. -- -- XXX Add description of Direction and how to set value to NULL. function Bound_Value (Self : SQL_Query'Class; Name : League.Strings.Universal_String) return League.Holders.Holder; function Error_Message (Self : SQL_Query'Class) return League.Strings.Universal_String; function Execute (Self : in out SQL_Query'Class) return Boolean; -- Executes a previously prepared SQL query. Returns True if the query -- executed successfully; otherwise returns False. -- -- After the query is executed, the query is positioned on an invalid -- record and must be navigated to a valid record before data values can be -- retrieved. -- -- Note that the last error for this query is reset when Execute is called. procedure Execute (Self : in out SQL_Query'Class); -- Executes a previously prepared SQL query. Raises SQL_Error when query -- is not executed successfully. -- -- After the query is executed, the query is positioned on an invalid -- record and must be navigated to a valid record before data values can be -- retrieved. -- -- Note that the last error for this query is reset when Execute is called. procedure Finish (Self : in out SQL_Query'Class); -- Instruct the database driver that no more data will be fetched from this -- query until it is re-executed. There is normally no need to call this -- function, but it may be helpful in order to free resources such as locks -- or cursors if you intend to re-use the query at a later time. -- -- Sets the query to inactive. Bound values retain their values. function Is_Active (Self : SQL_Query'Class) return Boolean; -- Returns True if the query is active. An active SQL_Query is one that has -- been executed successfully but not yet finished with. When you are -- finished with an active query, you can make make the query inactive by -- calling Finish, or you can delete the SQL_Query instance. -- -- Note: Of particular interest is an active query that is a SELECT -- statement. For some databases that support transactions, an active query -- that is a SELECT statement can cause a Commit or a Rollback to fail, so -- before committing or rolling back, you should make your active SELECT -- statement query inactive using one of the ways listed above. function Is_Valid (Self : SQL_Query'Class) return Boolean; -- Returns True if the query is currently positioned on a valid record; -- otherwise returns false. function Next (Self : in out SQL_Query'Class) return Boolean; function Prepare (Self : in out SQL_Query'Class; Query : League.Strings.Universal_String) return Boolean; -- Prepares the SQL query query for execution. Returns True if the query is -- prepared successfully; otherwise returns False. -- -- The query may contain placeholders for binding values. Both Oracle style -- colon-name (e.g., :surname), and ODBC style (?) placeholders are -- supported; but they cannot be mixed in the same query. -- -- Portability note: Some databases choose to delay preparing a query until -- it is executed the first time. In this case, preparing a syntactically -- wrong query succeeds, but every consecutive Execute will fail. procedure Prepare (Self : in out SQL_Query'Class; Query : League.Strings.Universal_String); -- Prepares the SQL query query for execution. Raises SQL_Error if query is -- not prepared successfully. -- -- The query may contain placeholders for binding values. Both Oracle style -- colon-name (e.g., :surname), and ODBC style (?) placeholders are -- supported; but they cannot be mixed in the same query. -- -- Portability note: Some databases choose to delay preparing a query until -- it is executed the first time. In this case, preparing a syntactically -- wrong query succeeds, but every consecutive Execute will fail. -- function Previous (Self : in out SQL_Query'Class) return Boolean; -- procedure Previous (Self : in out SQL_Query'Class); function Value (Self : SQL_Query'Class; Index : Positive) return League.Holders.Holder; private type SQL_Query is new Ada.Finalization.Controlled with record Data : Matreshka.Internals.SQL_Drivers.Query_Access := Matreshka.Internals.SQL_Drivers.Dummy.Empty_Query'Access; end record; overriding procedure Adjust (Self : in out SQL_Query); overriding procedure Finalize (Self : in out SQL_Query); end SQL.Queries;
mfkiwl/ewok-kernel-security-OS
Ada
1,102
ads
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with soc.interrupts; package ewok.posthook with spark_mode => on is type t_args is new unsigned_32_array (1 .. 2); -- Execute posthook for a given interrupt procedure exec (intr : in soc.interrupts.t_interrupt; status : out unsigned_32; data : out unsigned_32); end ewok.posthook;
reznikmm/matreshka
Ada
4,209
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Nodes; with XML.DOM.Attributes.Internals; package body ODF.DOM.Attributes.Style.Color.Internals is ------------ -- Create -- ------------ function Create (Node : Matreshka.ODF_Attributes.Style.Color.Style_Color_Access) return ODF.DOM.Attributes.Style.Color.ODF_Style_Color is begin return (XML.DOM.Attributes.Internals.Create (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Create; ---------- -- Wrap -- ---------- function Wrap (Node : Matreshka.ODF_Attributes.Style.Color.Style_Color_Access) return ODF.DOM.Attributes.Style.Color.ODF_Style_Color is begin return (XML.DOM.Attributes.Internals.Wrap (Matreshka.DOM_Nodes.Attribute_Access (Node)) with null record); end Wrap; end ODF.DOM.Attributes.Style.Color.Internals;
onox/orka
Ada
6,085
adb
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 onox <[email protected]> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package body Orka.Containers.Bounded_Vectors is function Length (Container : Vector) return Length_Type is (Container.Length); function Is_Empty (Container : Vector) return Boolean is (Length (Container) = 0); function Is_Full (Container : Vector) return Boolean is (Length (Container) = Container.Capacity); procedure Append (Container : in out Vector; Elements : Vector) is Start_Index : constant Index_Type := Container.Length + Index_Type'First; Stop_Index : constant Index_Type'Base := Start_Index + Elements.Length - 1; procedure Copy_Elements (Elements : Element_Array) is begin Container.Elements (Start_Index .. Stop_Index) := Elements; end Copy_Elements; begin Elements.Query (Copy_Elements'Access); Container.Length := Container.Length + Elements.Length; end Append; procedure Append (Container : in out Vector; Element : Element_Type) is Index : constant Index_Type := Container.Length + Index_Type'First; begin Container.Length := Container.Length + 1; Container.Elements (Index) := Element; end Append; procedure Remove_Last (Container : in out Vector; Element : out Element_Type) is Index : constant Index_Type := Container.Length + Index_Type'First - 1; begin Element := Container.Elements (Index); Container.Elements (Index .. Index) := (others => <>); Container.Length := Container.Length - 1; end Remove_Last; procedure Clear (Container : in out Vector) is begin Container.Elements := (others => <>); Container.Length := 0; end Clear; procedure Query (Container : Vector; Process : not null access procedure (Elements : Element_Array)) is Last_Index : constant Index_Type'Base := Container.Length + Index_Type'First - 1; begin Process (Container.Elements (Index_Type'First .. Last_Index)); end Query; procedure Update (Container : in out Vector; Index : Index_Type; Process : not null access procedure (Element : in out Element_Type)) is begin Process (Container.Elements (Index)); end Update; function Element (Container : Vector; Index : Index_Type) return Element_Type is (Container.Elements (Index)); function Element (Container : aliased Vector; Position : Cursor) return Element_Type is begin if Position = No_Element then raise Constraint_Error; elsif Position.Object.all /= Container then raise Program_Error; else return Element (Container, Position.Index); end if; end Element; function Constant_Reference (Container : aliased Vector; Index : Index_Type) return Constant_Reference_Type is begin return Constant_Reference_Type'(Value => Container.Elements (Index)'Access); end Constant_Reference; function Constant_Reference (Container : aliased Vector; Position : Cursor) return Constant_Reference_Type is begin if Position = No_Element then raise Constraint_Error; elsif Position.Object.all /= Container then raise Program_Error; else return Constant_Reference (Container, Position.Index); end if; end Constant_Reference; function Reference (Container : aliased in out Vector; Index : Index_Type) return Reference_Type is begin return Reference_Type'(Value => Container.Elements (Index)'Access); end Reference; function Reference (Container : aliased in out Vector; Position : Cursor) return Reference_Type is begin if Position = No_Element then raise Constraint_Error; elsif Position.Object.all /= Container then raise Program_Error; else return Reference (Container, Position.Index); end if; end Reference; function Iterate (Container : Vector) return Vector_Iterator_Interfaces.Reversible_Iterator'Class is begin return Iterator'(Container => Container'Unchecked_Access); end Iterate; overriding function First (Object : Iterator) return Cursor is begin if Object.Container.all.Is_Empty then return No_Element; else return Cursor'(Object => Object.Container, Index => Index_Type'First); end if; end First; overriding function Last (Object : Iterator) return Cursor is begin if Object.Container.all.Is_Empty then return No_Element; else return Cursor'(Object => Object.Container, Index => Object.Container.all.Length); end if; end Last; overriding function Next (Object : Iterator; Position : Cursor) return Cursor is begin if Position = No_Element then raise Constraint_Error; elsif Position.Index = Position.Object.Length + Index_Type'First - 1 then return No_Element; else return Cursor'(Position.Object, Position.Index + 1); end if; end Next; overriding function Previous (Object : Iterator; Position : Cursor) return Cursor is begin if Position = No_Element then raise Constraint_Error; elsif Position.Index = Index_Type'First then return No_Element; else return Cursor'(Position.Object, Position.Index - 1); end if; end Previous; end Orka.Containers.Bounded_Vectors;
zhmu/ananas
Ada
10,933
adb
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- G N A T . S E C U R E _ H A S H E S . M D 5 -- -- -- -- B o d y -- -- -- -- Copyright (C) 2002-2022, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with GNAT.Byte_Swapping; use GNAT.Byte_Swapping; package body GNAT.Secure_Hashes.MD5 is use Interfaces; -- The sixteen values used to rotate the context words. Four for each -- rounds. Used in procedure Transform. -- Round 1 S11 : constant := 7; S12 : constant := 12; S13 : constant := 17; S14 : constant := 22; -- Round 2 S21 : constant := 5; S22 : constant := 9; S23 : constant := 14; S24 : constant := 20; -- Round 3 S31 : constant := 4; S32 : constant := 11; S33 : constant := 16; S34 : constant := 23; -- Round 4 S41 : constant := 6; S42 : constant := 10; S43 : constant := 15; S44 : constant := 21; -- The following functions (F, FF, G, GG, H, HH, I and II) are the -- equivalent of the macros of the same name in the example C -- implementation in the annex of RFC 1321. function F (X, Y, Z : Unsigned_32) return Unsigned_32; pragma Inline (F); procedure FF (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive); pragma Inline (FF); function G (X, Y, Z : Unsigned_32) return Unsigned_32; pragma Inline (G); procedure GG (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive); pragma Inline (GG); function H (X, Y, Z : Unsigned_32) return Unsigned_32; pragma Inline (H); procedure HH (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive); pragma Inline (HH); function I (X, Y, Z : Unsigned_32) return Unsigned_32; pragma Inline (I); procedure II (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive); pragma Inline (II); ------- -- F -- ------- function F (X, Y, Z : Unsigned_32) return Unsigned_32 is begin return (X and Y) or ((not X) and Z); end F; -------- -- FF -- -------- procedure FF (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive) is begin A := A + F (B, C, D) + X + AC; A := Rotate_Left (A, S); A := A + B; end FF; ------- -- G -- ------- function G (X, Y, Z : Unsigned_32) return Unsigned_32 is begin return (X and Z) or (Y and (not Z)); end G; -------- -- GG -- -------- procedure GG (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive) is begin A := A + G (B, C, D) + X + AC; A := Rotate_Left (A, S); A := A + B; end GG; ------- -- H -- ------- function H (X, Y, Z : Unsigned_32) return Unsigned_32 is begin return X xor Y xor Z; end H; -------- -- HH -- -------- procedure HH (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive) is begin A := A + H (B, C, D) + X + AC; A := Rotate_Left (A, S); A := A + B; end HH; ------- -- I -- ------- function I (X, Y, Z : Unsigned_32) return Unsigned_32 is begin return Y xor (X or (not Z)); end I; -------- -- II -- -------- procedure II (A : in out Unsigned_32; B, C, D : Unsigned_32; X : Unsigned_32; AC : Unsigned_32; S : Positive) is begin A := A + I (B, C, D) + X + AC; A := Rotate_Left (A, S); A := A + B; end II; --------------- -- Transform -- --------------- procedure Transform (H : in out Hash_State.State; M : in out Message_State) is use System; X : array (0 .. 15) of Interfaces.Unsigned_32; for X'Address use M.Buffer'Address; pragma Import (Ada, X); AA : Unsigned_32 := H (0); BB : Unsigned_32 := H (1); CC : Unsigned_32 := H (2); DD : Unsigned_32 := H (3); begin if Default_Bit_Order /= Low_Order_First then for J in X'Range loop Swap4 (X (J)'Address); end loop; end if; -- Round 1 FF (AA, BB, CC, DD, X (00), 16#D76aa478#, S11); -- 1 FF (DD, AA, BB, CC, X (01), 16#E8c7b756#, S12); -- 2 FF (CC, DD, AA, BB, X (02), 16#242070db#, S13); -- 3 FF (BB, CC, DD, AA, X (03), 16#C1bdceee#, S14); -- 4 FF (AA, BB, CC, DD, X (04), 16#f57c0faf#, S11); -- 5 FF (DD, AA, BB, CC, X (05), 16#4787c62a#, S12); -- 6 FF (CC, DD, AA, BB, X (06), 16#a8304613#, S13); -- 7 FF (BB, CC, DD, AA, X (07), 16#fd469501#, S14); -- 8 FF (AA, BB, CC, DD, X (08), 16#698098d8#, S11); -- 9 FF (DD, AA, BB, CC, X (09), 16#8b44f7af#, S12); -- 10 FF (CC, DD, AA, BB, X (10), 16#ffff5bb1#, S13); -- 11 FF (BB, CC, DD, AA, X (11), 16#895cd7be#, S14); -- 12 FF (AA, BB, CC, DD, X (12), 16#6b901122#, S11); -- 13 FF (DD, AA, BB, CC, X (13), 16#fd987193#, S12); -- 14 FF (CC, DD, AA, BB, X (14), 16#a679438e#, S13); -- 15 FF (BB, CC, DD, AA, X (15), 16#49b40821#, S14); -- 16 -- Round 2 GG (AA, BB, CC, DD, X (01), 16#f61e2562#, S21); -- 17 GG (DD, AA, BB, CC, X (06), 16#c040b340#, S22); -- 18 GG (CC, DD, AA, BB, X (11), 16#265e5a51#, S23); -- 19 GG (BB, CC, DD, AA, X (00), 16#e9b6c7aa#, S24); -- 20 GG (AA, BB, CC, DD, X (05), 16#d62f105d#, S21); -- 21 GG (DD, AA, BB, CC, X (10), 16#02441453#, S22); -- 22 GG (CC, DD, AA, BB, X (15), 16#d8a1e681#, S23); -- 23 GG (BB, CC, DD, AA, X (04), 16#e7d3fbc8#, S24); -- 24 GG (AA, BB, CC, DD, X (09), 16#21e1cde6#, S21); -- 25 GG (DD, AA, BB, CC, X (14), 16#c33707d6#, S22); -- 26 GG (CC, DD, AA, BB, X (03), 16#f4d50d87#, S23); -- 27 GG (BB, CC, DD, AA, X (08), 16#455a14ed#, S24); -- 28 GG (AA, BB, CC, DD, X (13), 16#a9e3e905#, S21); -- 29 GG (DD, AA, BB, CC, X (02), 16#fcefa3f8#, S22); -- 30 GG (CC, DD, AA, BB, X (07), 16#676f02d9#, S23); -- 31 GG (BB, CC, DD, AA, X (12), 16#8d2a4c8a#, S24); -- 32 -- Round 3 HH (AA, BB, CC, DD, X (05), 16#fffa3942#, S31); -- 33 HH (DD, AA, BB, CC, X (08), 16#8771f681#, S32); -- 34 HH (CC, DD, AA, BB, X (11), 16#6d9d6122#, S33); -- 35 HH (BB, CC, DD, AA, X (14), 16#fde5380c#, S34); -- 36 HH (AA, BB, CC, DD, X (01), 16#a4beea44#, S31); -- 37 HH (DD, AA, BB, CC, X (04), 16#4bdecfa9#, S32); -- 38 HH (CC, DD, AA, BB, X (07), 16#f6bb4b60#, S33); -- 39 HH (BB, CC, DD, AA, X (10), 16#bebfbc70#, S34); -- 40 HH (AA, BB, CC, DD, X (13), 16#289b7ec6#, S31); -- 41 HH (DD, AA, BB, CC, X (00), 16#eaa127fa#, S32); -- 42 HH (CC, DD, AA, BB, X (03), 16#d4ef3085#, S33); -- 43 HH (BB, CC, DD, AA, X (06), 16#04881d05#, S34); -- 44 HH (AA, BB, CC, DD, X (09), 16#d9d4d039#, S31); -- 45 HH (DD, AA, BB, CC, X (12), 16#e6db99e5#, S32); -- 46 HH (CC, DD, AA, BB, X (15), 16#1fa27cf8#, S33); -- 47 HH (BB, CC, DD, AA, X (02), 16#c4ac5665#, S34); -- 48 -- Round 4 II (AA, BB, CC, DD, X (00), 16#f4292244#, S41); -- 49 II (DD, AA, BB, CC, X (07), 16#432aff97#, S42); -- 50 II (CC, DD, AA, BB, X (14), 16#ab9423a7#, S43); -- 51 II (BB, CC, DD, AA, X (05), 16#fc93a039#, S44); -- 52 II (AA, BB, CC, DD, X (12), 16#655b59c3#, S41); -- 53 II (DD, AA, BB, CC, X (03), 16#8f0ccc92#, S42); -- 54 II (CC, DD, AA, BB, X (10), 16#ffeff47d#, S43); -- 55 II (BB, CC, DD, AA, X (01), 16#85845dd1#, S44); -- 56 II (AA, BB, CC, DD, X (08), 16#6fa87e4f#, S41); -- 57 II (DD, AA, BB, CC, X (15), 16#fe2ce6e0#, S42); -- 58 II (CC, DD, AA, BB, X (06), 16#a3014314#, S43); -- 59 II (BB, CC, DD, AA, X (13), 16#4e0811a1#, S44); -- 60 II (AA, BB, CC, DD, X (04), 16#f7537e82#, S41); -- 61 II (DD, AA, BB, CC, X (11), 16#bd3af235#, S42); -- 62 II (CC, DD, AA, BB, X (02), 16#2ad7d2bb#, S43); -- 63 II (BB, CC, DD, AA, X (09), 16#eb86d391#, S44); -- 64 H (0) := H (0) + AA; H (1) := H (1) + BB; H (2) := H (2) + CC; H (3) := H (3) + DD; end Transform; end GNAT.Secure_Hashes.MD5;
AdaCore/gpr
Ada
9,946
ads
-- -- Copyright (C) 2019-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception -- with Ada.Calendar; with GPR2.Unit; with GPR2.Project.View; with GPR2.Project.View.Set; with GPR2.Source; with GPR2.Source_Info; limited with GPR2.Project.Source.Artifact; limited with GPR2.Project.Source.Part_Set; limited with GPR2.Project.Source.Set; package GPR2.Project.Source is use type GPR2.Source.Object; use type GPR2.Unit.Library_Unit_Type; type Naming_Exception_Kind is (No, Yes, Multi_Unit); subtype Naming_Exception_Value is Naming_Exception_Kind range Yes .. Multi_Unit; type Object is new GPR2.Source.Object with private; Undefined : constant Object; -- This constant is equal to any object declared without an explicit -- initializer. type Constant_Access is access constant Object; type Source_Part is record Source : Object; Index : Unit_Index; end record; function "<" (L, R : Source_Part) return Boolean with Inline; overriding function Is_Defined (Self : Object) return Boolean; -- Returns true if Self is defined function Create (Source : GPR2.Source.Object; View : Project.View.Object; Naming_Exception : Naming_Exception_Kind; Is_Compilable : Boolean; Aggregated : Project.View.Object := Project.View.Undefined) return Object with Pre => Source.Is_Defined and then View.Is_Defined and then Aggregated.Is_Defined = (View.Kind = K_Aggregate_Library); -- Constructor for Object. View is where the source is defined (found from -- View Source_Dirs) and Extending_View is the optional view from which the -- project source is extended. That is, if Extending_View is defined then -- this source is coming from an extended project for View. function View (Self : Object) return Project.View.Object with Pre => Self.Is_Defined, Post => View'Result.Is_Defined; -- The view the source is in function Aggregated (Self : Object) return Project.View.Object with Pre => Self.Is_Defined; -- The view where the source is aggregated from function Is_Aggregated (Self : Object) return Boolean with Pre => Self.Is_Defined; -- Returns True if the source is taken into aggregating library source set -- from the aggregated project. function Is_Compilable (Self : Object) return Boolean with Pre => Self.Is_Defined; -- Returns True if the source is compilable, meaning that a compiler is -- defined for this language. function Is_Interface (Self : Object) return Boolean with Pre => Self.Is_Defined; -- Returns True if Self is part of the project view interface function Has_Naming_Exception (Self : Object) return Boolean with Pre => Self.Is_Defined; -- Returns whether the source comes from a naming exception function Naming_Exception (Self : Object) return Naming_Exception_Kind with Pre => Self.Is_Defined, Post => Self.Has_Naming_Exception or else Naming_Exception'Result = No; -- Returns whether the source comes from a naming exception function Has_Aggregating_View (Self : Object) return Boolean with Pre => Self.Is_Defined; -- Returns True if Self has an aggregating view defined, that is source -- is part of an aggregate library. function Aggregating_Views (Self : Object) return Project.View.Set.Object with Pre => Self.Is_Defined and then Self.Has_Aggregating_View, Post => (for all Agg of Aggregating_Views'Result => Agg.Kind = K_Aggregate_Library); -- Returns the aggregating view function Is_Main (Self : Object) return Boolean with Pre => Self.Is_Defined; -- Returns whether the source is the main file to create executable function Is_Compilable (Self : Object; Index : Unit_Index) return Boolean; -- Tells if the unit identified by index, or the source (if no units) -- is compilable (e.g. is a body unit, or a spec_only unit) function Artifacts (Self : Object; Force_Spec : Boolean := False) return Artifact.Object with Pre => Self.Is_Defined; -- Returns the source artifacts for this source. Note that the returned -- Source artifacts may not exist if the compilation has not yet been -- done/finished. -- If Flag Force_Spec is True than the artifact object created like the -- spec does not have a body. This mode is needed for gprinstall -m option. -- -- The following routines only make sense if Has_Units is True -- function Dependencies (Self : Object; Index : Unit_Index := No_Index; Closure : Boolean := False; Sorted : Boolean := True) return Part_Set.Object with Pre => Self.Is_Defined; -- Returns the source files on which the current source file depends. -- -- In case of unit-based sources, if index is No_Index, then dependencies -- of all the units in the source are returned. -- Sorted: if set, the returned object is ordered to have consistent -- result order across runs, else the returned set is a hashed set, that is -- faster to compute. procedure Dependencies (Self : Object; Index : Unit_Index; For_Each : not null access procedure (Source : Object; Index : Unit_Index; Timestamp : Ada.Calendar.Time); Closure : Boolean := False; Sorted : Boolean := True); -- Call For_Each routine for each dependency unit with it's source -- -- The following routines may be used for both unit-based and -- non-unit-based sources. In the latter case, Index is not used. -- Sorted: if set, the returned object is ordered to have consistent -- result order across runs, else the returned set is a hashed set, that is -- faster to compute. procedure Dependencies (Self : Object; Index : Unit_Index; For_Each : not null access procedure (Source : Object; Unit : GPR2.Unit.Object; Timestamp : Ada.Calendar.Time); Closure : Boolean := False; Sorted : Boolean := True); -- Call For_Each routine for each dependency unit with it's source -- -- The following routines may be used for both unit-based and -- non-unit-based sources. In the latter case, Index is not used. function Has_Other_Part (Self : Object; Index : Unit_Index := No_Index) return Boolean with Pre => Self.Is_Defined; -- Returns True if an other part exists for this project source's unit at -- the given index. function Other_Part (Self : Object; Index : Unit_Index := No_Index) return Source_Part with Pre => Self.Is_Defined and then Self.Has_Other_Part (Index), Post => Other_Part'Result.Source.Is_Defined; -- Returns the project's source containing the other part for this project -- source's unit at the given index. function Other_Part_Unchecked (Self : Object; Index : Unit_Index) return Source_Part; -- Same as Other_Part, but returns Undefined if no other part exists for -- Self. function Separate_From (Self : Object; Index : Unit_Index) return Source_Part with Pre => Self.Is_Defined and then Self.Kind (Index) = GPR2.Unit.S_Separate; -- Returns the project's source containing the separate for Self's unit at -- the given index. procedure Update (Self : in out Object; Backends : Source_Info.Backend_Set := Source_Info.All_Backends) with Pre => Self.Is_Defined; -- Ensure that the project source is parsed/updated if needed procedure Update (Self : in out Object; C : Project.Source.Set.Cursor; Backends : Source_Info.Backend_Set := Source_Info.All_Backends) with Pre => Self.Is_Defined; -- Ensure that the project source is parsed/updated if needed private type Object is new GPR2.Source.Object with record View : Project.Weak_Reference; -- Use weak reference to View to avoid reference cycle between Source -- and its View. Otherwise we've got memory leak after release view and -- valgrind detected mess in memory deallocations at the process exit. Aggregated : Project.Weak_Reference; -- View where the source is aggregated from Naming_Exception : Naming_Exception_Kind := No; Is_Compilable : Boolean := False; Inherited : Boolean := False; -- From extended project end record; Undefined : constant Object := (GPR2.Source.Undefined with others => <>); overriding function Is_Defined (Self : Object) return Boolean is (Self /= Undefined); function Is_Aggregated (Self : Object) return Boolean is (not Definition_References."=" (Self.Aggregated, Definition_References.Null_Weak_Ref)); function Is_Compilable (Self : Object; Index : Unit_Index) return Boolean is (Kind (Self, Index) in GPR2.Unit.Body_Kind or else (Self.Language = Ada_Language and then Kind (Self, Index) in GPR2.Unit.Spec_Kind and then not Self.Has_Other_Part (Index))); -- The condition above is about Ada package specs -- without a body, which have to be compilable. function Has_Naming_Exception (Self : Object) return Boolean is (Self.Naming_Exception in Naming_Exception_Value); function Naming_Exception (Self : Object) return Naming_Exception_Kind is (Self.Naming_Exception); function "<" (L, R : Source_Part) return Boolean is (if L.Source = R.Source then L.Index < R.Index else L.Source < R.Source); end GPR2.Project.Source;
reznikmm/matreshka
Ada
4,067
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with ODF.DOM.Style_Font_Name_Complex_Attributes; package Matreshka.ODF_Style.Font_Name_Complex_Attributes is type Style_Font_Name_Complex_Attribute_Node is new Matreshka.ODF_Style.Abstract_Style_Attribute_Node and ODF.DOM.Style_Font_Name_Complex_Attributes.ODF_Style_Font_Name_Complex_Attribute with null record; overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Style_Font_Name_Complex_Attribute_Node; overriding function Get_Local_Name (Self : not null access constant Style_Font_Name_Complex_Attribute_Node) return League.Strings.Universal_String; end Matreshka.ODF_Style.Font_Name_Complex_Attributes;
thierr26/ada-keystore
Ada
4,271
ads
----------------------------------------------------------------------- -- keystore-repository-keys -- Data keys management -- Copyright (C) 2019 Stephane Carrez -- Written by Stephane Carrez ([email protected]) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Keystore.Marshallers; with Keystore.Keys; private package Keystore.Repository.Keys is subtype Key_Count_Type is Interfaces.Unsigned_16 range 0 .. DATA_MAX_KEY_COUNT; type Data_Key_Iterator is limited record Current : Marshallers.Marshaller; Current_Offset : Interfaces.Unsigned_64; Entry_Id : Wallet_Entry_Index; Item : Wallet_Entry_Access; Data_Block : IO.Storage_Block; Directory : Wallet_Directory_Entry_Access; Key_Iter : Wallet_Data_Key_List.Cursor; Data_Size : Stream_Element_Offset; Count : Interfaces.Unsigned_16; Key_Count : Key_Count_Type; Key_Pos : IO.Block_Index; Key_Header_Pos : IO.Block_Index; Key_Last_Pos : IO.Block_Index; end record; type Data_Key_Marker is limited record Directory : Wallet_Directory_Entry_Access; Key_Header_Pos : IO.Block_Index; Key_Count : Interfaces.Unsigned_16; end record; subtype Wallet_Manager is Wallet_Repository; procedure Initialize (Manager : in out Wallet_Manager; Iterator : in out Data_Key_Iterator; Item : in Wallet_Entry_Access); function Has_Data_Key (Iterator : in Data_Key_Iterator) return Boolean; function Is_Last_Key (Iterator : in Data_Key_Iterator) return Boolean; procedure Mark_Data_Key (Iterator : in Data_Key_Iterator; Mark : in out Data_Key_Marker); procedure Next_Data_Key (Manager : in out Wallet_Repository; Iterator : in out Data_Key_Iterator); procedure Delete_Key (Manager : in out Wallet_Repository; Iterator : in out Data_Key_Iterator; Mark : in out Data_Key_Marker); procedure Prepare_Append (Iterator : in out Data_Key_Iterator); procedure Allocate_Key_Slot (Manager : in out Wallet_Repository; Iterator : in out Data_Key_Iterator; Data_Block : in IO.Storage_Block; Size : in IO.Buffer_Size; Key_Pos : out IO.Block_Index; Key_Block : out IO.Storage_Block); procedure Update_Key_Slot (Manager : in out Wallet_Repository; Iterator : in out Data_Key_Iterator; Size : in IO.Buffer_Size); procedure Create_Wallet (Manager : in out Wallet_Repository; Item : in Wallet_Entry_Access; Master_Block : in Keystore.IO.Storage_Block; Keys : in out Keystore.Keys.Key_Manager) with Pre => Item.Is_Wallet; procedure Open_Wallet (Manager : in out Wallet_Repository; Item : in Wallet_Entry_Access; Keys : in out Keystore.Keys.Key_Manager) with Pre => Item.Is_Wallet; private use type Interfaces.Unsigned_16; function Key_Slot_Size (Count : in Interfaces.Unsigned_16) return IO.Block_Index is (IO.Block_Index (DATA_KEY_ENTRY_SIZE * Count)); procedure Load_Next_Keys (Manager : in out Wallet_Manager; Iterator : in out Data_Key_Iterator); end Keystore.Repository.Keys;
AdaCore/gpr
Ada
518
ads
-- -- Copyright (C) 2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-Exception -- with GPR2.Containers; with GPR2.Project.Tree; with GPR2.Source_Reference.Value; package GPR2.Project.Source_Files is package Source_Set renames Containers.Filename_Type_Set; procedure Read (Tree : not null access Project.Tree.Object; Filename : GPR2.Path_Name.Full_Name; Attr : Source_Reference.Value.Object; Set : in out Source_Set.Set); end GPR2.Project.Source_Files;
kimtg/euler-ada
Ada
551
adb
with Ada.Text_IO; procedure Euler12 is Triangle_Num : Positive := 1; I : Positive := 1; J : Positive; Num_Divisors : Natural; begin loop Num_Divisors := 0; J := 1; while J * J <= Triangle_Num loop if Triangle_Num mod J = 0 then Num_Divisors := Num_Divisors + 2; end if; J := J + 1; end loop; Ada.Text_IO.Put_Line(Positive'Image(Triangle_Num) & Natural'Image(Num_Divisors)); exit when Num_Divisors > 500; I := I + 1; Triangle_Num := Triangle_Num + I; end loop; end Euler12;
PThierry/ewok-kernel
Ada
1,792
ads
-- -- Copyright 2018 The wookey project team <[email protected]> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with ewok.tasks_shared; package ewok.syscalls.dma with spark_mode => off is procedure svc_register_dma (caller_id : in ewok.tasks_shared.t_task_id; params : in t_parameters; mode : in ewok.tasks_shared.t_task_mode); procedure svc_register_dma_shm (caller_id : in ewok.tasks_shared.t_task_id; params : in t_parameters; mode : in ewok.tasks_shared.t_task_mode); procedure svc_dma_reconf (caller_id : in ewok.tasks_shared.t_task_id; params : in out t_parameters; mode : in ewok.tasks_shared.t_task_mode); procedure svc_dma_reload (caller_id : in ewok.tasks_shared.t_task_id; params : in out t_parameters; mode : in ewok.tasks_shared.t_task_mode); procedure svc_dma_disable (caller_id : in ewok.tasks_shared.t_task_id; params : in out t_parameters; mode : in ewok.tasks_shared.t_task_mode); end ewok.syscalls.dma;
tj800x/simple_blockchain
Ada
974
ads
with Ada.Calendar; use Ada.Calendar; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; package Simple_Blockchain.Block is type Object is private; function Get_Data (This : Object) return String; function Get_Hash (This : Object) return String; function Get_Nonce (This : Object) return Natural; function Get_Previous_Hash (This : Object) return String; function Get_Timestamp (This : Object) return Time; function Image (This : Object) return String; function Make (Previous_Hash : String; Data : String) return Object; procedure Recalculate_Hash (This : in out Object); function Calculate_Hash (Previous_Hash : String; Timestamp : Time; Nonce : Natural; Data: String) return String; private type Object is record Hash : String (1 .. 64); Previous_Hash : String (1 .. 64); Timestamp : Time; Nonce : Natural; Data : Unbounded_String; end record; end Simple_Blockchain.Block;
charlie5/cBound
Ada
2,145
ads
-- This file is generated by SWIG. Please do not modify by hand. -- with Interfaces; with Interfaces.C; with Interfaces.C.Pointers; package xcb.xcb_render_change_picture_value_list_t is -- Item -- type Item is record repeat : aliased Interfaces.Unsigned_32; alphamap : aliased xcb.xcb_render_picture_t; alphaxorigin : aliased Interfaces.Integer_32; alphayorigin : aliased Interfaces.Integer_32; clipxorigin : aliased Interfaces.Integer_32; clipyorigin : aliased Interfaces.Integer_32; clipmask : aliased xcb.xcb_pixmap_t; graphicsexposure : aliased Interfaces.Unsigned_32; subwindowmode : aliased Interfaces.Unsigned_32; polyedge : aliased Interfaces.Unsigned_32; polymode : aliased Interfaces.Unsigned_32; dither : aliased xcb.xcb_atom_t; componentalpha : aliased Interfaces.Unsigned_32; end record; -- Item_Array -- type Item_Array is array (Interfaces.C .size_t range <>) of aliased xcb .xcb_render_change_picture_value_list_t .Item; -- Pointer -- package C_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_change_picture_value_list_t.Item, Element_Array => xcb.xcb_render_change_picture_value_list_t.Item_Array, Default_Terminator => (others => <>)); subtype Pointer is C_Pointers.Pointer; -- Pointer_Array -- type Pointer_Array is array (Interfaces.C .size_t range <>) of aliased xcb .xcb_render_change_picture_value_list_t .Pointer; -- Pointer_Pointer -- package C_Pointer_Pointers is new Interfaces.C.Pointers (Index => Interfaces.C.size_t, Element => xcb.xcb_render_change_picture_value_list_t.Pointer, Element_Array => xcb.xcb_render_change_picture_value_list_t.Pointer_Array, Default_Terminator => null); subtype Pointer_Pointer is C_Pointer_Pointers.Pointer; end xcb.xcb_render_change_picture_value_list_t;
coopht/axmpp
Ada
3,534
ads
------------------------------------------------------------------------------ -- -- -- AXMPP Project -- -- -- -- XMPP Library for Ada -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, Alexander Basov <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Alexander Basov, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Streams; with League.Strings; package XMPP.Utils is function To_Stream_Element_Array (Value : String) return Ada.Streams.Stream_Element_Array; function Gen_Id (Prefix : League.Strings.Universal_String := League.Strings.Empty_Universal_String) return League.Strings.Universal_String; end XMPP.Utils;
sf17k/sdlada
Ada
2,238
ads
-------------------------------------------------------------------------------------------------------------------- -- Copyright (c) 2014-2015 Luke A. Guest -- -- This software is provided 'as-is', without any express or implied -- warranty. In no event will the authors be held liable for any damages -- arising from the use of this software. -- -- Permission is granted to anyone to use this software for any purpose, -- including commercial applications, and to alter it and redistribute it -- freely, subject to the following restrictions: -- -- 1. The origin of this software must not be misrepresented; you must not -- claim that you wrote the original software. If you use this software -- in a product, an acknowledgment in the product documentation would be -- appreciated but is not required. -- -- 2. Altered source versions must be plainly marked as such, and must not be -- misrepresented as being the original software. -- -- 3. This notice may not be removed or altered from any source -- distribution. -------------------------------------------------------------------------------------------------------------------- -- SDL.Video -- -- Common display and video driver functionality. -------------------------------------------------------------------------------------------------------------------- package SDL.Video is Video_Error : exception; -- Screen saver information. procedure Enable_Screen_Saver with Import => True, Convention => C, External_Name => "SDL_EnableScreenSaver"; procedure Disable_Screen_Saver with Import => True, Convention => C, External_Name => "SDL_DisableScreenSaver"; function Is_Screen_Saver_Enabled return Boolean with Inline => True; -- Video drivers. function Initialise (Name : in String) return Boolean; procedure Finalise with Import => True, Convention => C, External_Name => "SDL_VideoQuit"; function Total_Drivers return Positive; function Driver_Name (Index : in Positive) return String; function Current_Driver_Name return String; -- Videe displays. function Total_Displays return Positive; end SDL.Video;
reznikmm/matreshka
Ada
3,659
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with XML.DOM.Elements; package ODF.DOM.Table_Shapes_Elements is pragma Preelaborate; type ODF_Table_Shapes is limited interface and XML.DOM.Elements.DOM_Element; type ODF_Table_Shapes_Access is access all ODF_Table_Shapes'Class with Storage_Size => 0; end ODF.DOM.Table_Shapes_Elements;
fnarenji/BoiteMaker
Ada
560
adb
procedure poulet_au() is poulet : integer; begin couper(poulet); revenir(poulet); servir(poulet); end; procedure poulet_au(recette : access procedure (poulet : integer)) is poulet : integer; begin couper(poulet); revenir(poulet); recette(poulet); servir(poulet); end; procedure flamber(poulet : integer) is begin -- poulet on fire end; procedure salerpoivrerpaprika(poulet : integer) is begin -- spp end; procedure rien(poulet : integer) is begin null; end; poulet_au(salerpoivrerpaprika'access);
zhmu/ananas
Ada
93
ads
with Generic_Inst12_Pkg1; package Generic_Inst12_Pkg2 is new Generic_Inst12_Pkg1 (Integer);
reznikmm/matreshka
Ada
4,543
adb
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Open Document Toolkit -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2014, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Matreshka.DOM_Documents; with Matreshka.ODF_String_Constants; with ODF.DOM.Iterators; with ODF.DOM.Visitors; package body Matreshka.ODF_Anim.Id_Attributes is ------------ -- Create -- ------------ overriding function Create (Parameters : not null access Matreshka.DOM_Attributes.Attribute_L2_Parameters) return Anim_Id_Attribute_Node is begin return Self : Anim_Id_Attribute_Node do Matreshka.ODF_Anim.Constructors.Initialize (Self'Unchecked_Access, Parameters.Document, Matreshka.ODF_String_Constants.Anim_Prefix); end return; end Create; -------------------- -- Get_Local_Name -- -------------------- overriding function Get_Local_Name (Self : not null access constant Anim_Id_Attribute_Node) return League.Strings.Universal_String is pragma Unreferenced (Self); begin return Matreshka.ODF_String_Constants.Id_Attribute; end Get_Local_Name; begin Matreshka.DOM_Documents.Register_Attribute (Matreshka.ODF_String_Constants.Anim_URI, Matreshka.ODF_String_Constants.Id_Attribute, Anim_Id_Attribute_Node'Tag); end Matreshka.ODF_Anim.Id_Attributes;
molostoff/AdaBaseXClient
Ada
3,067
ads
---------------------------------------------------------------------------- -- -- Ada client for BaseX -- ---------------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Containers.Indefinite_Vectors; with GNAT.Sockets; package AdaBaseXClient is package String_Vectors is new Ada.Containers.Indefinite_Vectors (Natural, String); use String_Vectors; -- -- BaseX exception -- BaseXException : exception; -- -- For Query Command Protocol -- type Query is tagged private; -- -- Inserts a document in the database at the specified path -- function Add (Path : String; Input : String) return String; -- -- Authenticate for this session -- function Authenticate (Username : String; Password : String) return Boolean; -- -- Bind procedure for Query class -- procedure Bind (Self : Query; Name : String; Value : String; Stype : String); -- -- Close a connection to the host -- procedure Close; -- -- Close procedure for Query class -- procedure Close (Self : out Query); -- -- Open a connection to the host -- function Connect (Server : String; Port : Natural) return Boolean; -- -- Create a new database, inserts initial content -- function Create (Name : String; Input : String) return String; -- -- Create a new Query instance -- function CreateQuery (Qstring : String) return Query; -- -- Execute BaseX command -- function Execute (command : String) return String; -- -- Execute function for Query class -- function Execute (Self : Query) return String; -- -- Return process information -- function Info return String; -- -- Initialize procedure for Query class -- procedure Initialize (Self : out Query; MyId : String); -- -- Replaces content at the specified path by the given document -- function Replace (Path : String; Input : String) return String; -- -- Results function for Query class -- Returns all resulting items as strings -- function Results (Self : Query) return String_Vectors.Vector; -- -- Stores a binary resource in the opened database -- function Store (Path : String; Input : String) return String; private -- -- Socket variable -- Socket : GNAT.Sockets.Socket_Type; Channel : GNAT.Sockets.Stream_Access; type Query is tagged record Id : Ada.Strings.Unbounded.Unbounded_String; end record; -- -- Read data from server -- function Read return String; -- -- Read string from server -- function ReadString return String; -- -- Send data to server -- procedure Send (Command : String); -- -- Send Command to server -- procedure SendCmd (Code : Natural; Arg : String; Input : String); -- -- Read status single byte from socket. -- Server replies with \00 (success) or \01 (error). -- function Status return Boolean; end AdaBaseXClient;
reznikmm/matreshka
Ada
3,913
ads
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2012-2013, Vadim Godunko <[email protected]> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with League.Holders; package AMF.Internals.Tables.OCL_Reflection is function Get (Self : AMF.Internals.AMF_Element; Property : CMOF_Element) return League.Holders.Holder; function Get_Meta_Class (Self : AMF.Internals.AMF_Element) return CMOF_Element; procedure Set (Self : AMF.Internals.AMF_Element; Property : CMOF_Element; Value : League.Holders.Holder); end AMF.Internals.Tables.OCL_Reflection;
skill-lang/adaCommon
Ada
1,291
ads
-- ___ _ ___ _ _ -- -- / __| |/ (_) | | Common SKilL implementation -- -- \__ \ ' <| | | |__ iterator over all instances -- -- |___/_|\_\_|_|____| by: Timm Felden -- -- -- pragma Ada_2012; with Skill.Types; with Skill.Types.Pools; with Skill.Iterators.Type_Hierarchy_Iterator; with Skill.Iterators.Static_Data; package Skill.Iterators.Type_Order is use Skill.Types; use Skill.Iterators; -- @note in contrast to c++, this implementation uses type erasure as I dont -- see how to solve elaboration otherwise type Iterator is tagged record Ts : aliased Type_Hierarchy_Iterator.Iterator; Data : aliased Static_Data.Iterator; end record; procedure Init (This : access Iterator'Class; First : Skill.Types.Pools.Pool); function Element (This : access Iterator'Class) return Annotation is (This.Data.Element); function Has_Next (This : access Iterator'Class) return Boolean is (This.Data.Has_Next); function Next (This : access Iterator'Class) return Annotation; end Skill.Iterators.Type_Order;
reznikmm/slimp
Ada
998
ads
-- Copyright (c) 2019 Maxim Reznik <[email protected]> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Slim.Players; with League.String_Vectors; with League.Strings; package Slim.Menu_Commands.Play_File_Commands is type Play_File_Command (Player : Slim.Players.Player_Access) is new Menu_Command with record Root : League.Strings.Universal_String; M3U_Name : League.Strings.Universal_String; Start : Positive; -- Item to play Skip : Natural := 0; -- Skip seconds in the first file Relative_Path_List : League.String_Vectors.Universal_String_Vector; Title_List : League.String_Vectors.Universal_String_Vector; end record; type Play_File_Command_Access is access all Play_File_Command'Class; overriding procedure Run (Self : Play_File_Command); end Slim.Menu_Commands.Play_File_Commands;