content
stringlengths
23
1.05M
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- ...
-- { dg-do run } -- { dg-options "-gnato -O" } with Interfaces; use Interfaces; procedure Opt26 is procedure Shift_Left_Bool (Bool : in Boolean; U8 : out Interfaces.Unsigned_8) is begin U8 := Shift_Left (Boolean'Pos (Bool), 6); end Shift_Left_Bool; procedure Shift_Left_Not_Bool ...
with System; package Last_Chance_Handler is procedure Last_Chance_Handler (File : System.Address; Line : Integer); pragma Export (C, Last_Chance_Handler, "__gnat_last_chance_handler"); pragma No_Return (Last_Chance_Handler); end Last_Chance_Handler;
with Ada.Containers.Indefinite_Vectors; with Imago.IL; with Imago.ILU; use Imago.IL; use Imago.ILU; use type Imago.IL.Bool; use type Imago.IL.UInt; with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with GNATCOLL.Strings; use GNATCOLL.Strings; with Ada.Strings.Maps; with ...
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- ...
with Ada.Numerics.Big_Numbers.Big_Integers; use Ada.Numerics.Big_Numbers.Big_Integers; package body Fibonacci is function Fib_Iter (N : Natural) return Big_Natural is A : Big_Natural := To_Big_Integer (0); B : Big_Natural := To_Big_Integer (1); Tmp : Big_Natural := To_Big_Integer (0); begi...
----------------------------------------------------------------------- -- wiki-render-wiki -- Wiki to Wiki renderer -- Copyright (C) 2015, 2016, 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use t...
with Interfaces; use Interfaces; with AVR; with AVR.USART; -- ============================================================================= -- Package AVR.IMAGE -- -- String types and methods used by AVR. -- ============================================================================= package IMAGE is procedure U8...
-- { dg-do compile } with Array18_Pkg; use Array18_Pkg; procedure Array18 is A : String (1 .. 1); begin A := F; end;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- ...
-- { dg-do run } with Init11; use Init11; with Text_IO; use Text_IO; with Dump; procedure U11 is Local_R1 : R1; Local_R2 : R2; C1 : My_Integer; C2 : My_Integer; begin Local_R1 := (I => 1, A => (16#AB0012#, 16#CD0034#, 16#EF0056#)); Put ("Local_R1 :"); Dump (Local_R1'Address, R1'Max_Size_In_Storage_Ele...
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- ...
-- AOC 2020, Day 8 with Ada.Text_IO; use Ada.Text_IO; with Day; use Day; procedure main is acc : constant Integer := acc_before_repeat("input.txt"); h : constant Integer := acc_after_terminate("input.txt"); begin put_line("Part 1: " & Integer'Image(acc)); put_line("Part 2: " & Integer'Image(h)); end main;
package body Controlled6_Pkg.Iterators is function Find return Iterator_Type is Iterator : Iterator_Type; begin return Iterator; end Find; function Current (Iterator : in Iterator_Type) return T is begin return Iterator.Current.Item; end Current; procedure Find_Next (Iterator : in...
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- ...
-- AoC 2020, Day 12 with Ada.Text_IO; with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions; package body Day is package TIO renames Ada.Text_IO; function char_to_action(c : in Character) return Action_Type is begin case c is when 'N' => return north; when 'S' => return s...
with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Unchecked_Deallocation; with Person_Handling; use Person_Handling; package body Person_Sorted_List is procedure Free is new Ada.Unchecked_Deallocation(Post, List_Type); function Empty(List: Li...
with GNAT.Regpat; use GNAT.Regpat; with Rejuvenation.Finder; use Rejuvenation.Finder; with Rejuvenation.Utils; use Rejuvenation.Utils; package body Rejuvenation.Placeholders is Placeholder_Matcher : constant GNAT.Regpat.Pattern_Matcher := Compile ("\$[SM]_[a-zA-Z0-9_]+"); function Is_Placeholder_...
with Ada.Finalization; with ACO.Messages; with ACO.OD; package ACO.Protocols is type Protocol (Od : not null access ACO.OD.Object_Dictionary'Class) is abstract new Ada.Finalization.Limited_Controlled with private; type Protocol_Access is access all Protocol'Class; function Is_Valid (This : i...
pragma Style_Checks (Off); -- This spec has been automatically generated from STM32H743x.svd pragma Restrictions (No_Elaboration_Code); with HAL; with System; package STM32_SVD.FMC is pragma Preelaborate; --------------- -- Registers -- --------------- subtype BCR_MTYP_Field is HAL.UInt2; subty...
with Ada.Text_IO, Ada.Containers.Indefinite_Vectors; use Ada.Text_IO; procedure Ordered_Words is package Word_Vectors is new Ada.Containers.Indefinite_Vectors (Index_Type => Positive, Element_Type => String); use Word_Vectors; File : File_Type; Ordered_Words : Vector; Max_Length : Positive := 1; b...
----------------------------------------------------------------------- -- util-beans-objects-maps -- Object maps -- Copyright (C) 2010, 2011, 2012, 2017, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may ...
with Ada.Wide_Wide_Text_IO; package body Output_Backend is package IO renames Ada.Wide_Wide_Text_IO; task body Output is begin accept Ready_Wait; loop select accept Enter (Text : Wide_Wide_String; Continues_Word : Boolean) do IO.Put (if Continues_Word then "" e...
with Ada.Text_Io; procedure CompileTimeCalculation is Factorial : constant Integer := 10*9*8*7*6*5*4*3*2*1; begin Ada.Text_Io.Put(Integer'Image(Factorial)); end CompileTimeCalculation;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- ...
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- ...
pragma Warnings (Off); pragma Style_Checks (Off); ------------------------------------------------------------------------- -- GL.Geometry - GL geometry primitives -- -- Copyright (c) Rod Kay 2007 -- AUSTRALIA -- Permission granted to use this software, without any warranty, -- for any purpose, pro...
------------------------------------------------------------------------------ -- G N A T C O L L -- -- -- -- Copyright (C) 2009-2018, AdaCore -- -- ...
------------------------------------------------------------------------------ -- Copyright (c) 2014, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- p...
-- { dg-do compile } -- { dg-options "-O3" } procedure Opt45 is type Index_T is mod 2 ** 32; for Index_T'Size use 32; for Index_T'Alignment use 1; type Array_T is array (Index_T range <>) of Natural; type Array_Ptr_T is access all Array_T; My_Array_1 : aliased Array_T := (1, 2); My_Array_...
package body System.Native_Real_Time is use type C.signed_int; function Clock return Native_Time is Result : aliased C.time.struct_timespec; begin if C.time.clock_gettime (C.time.CLOCK_MONOTONIC, Result'Access) < 0 then raise Program_Error; -- ??? end if; return Result; end...
----------------------------------------------------------------------- -- properties -- Generic name/value property management -- Copyright (C) 2001, 2002, 2003, 2006, 2008, 2009, 2010, 2014 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2...
-- { dg-do run } with Ada.Text_IO, Ada.Tags; procedure Test_Iface_Aggr is package Pkg is type Iface is interface; function Constructor (S: Iface) return Iface'Class is abstract; procedure Do_Test (It : Iface'class); type Root is abstract tagged record Comp_1 : Natural := 0; end re...
-- -- The author disclaims copyright to this source code. In place of -- a legal notice, here is a blessing: -- -- May you do good and not evil. -- May you find forgiveness for yourself and forgive others. -- May you share freely, not taking more than you give. -- with Ada.Strings.Unbounded; with Types; w...
with Ada.Text_IO; use Ada.Text_IO; package body Test_Assertions is Max : constant := 50; Separators : constant String (1 .. 60) := (others => '.'); ----------------- -- Assert_True -- ----------------- procedure Assert_True (Value : Boolean) is begin if not Value then rais...
-- Copyright 2016-2021 Bartek thindil Jasicki -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (a...
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- ...
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- ...
---------------------------------------------------------------- -- ZLib for Ada thick binding. -- -- -- -- Copyright (C) 2002-2003 Dmitriy Anisimkov -- -- ...
-- -- Copyright 2018 The wookey project team <wookey@ssi.gouv.fr> -- - Ryad Benadjila -- - Arnauld Michelizza -- - Mathieu Renard -- - Philippe Thierry -- - Philippe Trebuchet -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the...
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2020, AdaCore -- -- -- -- ...
function Fib (X: in Integer) return Integer is function Actual_Fib (N: in Integer) return Integer is begin if N < 2 then return N; else return Actual_Fib (N-1) + Actual_Fib (N-2); end if; end Actual_Fib; begin if X < 0 then raise ...
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- ...
generic with procedure Process_Data(Item: Data); with function Stop return Boolean; with procedure Finish; package Bin_Trees.Traverse is task Inorder_Task is entry Run(Tree: Tree_Type); -- this will call each Item in Tree and, at the very end, it will call Finish ...
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- ...
pragma Ada_2012; with Ada.Strings.Fixed; with Fakedsp.Data_Streams.Wave; with Fakedsp.Data_Streams.Text; with Utilities.Option_Lists; use Ada; use Utilities; with Ada.Text_IO; with Ada.Directories; package body Fakedsp.Data_Streams.Files is subtype Known_Types is File_Type range File_Type'First .. F...
-- { dg-do compile } with Ada.Containers.Ordered_Maps; with Ada.Tags.Generic_Dispatching_Constructor; package body gen_disp is use type Ada.Tags.Tag; function "<" (L, R : in Ada.Tags.Tag) return Boolean is begin return Ada.Tags.External_Tag (L) < Ada.Tags.External_Tag (R); end "<"; pac...
----------------------------------------------------------------------- -- components-utils-scripts -- Javascript queue -- Copyright (C) 2011, 2012, 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may ...
pragma License (Unrestricted); -- extended unit private with System.Unbounded_Allocators; package System.Storage_Pools.Subpools.Unbounded is -- The subpools version of System.Storage_Pools.Unbounded. pragma Preelaborate; type Unbounded_Pool_With_Subpools is limited new Root_Storage_Pool_With_Subpools ...
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, AdaCore -- -- -- -- ...
-- This package has been generated automatically by GNATtest. -- You are allowed to add your code to the bodies of test routines. -- Such changes will be kept during further regeneration of this file. -- All code placed outside of test routine bodies will be lost. The -- code intended to set up and tear down the t...
----------------------------------------------------------------------- -- html -- ASF HTML Components -- Copyright (C) 2009, 2010, 2011, 2017, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use thi...
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- ...
with System.Wid_Char; package body System.Wid_WChar is function Width_Wide_Character (Lo, Hi : Wide_Character) return Natural is begin if Lo > Hi then return 0; elsif Hi <= Wide_Character'Val (16#7f#) then return Wid_Char.Width_Character ( Character'Val (Wide_Character'P...
with TEXT_IO; package PREFACE is procedure PUT(S: STRING); procedure SET_COL(PC : TEXT_IO.POSITIVE_COUNT); procedure PUT_LINE(S : STRING); procedure NEW_LINE(SPACING : TEXT_IO.POSITIVE_COUNT := 1); procedure PUT(N : INTEGER; WIDTH : TEXT_IO.FIELD := INTEGER'WIDTH); end PREFACE;
-- part of OpenGLAda, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "COPYING" with Glfw.Enums; with Glfw.Display; with Glfw.Events.Keys; with Glfw.Events.Mouse; with Glfw.Events.Joysticks; with Interfaces.C.Strings; with System; private package Glfw.API is type Raw_Video_M...
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2018 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/L...
----------------------------------------------------------------------- -- awa-counters-beans -- Counter bean definition -- Copyright (C) 2015, 2016, 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not u...
-- part of AdaYaml, (c) 2017 Felix Krause -- released under the terms of the MIT license, see the file "copying.txt" package body Yaml.Events.Store is function New_Store return Reference is Ptr : constant not null Instance_Access := new Instance; begin return (Ada.Finalization.Controlled with Data ...
-- Copyright (c) 2016 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applic...
package Pack4 is type Buffer is array (Natural range <>) of Boolean; type Root (Size : Natural) is tagged record Data : Buffer (1..Size); end record; pragma Pack (Root); type Derived is new Root with null record; end Pack4;
-------------------------------------------------------------------------------- -- MIT License -- -- Copyright (c) 2020 Zane Myers -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software witho...
-- { dg-do compile } with Interfaces.C; use Interfaces.C; procedure Object_Overflow3 is procedure Proc (x : Boolean) is begin null; end; type Arr is array(0 .. ptrdiff_t'Last) of Boolean; type Rec is record A : Arr; B : Arr; end record; Obj : Rec; -- { dg-warning "Storage_Error" } begin Obj.A...
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- ...
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- ...
------------------------------------------------------------------------------- -- Copyright (c) 2020 Daniel King -- -- 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...
with Ada.Text_IO; use Ada.Text_IO; package body Inline11_Pkg is function My_Img (I : Integer) return String is begin return I'Img; end; procedure Trace (I : Integer) is begin Put_Line (My_Img (I)); end; end Inline11_Pkg;
pragma License (Unrestricted); package Interfaces.COBOL is pragma Preelaborate; -- Types and operations for internal data representations type Floating is new Float; -- implementation-defined type Long_Floating is new Long_Float; -- implementation-defined type Binary is new Integer; -- implementation...
With Ada.Text_IO; Use Ada.Text_IO; Procedure MultiplicaMatriz is type Integer_Matrix is array (Integer range <>, Integer range <>) of Integer'Base; matriz1 : Integer_Matrix(1..3, 1..2); matriz2 : Integer_Matrix(1..2, 1..3); resultado: Integer_Matrix(1..3, 1..3); -- Leitura String function Get_String return St...
with Ada.Text_IO; with BigInteger; use BigInteger; package body Problem_13 is package IO renames Ada.Text_IO; procedure Solve is type Problem_13_Array is Array (1 .. 100) of BigInt; nums : Problem_13_Array; sum : BigInt := BigInteger.Create(0); begin nums( 1) := BigInteger.Create("371...
-- This spec has been automatically generated from STM32F303xE.svd -- Definition of the device's interrupts package STM32_SVD.Interrupts is ---------------- -- Interrupts -- ---------------- -- Window Watchdog interrupt WWDG : constant := 0; -- PVD through EXTI line de...
package zlib.Strings is pragma Preelaborate; procedure Deflate ( Stream : in out zlib.Stream; In_Item : in String; In_Last : out Natural; Out_Item : out Ada.Streams.Stream_Element_Array; Out_Last : out Ada.Streams.Stream_Element_Offset; Finish : in Boolean; Finished : out Boolean); procedure Deflat...
-- Abstract : -- -- Subprograms common to more than one parser, higher-level than in wisitoken.ads -- -- Copyright (C) 2018 - 2019 Free Software Foundation, Inc. -- -- 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 Fre...
pragma License (Unrestricted); -- Ada 2012 with Ada.Characters.Handling; private with Ada.UCD; package Ada.Wide_Wide_Characters.Handling is -- pragma Pure; pragma Preelaborate; -- function Character_Set_Version return String; Character_Set_Version : constant String; function Is_Control (Item : Wide_Wide_C...
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- ...
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- ...
with Ada.Text_IO; use Ada.Text_IO; with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random; procedure Test_Monte_Carlo is Dice : Generator; function Pi (Throws : Positive) return Float is Inside : Natural := 0; begin for Throw in 1..Throws loop if Random (Dice) ** 2...
------------------------------------------------------------------------------ -- -- -- tiled-code-gen -- -- -- -- ...
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- ...
-- -- Copyright (C) 2018, AdaCore -- -- Copyright (c) 2013, Nordic Semiconductor ASA -- 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 t...
type Restricted is range 1..10; My_Var : Restricted; if My_Var = 5 then -- do something elsif My_Var > 5 then -- do something else -- do something end if;
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired) -- -- Copyright William A. Whitaker (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is C...
with Ada.Strings.Bounded; package Trie is package BoundedString is new Ada.Strings.Bounded.Generic_Bounded_Length(Max => 16); type Trie is private; type Fragment_Endpoints is record first, last : Positive; end record; type Fragment_Endpoint_Array is Array(Positive range <>) of Fragment_Endpoints; ...
---------------------------------------------------------------------------- -- Symbolic Expressions (symexpr) -- -- Copyright (C) 2012, Riccardo Bernardini -- -- This file is part of symexpr. -- -- symexpr is free software: you can redistribute it and/or modify -- it under the t...
-- hello_world.adb with Ada.Text_IO; use Ada.Text_IO; procedure hello_world is begin Put_Line("Hello world!"); Put("It's a wonderful day!"); New_Line; end hello_world;
with Interfaces.C; use Interfaces.C; with common_data_h; use common_data_h; with speed_data_h; use speed_data_h; with types; package converters with SPARK_Mode is use Types; function double_to_speed (d : double) return Types.speed with Pre => d > Double(-80.0) and d < Double(80.0), Post => double_...
with stm32.gpio; with Bit_Types; use Bit_Types; package HAL.GPIO with SPARK_Mode is pragma Preelaborate; type GPIO_Port_Type is (A, B, C, D, E, F); subtype GPIO_Pin_Type is Integer range 1 .. 16; type GPIO_Point_Type is record Port : GPIO_Port_Type; Pin : GPIO_Pin_Type; end record; ...
procedure Operator is Result : Integer; begin Result := "+" (Left => 1, Right => 1); Result := 1 + 1; end Operator;
-- { dg-do run } -- Verify that an array of non-aliased zero-sized element is zero-sized procedure Array10 is type Rec is null record; type Arr1 is array (1..8) of Rec; type Arr2 is array (Long_Integer) of Rec; R : Rec; A1 : Arr1; A2 : Arr2; begin if Rec'Size /= 0 then raise Program_Error; end ...
-- { dg-do compile } -- { dg-options "-gnatwa" } package Rep_Clause1 is generic type Custom_T is private; package Handler is type Storage_T is record A : Boolean; B : Boolean; C : Custom_T; end record; for Storage_T use record A at 0 range 0..0; ...
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- ...
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- ...
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- ...
with Ada.Text_IO; use Ada.Text_IO; with GL.Objects.Shaders; with Program_Loader; package body Shader_Manager is Black : constant GL.Types.Singles.Vector4 := (0.0, 0.0, 0.0, 0.0); Render_Uniforms : Shader_Uniforms; procedure Init (Render_Program : in out GL.Objects.Programs.Program) is ...
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, AdaCore -- -- -- -- ...
-- This demonstration illustrates the use of PWM to control the brightness of -- an LED. The effect is to make the LED increase and decrease in brightness, -- iteratively, for as long as the application runs. In effect the LED light -- waxes and wanes. See http://visualgdb.com/tutorials/arm/stm32/fpu/ for the -- ...
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- ...
package Aliasing2 is type Arr is Array (1..4) of Integer; type Ptr is access all Integer; A : Arr; function F (P : Ptr) return Integer; end Aliasing2;
-- Copyright 2016,2017 Steven Stewart-Gallus -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law o...
with gel.World, gel.Camera, gel.Window; package gel.Applet.gui_world -- -- Provides a gel applet configured with a single window and a single GUI world. -- is type Item is new gel.Applet.item with private; type View is access all Item'Class; package Forge is function new_Applet (Nam...