doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
36661a6c-46b0-4c7b-8398-161eff312fd3
{ "language": "Ada" }
```ada ``` Add a unit test for HTML filter internals
```ada ----------------------------------------------------------------------- -- wiki-filters-html-tests -- Unit tests for wiki HTML filters -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package Wiki.Filters.Html.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Test Find_Tag operation. procedure Test_Find_Tag (T : in out Test); end Wiki.Filters.Html.Tests; ```
97cbfd6a-e432-4962-a887-37b8a8aaddc7
{ "language": "Ada" }
```ada ``` Test that ARRAY_RANGE_REF returns an array not an element.
```ada -- RUN: %llvmgcc -c %s -o /dev/null procedure Array_Range_Ref is A : String (1 .. 3); B : String := A (A'RANGE)(1 .. 3); begin null; end; ```
33be0333-cde2-415a-8be8-4af9d510a9b3
{ "language": "Ada" }
```ada ``` Define new generic package for the REST API definition
```ada ----------------------------------------------------------------------- -- asf-rest-operation -- REST API Operation Definition -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- generic Handler : Operation_Access; Method : Method_Type := GET; URI : String; Permission : Security.Permissions.Permission_Index := Security.Permissions.NONE; package ASF.Rest.Operation is function Definition return Descriptor_Access; end ASF.Rest.Operation; ```
34374b50-a086-4825-80e0-8a0ed91ad2a5
{ "language": "Ada" }
```ada ``` Add the ASIS file $i
```ada ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . S P A N _ E N D -- -- -- -- S p e c -- -- -- -- Copyright (c) 1995-1999, 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, 59 Temple Place -- -- - Suite 330, Boston, MA 02111-1307, 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 Ada Core Technologies Inc -- -- (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ with Asis; use Asis; with Types; use Types; package A4G.Span_End is -- This package encapsulates queries needed to find the end of Element's -- Span (as the pointer to the Source Buffer). function Set_Image_End (E : Asis.Element) return Source_Ptr; -- This is the main function in this package. It returns the pointer -- to the last character of the given element in the Source Buffer end A4G.Span_End; ```
6a7eb634-dbe0-4161-b0ce-a292793e818f
{ "language": "Ada" }
```ada ``` Implement new unit test for Parse_Address
```ada ----------------------------------------------------------------------- -- util-mail-tests -- Unit tests for mail -- Copyright (C) 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; package body Util.Mail.Tests is package Caller is new Util.Test_Caller (Test, "Strings"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Mail.Parse_Address", Test_Parse_Address'Access); end Add_Tests; procedure Test_Parse_Address (T : in out Test) is use Ada.Strings.Unbounded; procedure Check (Value : in String; Name : in String; Email : in String); procedure Check (Value : in String; Name : in String; Email : in String) is A : constant Email_Address := Parse_Address (Value); begin Util.Tests.Assert_Equals (T, Name, To_String (A.Name), "Invalid name for: " & Value); Util.Tests.Assert_Equals (T, Email, To_String (A.Address), "Invalid email for: " & Value); end Check; begin Check ("Luke Jedi <Luke@skywalker.universe> ", "Luke Jedi", "Luke@skywalker.universe"); Check (" <Anakin@skywalker.universe> ", "Anakin", "Anakin@skywalker.universe"); Check (" Vador@skywalker.universe ", "Vador", "Vador@skywalker.universe"); end Test_Parse_Address; end Util.Mail.Tests; ```
c66ad8db-cc93-4a05-9c75-a98027cd9519
{ "language": "Ada" }
```ada ``` Add OAuth client unit tests
```ada ----------------------------------------------------------------------- -- Security-oauth-clients-tests - Unit tests for OAuth -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package Security.OAuth.Clients.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Test Create_Nonce operation. procedure Test_Create_Nonce (T : in out Test); end Security.OAuth.Clients.Tests; ```
8577b026-b6cf-4786-8cd1-f900bf54ef65
{ "language": "Ada" }
```ada ``` Define a method and binding for an Ada bean to receive an uploaded file
```ada ----------------------------------------------------------------------- -- asf-parts -- ASF Parts -- Copyright (C) 2011, 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with EL.Methods.Proc_In; package ASF.Parts.Upload_Method is new EL.Methods.Proc_In (Param1_Type => ASF.Parts.Part'Class); ```
02b585e6-44b8-4877-be07-6968ebbafd24
{ "language": "Ada" }
```ada ----------------------------------------------------------------------- -- AUnit utils - Helper for writing unit tests -- Copyright (C) 2009, 2010, 2011 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Util.Test_Caller is procedure Add_Test (Suite : in Util.Tests.Access_Test_Suite; Test_Name : in String; Method : in Caller.Test_Method) is begin Suite.Add_Test (Caller.Create (Test_Name, Method)); end Add_Test; end Util.Test_Caller; ``` Use the Is_Test_Enabled function to ignore or take into account the test when it is added in the testsuite.
```ada ----------------------------------------------------------------------- -- AUnit utils - Helper for writing unit tests -- Copyright (C) 2009, 2010, 2011, 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Util.Test_Caller is procedure Add_Test (Suite : in Util.Tests.Access_Test_Suite; Test_Name : in String; Method : in Caller.Test_Method) is begin if Util.Tests.Is_Test_Enabled (Test_Name) then Suite.Add_Test (Caller.Create (Test_Name, Method)); end if; end Add_Test; end Util.Test_Caller; ```
ec2b309a-7d87-41c5-889e-d41548034582
{ "language": "Ada" }
```ada ``` Implement the To_Html and To_Text functions
```ada ----------------------------------------------------------------------- -- wiki-utils -- Wiki utility operations -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Wiki.Render.Text; with Wiki.Render.Html; with Wiki.Writers.Builders; package body Wiki.Utils is -- ------------------------------ -- Render the wiki text according to the wiki syntax in HTML into a string. -- ------------------------------ function To_Html (Text : in Wide_Wide_String; Syntax : in Wiki.Parsers.Wiki_Syntax_Type) return String is Writer : aliased Wiki.Writers.Builders.Html_Writer_Type; Renderer : aliased Wiki.Render.Html.Html_Writer; begin Renderer.Set_Writer (Writer'Unchecked_Access); Wiki.Parsers.Parse (Renderer'Unchecked_Access, Text, Syntax); return Writer.To_String; end To_Html; -- ------------------------------ -- Render the wiki text according to the wiki syntax in text into a string. -- Wiki formatting and decoration are removed. -- ------------------------------ function To_Text (Text : in Wide_Wide_String; Syntax : in Wiki.Parsers.Wiki_Syntax_Type) return String is Writer : aliased Wiki.Writers.Builders.Writer_Builder_Type; Renderer : aliased Wiki.Render.Text.Text_Renderer; begin Renderer.Set_Writer (Writer'Unchecked_Access); Wiki.Parsers.Parse (Renderer'Unchecked_Access, Text, Syntax); return Writer.To_String; end To_Text; end Wiki.Utils; ```
79a472fb-6f98-4904-a500-9c60d0c8360a
{ "language": "Ada" }
```ada ``` Define the factory for the creation of widget components
```ada ----------------------------------------------------------------------- -- widgets-factory -- Factory for widget Components -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Factory; package ASF.Components.Widgets.Factory is -- Get the widget component factory. function Definition return ASF.Factory.Factory_Bindings_Access; end ASF.Components.Widgets.Factory; ```
0afbdc7d-1421-4a65-b29c-05fb4b97069b
{ "language": "Ada" }
```ada ``` Refactor Node_List and references to use Ada Util general references
```ada ----------------------------------------------------------------------- -- wiki-nodes-lists -- Wiki Document Internal representation -- Copyright (C) 2016, 2019 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Refs; package Wiki.Nodes.Lists is pragma Preelaborate; package Node_List_Refs is new Util.Refs.General_References (Node_List, Finalize); type Node_List_Ref is new Node_List_Refs.Ref with null record; -- Append a node to the node list. procedure Append (Into : in out Node_List_Ref; Node : in Node_Type_Access); -- Iterate over the nodes of the list and call the <tt>Process</tt> procedure with -- each node instance. procedure Iterate (List : in Node_List_Access; Process : not null access procedure (Node : in Node_Type)); -- Iterate over the nodes of the list and call the <tt>Process</tt> procedure with -- each node instance. procedure Iterate (List : in Node_List_Ref; Process : not null access procedure (Node : in Node_Type)); -- Returns True if the list reference is empty. function Is_Empty (List : in Node_List_Ref) return Boolean; -- Get the number of nodes in the list. function Length (List : in Node_List_Ref) return Natural; private subtype Node_List_Accessor is Node_List_Refs.Element_Accessor; procedure Iterate (List : in Node_List_Accessor; Process : not null access procedure (Node : in Node_Type)); end Wiki.Nodes.Lists; ```
31446496-b4f5-4bd6-a0ca-30032108169a
{ "language": "Ada" }
```ada ``` Implement the TOC filter to collect the table of content
```ada ----------------------------------------------------------------------- -- wiki-filters-toc -- Filter for the creation of Table Of Contents -- Copyright (C) 2016 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Wiki.Nodes; package body Wiki.Filters.TOC is -- ------------------------------ -- Add a section header with the given level in the document. -- ------------------------------ overriding procedure Add_Header (Filter : in out TOC_Filter; Document : in out Wiki.Documents.Document; Header : in Wiki.Strings.WString; Level : in Natural) is T : Wiki.Nodes.Node_List_Ref; begin Document.Get_TOC (T); Wiki.Nodes.Append (T, new Wiki.Nodes.Node_Type '(Kind => Wiki.Nodes.N_TOC_ENTRY, Len => Header'Length, Header => Header, Level => Level)); Filter_Type (Filter).Add_Header (Document, Header, Level); end Add_Header; end Wiki.Filters.TOC; ```
b149caaa-f7e0-46d4-8d8d-f2def231e33a
{ "language": "Ada" }
```ada ``` Add unit tests for OAuth package and Create_Nonce operation
```ada ----------------------------------------------------------------------- -- Security-oauth-clients-tests - Unit tests for OAuth -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with Util.Measures; with Util.Strings.Sets; package body Security.OAuth.Clients.Tests is package Caller is new Util.Test_Caller (Test, "Security.OAuth.Clients"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Security.OAuth.Clients.Create_Nonce", Test_Create_Nonce'Access); end Add_Tests; -- ------------------------------ -- Test Create_Nonce operation. -- ------------------------------ procedure Test_Create_Nonce (T : in out Test) is Nonces : Util.Strings.Sets.Set; begin for I in 1 .. 1_000 loop for I in 32 .. 734 loop declare S : constant String := Create_Nonce (I * 3); begin T.Assert (not Nonces.Contains (S), "Nonce was not unique: " & S); Nonces.Include (S); end; end loop; end loop; declare S : Util.Measures.Stamp; begin for I in 1 .. 1_000 loop declare Nonce : constant String := Create_Nonce (128); pragma Unreferenced (Nonce); begin null; end; end loop; Util.Measures.Report (S, "128 bits nonce generation (1000 calls)"); end; end Test_Create_Nonce; end Security.OAuth.Clients.Tests; ```
697dc86b-f819-4b66-83bf-a463c682037e
{ "language": "Ada" }
```ada ``` Implement the atomic counters using the gcc builtins __sync_add_and_fetch_4 and __sync_fetch_and_add_4
```ada ----------------------------------------------------------------------- -- Util.Concurrent -- Concurrent Counters -- Copyright (C) 2009, 2010, 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Util.Concurrent.Counters is use Interfaces; function Sync_Add_And_Fetch (Ptr : access Interfaces.Unsigned_32; Value : Interfaces.Integer_32) return Interfaces.Unsigned_32; pragma Import (Intrinsic, Sync_Add_And_Fetch, External_Name => "__sync_add_and_fetch_4"); function Sync_Fetch_And_Add (Ptr : access Interfaces.Unsigned_32; Value : Interfaces.Integer_32) return Interfaces.Unsigned_32; pragma Import (Intrinsic, Sync_Fetch_And_Add, External_Name => "__sync_fetch_and_add_4"); procedure Sync_Add (Ptr : access Interfaces.Unsigned_32; Value : Interfaces.Unsigned_32); pragma Import (Intrinsic, Sync_Add, External_Name => "__sync_add_and_fetch_4"); -- ------------------------------ -- Increment the counter atomically. -- ------------------------------ procedure Increment (C : in out Counter) is begin Sync_Add (C.Value'Unrestricted_Access, 1); end Increment; -- ------------------------------ -- Increment the counter atomically and return the value before increment. -- ------------------------------ procedure Increment (C : in out Counter; Value : out Integer) is begin Value := Integer (Sync_Fetch_And_Add (C.Value'Unrestricted_Access, 1)); end Increment; -- ------------------------------ -- Decrement the counter atomically. -- ------------------------------ procedure Decrement (C : in out Counter) is begin Sync_Add (C.Value'Unrestricted_Access, -1); end Decrement; -- ------------------------------ -- Decrement the counter atomically and return a status. -- ------------------------------ procedure Decrement (C : in out Counter; Is_Zero : out Boolean) is Value : Unsigned_32; begin Value := Sync_Add_And_Fetch (C.Value'Unrestricted_Access, -1); Is_Zero := Value /= 0; end Decrement; -- ------------------------------ -- Get the counter value -- ------------------------------ function Value (C : in Counter) return Integer is begin return Integer (C.Value); end Value; end Util.Concurrent.Counters; ```
ede07ba8-d228-41a0-a9a5-1d891ba74db4
{ "language": "Ada" }
```ada ``` Add the ASIS file $i
```ada ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . S P A N _ E N D -- -- -- -- S p e c -- -- -- -- Copyright (c) 1995-1999, 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, 59 Temple Place -- -- - Suite 330, Boston, MA 02111-1307, 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 Ada Core Technologies Inc -- -- (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ with Asis; use Asis; with Types; use Types; package A4G.Span_End is -- This package encapsulates queries needed to find the end of Element's -- Span (as the pointer to the Source Buffer). function Set_Image_End (E : Asis.Element) return Source_Ptr; -- This is the main function in this package. It returns the pointer -- to the last character of the given element in the Source Buffer end A4G.Span_End; ```
01aa5d66-d5eb-40f3-b96f-33ba9462b579
{ "language": "Ada" }
```ada ``` Add unit tests for JWT
```ada ----------------------------------------------------------------------- -- Security-oayth-jwt-tests - Unit tests for JSON Web Token -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package Security.OAuth.JWT.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Test Decode operation with errors. procedure Test_Decode_Error (T : in out Test); generic with function Get (From : in Token) return String; Value : String; procedure Test_Operation (T : in out Test); generic with function Get (From : in Token) return Ada.Calendar.Time; Value : String; procedure Test_Time_Operation (T : in out Test); end Security.OAuth.JWT.Tests; ```
9bed30fb-bbef-41c2-b25c-3d9431cdc25a
{ "language": "Ada" }
```ada ``` Add a new test for Compress_Stream using LZMA
```ada ----------------------------------------------------------------------- -- util-streams-buffered-lzma-tests -- Unit tests for LZMA buffered streams -- Copyright (C) 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package Util.Streams.Buffered.Lzma.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; procedure Test_Compress_Stream (T : in out Test); end Util.Streams.Buffered.Lzma.Tests; ```
9be5c1ee-0df8-4ddb-878d-b51bf9c1f732
{ "language": "Ada" }
```ada ``` Add a new set of unit tests for the date converter
```ada ----------------------------------------------------------------------- -- asf-converters-tests - Unit tests for ASF.Converters -- Copyright (C) 2014 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; with ASF.Contexts.Faces.Tests; package ASF.Converters.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new ASF.Contexts.Faces.Tests.Test with null record; -- Test the date short converter. procedure Test_Date_Short_Converter (T : in out Test); -- Test the date medium converter. procedure Test_Date_Medium_Converter (T : in out Test); -- Test the date long converter. procedure Test_Date_Long_Converter (T : in out Test); -- Test the date full converter. procedure Test_Date_Full_Converter (T : in out Test); -- Test the time short converter. procedure Test_Time_Short_Converter (T : in out Test); -- Test the time short converter. procedure Test_Time_Medium_Converter (T : in out Test); -- Test the time long converter. procedure Test_Time_Long_Converter (T : in out Test); end ASF.Converters.Tests; ```
0a2be39e-635e-4f63-aaa6-3197407b48ff
{ "language": "Ada" }
```ada ``` Declare the MAT.Events.Tools package and move the Target_Event_Vectors definition in it
```ada ----------------------------------------------------------------------- -- mat-events-tools - Profiler Events Description -- Copyright (C) 2014, 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Containers.Vectors; package MAT.Events.Tools is Not_Found : exception; package Target_Event_Vectors is new Ada.Containers.Vectors (Positive, Target_Event_Type); subtype Target_Event_Vector is Target_Event_Vectors.Vector; subtype Target_Event_Cursor is Target_Event_Vectors.Cursor; -- Find in the list the first event with the given type. -- Raise <tt>Not_Found</tt> if the list does not contain such event. function Find (List : in Target_Event_Vector; Kind : in Probe_Index_Type) return Target_Event_Type; end MAT.Events.Tools; ```
fe0c075e-0fde-4da9-84b5-134baa386d8a
{ "language": "Ada" }
```ada ``` Define an ASF Security package
```ada ----------------------------------------------------------------------- -- asf-security -- ASF Security -- Copyright (C) 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package ASF.Security is end ASF.Security; ```
e1f0171c-d3b0-4c51-9858-4d977ae9282c
{ "language": "Ada" }
```ada ``` Backup store to access files (local, remote, ...)
```ada ----------------------------------------------------------------------- -- babel-stores -- Storage management -- Copyright (C) 2014 Stephane.Carrez -- Written by Stephane.Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Babel.Files; with Babel.Files.Buffers; with Babel.Filters; package Babel.Stores is type Store_Type is limited interface; type Store_Type_Access is access all Store_Type'Class; procedure Read (Store : in out Store_Type; Path : in String; Into : in out Babel.Files.Buffers.Buffer) is abstract; procedure Write (Store : in out Store_Type; Path : in String; Into : in Babel.Files.Buffers.Buffer) is abstract; procedure Scan (Store : in out Store_Type; Path : in String; Into : in out Babel.Files.File_Container'Class; Filter : in Babel.Filters.Filter_Type'Class) is abstract; end Babel.Stores; ```
4945ae94-0d56-481e-a354-d865c614a1ae
{ "language": "Ada" }
```ada ``` Implement the Get_Document_Name function for the Google Code wiki syntax
```ada ----------------------------------------------------------------------- -- gen-artifacts-docs-googlecode -- Artifact for Googlecode documentation format -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Gen.Artifacts.Docs.Googlecode is -- ------------------------------ -- Get the document name from the file document (ex: <name>.wiki or <name>.md). -- ------------------------------ overriding function Get_Document_Name (Formatter : in Document_Formatter; Document : in File_Document) return String is begin return Ada.Strings.Unbounded.To_String (Document.Name) & ".wiki"; end Get_Document_Name; end Gen.Artifacts.Docs.Googlecode; ```
462255c8-504e-4185-a663-9bc50b1836c3
{ "language": "Ada" }
```ada ``` Implement operations for blob streams
```ada ----------------------------------------------------------------------- -- ado-utils-streams -- IO stream utilities -- Copyright (C) 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body ADO.Utils.Streams is use type Ada.Streams.Stream_Element_Offset; subtype Offset is Ada.Streams.Stream_Element_Offset; -- ------------------------------ -- Initialize the blob stream to read the content of the blob. -- ------------------------------ procedure Initialize (Stream : in out Blob_Stream; Blob : in ADO.Blob_Ref) is begin Stream.Data := Blob; Stream.Pos := 1; end Initialize; -- ------------------------------ -- Read into the buffer as many bytes as possible and return in -- <b>last</b> the position of the last byte read. -- ------------------------------ overriding procedure Read (Stream : in out Blob_Stream; Into : out Ada.Streams.Stream_Element_Array; Last : out Ada.Streams.Stream_Element_Offset) is Blob : constant Blob_Access := Stream.Data.Value; Avail : Offset; begin if Blob = null then Last := Into'First - 1; else Avail := Blob.Data'Last - Stream.Pos + 1; if Avail > Into'Length then Avail := Into'Length; end if; Last := Into'First + Avail - 1; if Avail > 0 then Into (Into'First .. Last) := Blob.Data (Stream.Pos .. Stream.Pos + Avail - 1); Stream.Pos := Stream.Pos + Avail; end if; end if; end Read; function Get_Blob (Stream : in Blob_Output_Stream) return Blob_Ref is Size : constant Offset := Offset (Stream.Get_Size); Buffer : constant Util.Streams.Buffered.Buffer_Access := Stream.Get_Buffer; begin return Create_Blob (Data => Buffer (Buffer'First .. Buffer'First + Size - 1)); end Get_Blob; end ADO.Utils.Streams; ```
962ec065-f001-4036-99e0-341b2d8cfb81
{ "language": "Ada" }
```ada ``` Implement a new test for the HTML filters internal operations
```ada ----------------------------------------------------------------------- -- wiki-filters-html-tests -- Unit tests for wiki HTML filters -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with Util.Assertions; with Util.Strings; with Util.Log.Loggers; package body Wiki.Filters.Html.Tests is Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Wiki.Filters"); package Caller is new Util.Test_Caller (Test, "Wikis.Filters.Html"); procedure Assert_Equals is new Util.Assertions.Assert_Equals_T (Html_Tag_Type); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Wiki.Filters.Html.Find_Tag", Test_Find_Tag'Access); end Add_Tests; -- Test Find_Tag operation. procedure Test_Find_Tag (T : in out Test) is begin for I in Html_Tag_Type'Range loop declare Name : constant String := Html_Tag_Type'Image (I); Wname : constant Wide_Wide_String := Html_Tag_Type'Wide_Wide_Image (I); Pos : constant Natural := Util.Strings.Index (Name, '_'); Tag : constant Html_Tag_Type := Find_Tag (WName (WName'First .. Pos - 1)); begin Log.Info ("Checking tag {0}", Name); Assert_Equals (T, I, Tag, "Find_Tag failed"); end; end loop; end Test_Find_Tag; end Wiki.Filters.Html.Tests; ```
61a4365f-64da-4547-9038-3fe56a58660d
{ "language": "Ada" }
```ada ``` Define the Wiki.Utils package with To_Html and To_Text functions
```ada ----------------------------------------------------------------------- -- wiki-utils -- Wiki utility operations -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Wiki.Parsers; package Wiki.Utils is -- Render the wiki text according to the wiki syntax in HTML into a string. function To_Html (Text : in Wide_Wide_String; Syntax : in Wiki.Parsers.Wiki_Syntax_Type) return String; -- Render the wiki text according to the wiki syntax in text into a string. -- Wiki formatting and decoration are removed. function To_Text (Text : in Wide_Wide_String; Syntax : in Wiki.Parsers.Wiki_Syntax_Type) return String; end Wiki.Utils; ```
0c94e1b4-d7db-4382-9ce7-a6b2c71af888
{ "language": "Ada" }
```ada ``` Declare the TLS package for thread local context support
```ada ----------------------------------------------------------------------- -- EL.Contexts.TLS -- EL context and Thread Local Support -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with EL.Contexts.Default; -- == EL TLS Context == -- The <tt>TLS_Context</tt> type defines an expression context that associates itself to -- a per-thread context information. By declaring a variable with this type, the expression -- context is associated with the current thread and it can be retrieved at any time by using the -- <tt>Current</tt> function. As soon as the variable is finalized, the current thread context -- is updated. -- -- The expression context may be declared as follows: -- -- Context : EL.Contexts.TLS.TLS_Context; -- -- And at any time, a function or procedure that needs to evaluate an expression can use it: -- -- Expr : EL.Expressions.Expression; -- ... -- Value : Util.Beans.Objects.Object := Expr.Get_Value (EL.Contexts.TLS.Current.all); -- package EL.Contexts.TLS is -- ------------------------------ -- TLS Context -- ------------------------------ -- Context information for expression evaluation. type TLS_Context is new EL.Contexts.Default.Default_Context with private; -- Get the current EL context associated with the current thread. function Current return EL.Contexts.ELContext_Access; private type TLS_Context is new EL.Contexts.Default.Default_Context with record Previous : EL.Contexts.ELContext_Access; end record; -- Initialize and setup a new per-thread EL context. overriding procedure Initialize (Obj : in out TLS_Context); -- Restore the previouse per-thread EL context. overriding procedure Finalize (Obj : in out TLS_Context); end EL.Contexts.TLS; ```
6c94a34f-a174-4e5e-9f2f-5071fc9251c7
{ "language": "Ada" }
```ada ``` Add example for XML serialization
```ada with Ada.Text_IO; with Util.Serialize.IO.XML; with Util.Streams.Texts; procedure Serialize_Xml is Output : aliased Util.Streams.Texts.Print_Stream; Stream : Util.Serialize.IO.XML.Output_Stream; begin Output.Initialize (Size => 10000); Stream.Initialize (Output => Output'Unchecked_Access); -- Stream.Start_Document; Stream.Start_Entity ("person"); Stream.Write_Entity ("name", "Harry Potter"); Stream.Write_Entity ("gender", "male"); Stream.Write_Entity ("age", 17); Stream.End_Entity ("person"); -- Stream.End_Document; Ada.Text_IO.Put_Line (Util.Streams.Texts.To_String (Output)); end Serialize_Xml; ```
4c1d310b-2c11-491e-9dd8-aeed26830d53
{ "language": "Ada" }
```ada ``` Define the set of string package
```ada ----------------------------------------------------------------------- -- Util-strings-sets -- Set of strings -- Copyright (C) 2011 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Hash; with Ada.Containers.Indefinite_Hashed_Sets; -- The <b>Util.Strings.Sets</b> package provides an instantiation -- of a hashed set with Strings. package Util.Strings.Sets is new Ada.Containers.Indefinite_Hashed_Sets (Element_Type => String, Hash => Ada.Strings.Hash, Equivalent_Elements => "="); ```
e7b0e0c2-d5b4-484a-91db-5b0d0c4a1583
{ "language": "Ada" }
```ada ``` Implement the unit tests on datasets to verify the creation, insertion and retrieval of datasets through bean interfaces
```ada ----------------------------------------------------------------------- -- util-beans-objects-datasets-tests -- Unit tests for dataset beans -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; with Util.Test_Caller; package body Util.Beans.Objects.Datasets.Tests is package Caller is new Util.Test_Caller (Test, "Objects.Datasets"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Beans.Objects.Datasets", Test_Fill_Dataset'Access); end Add_Tests; -- Test the creation, initialization and retrieval of dataset content. procedure Test_Fill_Dataset (T : in out Test) is Set : Dataset; procedure Fill (Row : in out Object_Array) is begin Row (Row'First) := To_Object (String '("john")); Row (Row'First + 1) := To_Object (String '("jj@gmail.com")); Row (Row'First + 2) := To_Object (Set.Get_Count); end Fill; begin Set.Add_Column ("name"); Set.Add_Column ("email"); Set.Add_Column ("age"); for I in 1 .. 100 loop Set.Append (Fill'Access); end loop; Util.Tests.Assert_Equals (T, 100, Set.Get_Count, "Invalid number of rows"); for I in 1 .. 100 loop Set.Set_Row_Index (I); declare R : Object := Set.Get_Row; begin T.Assert (not Is_Null (R), "Row is null"); Util.Tests.Assert_Equals (T, "john", To_String (Get_Value (R, "name")), "Invalid 'name' attribute"); Util.Tests.Assert_Equals (T, I, To_Integer (Get_Value (R, "age")), "Invalid 'age' attribute"); end; end loop; end Test_Fill_Dataset; end Util.Beans.Objects.Datasets.Tests; ```
ab6fc861-8fe3-47c1-9d39-f5cf926686f0
{ "language": "Ada" }
```ada ``` Add the ASIS file $i
```ada ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT INTERFACE COMPONENTS -- -- -- -- A S I S . E R R O R S -- -- -- -- S p e c -- -- -- -- $Revision: 14416 $ -- -- -- This specification is adapted from the Ada Semantic Interface -- -- Specification Standard (ISO/IEC 15291) for use with GNAT. In accordance -- -- with the copyright of that document, you can freely copy and modify this -- -- specification, provided that if you redistribute a modified version, any -- -- changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 4 package Asis.Errors ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ package Asis.Errors is ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- -- ASIS reports all operational errors by raising an exception. Whenever an -- ASIS implementation raises one of the exceptions declared in package -- Asis.Exceptions, it will previously have set the values returned by the -- Status and Diagnosis queries to indicate the cause of the error. The -- possible values for Status are indicated in the definition of Error_Kinds -- below, with suggestions for the associated contents of the Diagnosis -- string as a comment. -- -- The Diagnosis and Status queries are provided in the Asis.Implementation -- package to supply more information about the reasons for raising any -- exception. -- -- ASIS applications are encouraged to follow this same convention whenever -- they explicitly raise any ASIS exception--always record a Status and -- Diagnosis prior to raising the exception. ------------------------------------------------------------------------------ -- 4.1 type Error_Kinds ------------------------------------------------------------------------------ -- This enumeration type describes the various kinds of errors. -- type Error_Kinds is ( Not_An_Error, -- No error is presently recorded Value_Error, -- Routine argument value invalid Initialization_Error, -- ASIS is uninitialized Environment_Error, -- ASIS could not initialize Parameter_Error, -- Bad Parameter given to Initialize Capacity_Error, -- Implementation overloaded Name_Error, -- Context/unit not found Use_Error, -- Context/unit not use/open-able Data_Error, -- Context/unit bad/invalid/corrupt Text_Error, -- The program text cannot be located Storage_Error, -- Storage_Error suppressed Obsolete_Reference_Error, -- Argument or result is invalid due to -- and inconsistent compilation unit Unhandled_Exception_Error, -- Unexpected exception suppressed Not_Implemented_Error, -- Functionality not implemented Internal_Error); -- Implementation internal failure end Asis.Errors; ```
0d6ae404-8b23-450c-8798-6937ccae29a6
{ "language": "Ada" }
```ada ``` Declare the method binding types
```ada ----------------------------------------------------------------------- -- EL.Beans.Methods -- Bean methods -- Copyright (C) 2010 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Strings; package EL.Beans.Methods is pragma Preelaborate; type Method_Binding is tagged limited record Name : Util.Strings.Name_Access; end record; type Method_Binding_Access is access constant Method_Binding'Class; type Method_Binding_Array is array (Natural range <>) of Method_Binding_Access; type Method_Binding_Array_Access is access constant Method_Binding_Array; type Method_Bean is limited Interface; type Method_Bean_Access is access all Method_Bean'Class; function Get_Method_Bindings (From : in Method_Bean) return Method_Binding_Array_Access is abstract; end EL.Beans.Methods; ```
f1c50206-30e8-429d-a8b0-385581d845e9
{ "language": "Ada" }
```ada ``` Define the set of string package
```ada ----------------------------------------------------------------------- -- Util-strings-sets -- Set of strings -- Copyright (C) 2011 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Hash; with Ada.Containers.Indefinite_Hashed_Sets; -- The <b>Util.Strings.Sets</b> package provides an instantiation -- of a hashed set with Strings. package Util.Strings.Sets is new Ada.Containers.Indefinite_Hashed_Sets (Element_Type => String, Hash => Ada.Strings.Hash, Equivalent_Elements => "="); ```
9138c18d-86c0-4b39-80ee-6674ca238771
{ "language": "Ada" }
```ada ``` Define the ASF.Routes.Servlets.Rest package for the REST route
```ada ----------------------------------------------------------------------- -- asf-reoutes-servlets-rest -- Route for the REST API -- Copyright (C) 2016 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Rest; package ASF.Routes.Servlets.Rest is type Descriptor_Array is array (ASF.Rest.Method_Type) of ASF.Rest.Descriptor_Access; -- The route has one descriptor for each REST method. type API_Route_Type is new ASF.Routes.Servlets.Servlet_Route_Type with record Descriptors : Descriptor_Array; end record; end ASF.Routes.Servlets.Rest; ```
67f2dcd9-cf06-4961-80b2-eae193a539a8
{ "language": "Ada" }
```ada ``` Declare the Wiki.Plugins.Templates package with the Template_Plugin type
```ada ----------------------------------------------------------------------- -- wiki-plugins-template -- Template Plugin -- Copyright (C) 2016 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Wiki.Strings; -- === Template Plugins === -- The <b>Wiki.Plugins.Templates</b> package defines an abstract template plugin. -- To use the template plugin, the <tt>Get_Template</tt> procedure must be implemented. -- It is responsible for getting the template content according to the plugin parameters. -- package Wiki.Plugins.Templates is pragma Preelaborate; type Template_Plugin is abstract new Wiki_Plugin with null record; -- Get the template content for the plugin evaluation. procedure Get_Template (Plugin : in out Template_Plugin; Params : in out Wiki.Attributes.Attribute_List; Template : out Wiki.Strings.UString) is abstract; -- Expand the template configured with the parameters for the document. -- The <tt>Get_Template</tt> operation is called and the template content returned -- by that operation is parsed in the current document. Template parameters are passed -- in the <tt>Context</tt> instance and they can be evaluated within the template -- while parsing the template content. overriding procedure Expand (Plugin : in out Template_Plugin; Document : in out Wiki.Documents.Document; Params : in out Wiki.Attributes.Attribute_List; Context : in Plugin_Context); end Wiki.Plugins.Templates; ```
110ae14f-6944-48b7-baa3-8548bee35242
{ "language": "Ada" }
```ada ``` Test that a VIEW_CONVERT_EXPR used as an lvalue has the right type.
```ada -- RUN: %llvmgcc -c %s -o /dev/null procedure VCE_LV is type P is access String ; type T is new P (5 .. 7); subtype U is String (5 .. 7); X : T := new U'(others => 'A'); begin null; end; ```
704d4af9-8b66-4264-9720-29ddf797f98a
{ "language": "Ada" }
```ada ``` Add operations to specify the mapping
```ada ----------------------------------------------------------------------- -- util-serialize-mappers -- Serialize objects in various formats -- Copyright (C) 2010 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Util.Serialize.Mappers is -- ----------------------- -- Bind the name and the handler in the current mapper. -- ----------------------- procedure Add_Member (Controller : in out Mapper; Name : in String; Handler : in Mapper_Access) is begin Controller.Mapping.Insert (Key => Name, New_Item => Handler); end Add_Member; -- ----------------------- -- Add the member to the current mapper. -- ----------------------- procedure Add_Member (Controller : in out Mapper; Name : in String) is begin Controller.Mapping.Insert (Key => Name, New_Item => null); end Add_Member; -- ----------------------- -- Find the mapper associated with the given name. -- Returns null if there is no mapper. -- ----------------------- function Find_Mapper (Controller : in Mapper; Name : in String) return Mapper_Access is Pos : constant Mapper_Map.Cursor := Controller.Mapping.Find (Key => Name); begin if Mapper_Map.Has_Element (Pos) then return Mapper_Map.Element (Pos); else return null; end if; end Find_Mapper; end Util.Serialize.Mappers; ```
ec538ed8-db8e-4f29-a79b-4d2fc73f91a6
{ "language": "Ada" }
```ada ``` Refactor Buffered_Stream and Print_Stream - move the WTR package instantiation in a separate file
```ada ----------------------------------------------------------------------- -- util-streams-texts-tr -- Text translation utilities on streams -- Copyright (C) 2010, 2011, 2012, 2015, 2016, 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Texts.Transforms; with Ada.Wide_Wide_Characters.Handling; package Util.Streams.Texts.WTR is new Util.Texts.Transforms (Stream => Print_Stream'Class, Char => Wide_Wide_Character, Input => Wide_Wide_String, Put => Write_Char, To_Upper => Ada.Wide_Wide_Characters.Handling.To_Upper, To_Lower => Ada.Wide_Wide_Characters.Handling.To_Lower); ```
fc28f3be-b46b-466c-b272-c2eaef4edbc5
{ "language": "Ada" }
```ada ``` Define a simple HTML parser that can be used to parse HTML text embedded in wiki text
```ada ----------------------------------------------------------------------- -- wiki-parsers-html -- Wiki HTML parser -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- -- This is a small HTML parser that is called to deal with embedded HTML in wiki text. -- The parser is intended to handle incorrect HTML and clean the result as much as possible. -- We cannot use a real XML/Sax parser (such as XML/Ada) because we must handle errors and -- backtrack from HTML parsing to wiki or raw text parsing. -- -- When parsing HTML content, we call the <tt>Start_Element</tt> or <tt>End_Element</tt> -- operations. The renderer is then able to handle the HTML tag according to its needs. private package Wiki.Parsers.Html is pragma Preelaborate; -- Parse a HTML element <XXX attributes> -- or parse an end of HTML element </XXX> procedure Parse_Element (P : in out Parser); end Wiki.Parsers.Html; ```
6a5fb915-d49f-4455-b09f-f7b65afff9e5
{ "language": "Ada" }
```ada ``` Define the OAuth security filter for AWA applications
```ada ----------------------------------------------------------------------- -- awa-oauth-filters -- OAuth filter -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with ASF.Requests; with ASF.Responses; with ASF.Sessions; with ASF.Principals; with ASF.Filters; with ASF.Servlets; with ASF.Security.Filters; with AWA.Users.Principals; with AWA.OAuth.Services; package AWA.OAuth.Filters is -- ------------------------------ -- OAuth Authentication filter -- ------------------------------ -- The <b>Auth_Filter</b> verifies that the access token passed for the OAuth -- operation is valid and it extracts the user to configure the request principal. type Auth_Filter is new ASF.Filters.Filter with private; -- Initialize the filter. overriding procedure Initialize (Filter : in out Auth_Filter; Config : in ASF.Servlets.Filter_Config); -- The Do_Filter method of the Filter is called by the container each time -- a request/response pair is passed through the chain due to a client request -- for a resource at the end of the chain. The Filter_Chain passed in to this -- method allows the Filter to pass on the request and response to the next -- entity in the chain. -- -- Before passing the control to the next filter, initialize the service -- context to give access to the current application, current user and -- manage possible transaction rollbacks. overriding procedure Do_Filter (F : in Auth_Filter; Request : in out ASF.Requests.Request'Class; Response : in out ASF.Responses.Response'Class; Chain : in out ASF.Servlets.Filter_Chain); private use Ada.Strings.Unbounded; type Auth_Filter is new ASF.Filters.Filter with record Realm : AWA.OAuth.Services.Auth_Manager_Access; end record; end AWA.OAuth.Filters; ```
c2813257-86c3-4cf6-aefb-868c147612cb
{ "language": "Ada" }
```ada ``` Add tests for the Util.Commands.Drivers package
```ada ----------------------------------------------------------------------- -- util-commands-tests - Test for commands -- Copyright (C) 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package Util.Commands.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Tests when the execution of commands. procedure Test_Execute (T : in out Test); -- Test execution of help. procedure Test_Help (T : in out Test); -- Test usage operation. procedure Test_Usage (T : in out Test); end Util.Commands.Tests; ```
415a8783-3373-42c2-af61-8931cc6442ef
{ "language": "Ada" }
```ada ``` Define the ping command to ask the Bbox to ping the known devices
```ada ----------------------------------------------------------------------- -- druss-commands-ping -- Ping devices from the gateway -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package Druss.Commands.Ping is type Command_Type is new Druss.Commands.Drivers.Command_Type with null record; procedure Do_Ping (Command : in Command_Type; Args : in Argument_List'Class; Context : in out Context_Type); -- Execute a ping from the gateway to each device. overriding procedure Execute (Command : in Command_Type; Name : in String; Args : in Argument_List'Class; Context : in out Context_Type); -- Write the help associated with the command. overriding procedure Help (Command : in Command_Type; Context : in out Context_Type); end Druss.Commands.Ping; ```
bb76f25b-c29b-44a9-8dd8-20ee326f693a
{ "language": "Ada" }
```ada ``` Implement the Get_Count and Get_Argument operations
```ada ----------------------------------------------------------------------- -- util-commands -- Support to make command line tools -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Command_Line; package body Util.Commands is -- ------------------------------ -- Get the number of arguments available. -- ------------------------------ overriding function Get_Count (List : in Default_Argument_List) return Natural is begin return Ada.Command_Line.Argument_Count - List.Offset; end Get_Count; -- ------------------------------ -- Get the argument at the given position. -- ------------------------------ overriding function Get_Argument (List : in Default_Argument_List; Pos : in Positive) return String is begin return Ada.Command_Line.Argument (Pos - List.Offset); end Get_Argument; end Util.Commands; ```
4edc3879-c932-4aec-b332-01f489603808
{ "language": "Ada" }
```ada ``` Implement the package to read the begin/end events and create the process instance
```ada ----------------------------------------------------------------------- -- mat-targets-readers - Definition and Analysis of process start events -- Copyright (C) 2014 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Log.Loggers; package body MAT.Targets.Readers is -- The logger Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("MAT.Targets.Readers"); MSG_BEGIN : constant MAT.Events.Internal_Reference := 0; MSG_END : constant MAT.Events.Internal_Reference := 1; M_PID : constant MAT.Events.Internal_Reference := 1; M_EXE : constant MAT.Events.Internal_Reference := 2; PID_NAME : aliased constant String := "pid"; EXE_NAME : aliased constant String := "exe"; Process_Attributes : aliased constant MAT.Events.Attribute_Table := (1 => (Name => PID_NAME'Access, Size => 0, Kind => MAT.Events.T_SIZE_T, Ref => M_PID), 2 => (Name => EXE_NAME'Access, Size => 0, Kind => MAT.Events.T_FRAME, Ref => M_EXE)); procedure Create_Process (For_Servant : in out Process_Servant; Pid : in MAT.Types.Target_Process_Ref) is begin MAT.Memory.Targets.Initialize (Memory => For_Servant.Process.Memory, Reader => For_Servant.Reader.all); end Create_Process; overriding procedure Dispatch (For_Servant : in out Process_Servant; Id : in MAT.Events.Internal_Reference; Params : in MAT.Events.Const_Attribute_Table_Access; Frame : in MAT.Events.Frame_Info; Msg : in out MAT.Readers.Message) is begin case Id is when MSG_BEGIN => null; when MSG_END => null; when others => null; end case; end Dispatch; -- Register the reader to extract and analyze process events. procedure Register (Into : in out MAT.Readers.Manager_Base'Class; Reader : in Process_Reader_Access) is begin Into.Register_Reader (Reader.all'Access, "begin", MSG_BEGIN, Process_Attributes'Access); Into.Register_Reader (Reader.all'Access, "end", MSG_END, Process_Attributes'Access); end Register; end MAT.Targets.Readers; ```
a06e67c2-04c2-4448-a1d1-82b4e7ad968b
{ "language": "Ada" }
```ada ``` Add very simple examples for Objects
```ada with Ada.Text_IO; with Ada.Command_Line; with Util.Beans.Objects; procedure ObjCalc is package UBO renames Util.Beans.Objects; use type UBO.Object; Value : UBO.Object := UBO.To_Object (Integer (0)); begin Value := Value + UBO.To_Object (Integer (123)); Value := Value - UBO.To_Object (String '("12")); -- Should print '111' Ada.Text_IO.Put_Line (UBO.To_String (Value)); end ObjCalc; ```
e8d5bec0-e550-4011-b174-9011cf6addad
{ "language": "Ada" }
```ada ``` Implement a simple unit test for MAT.Targets package
```ada ----------------------------------------------------------------------- -- mat-readers-tests -- Unit tests for MAT readers -- Copyright (C) 2014 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Directories; with Util.Test_Caller; with MAT.Readers.Files; package body MAT.Targets.Tests is use Util.Tests; package Caller is new Util.Test_Caller (Test, "Files"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test MAT.Targets.Read_File", Test_Read_File'Access); end Add_Tests; -- ------------------------------ -- Test reading a file into a string -- Reads this ada source file and checks we have read it correctly -- ------------------------------ procedure Test_Read_File (T : in out Test) is Path : constant String := Util.Tests.Get_Test_Path ("regtests/files/file-v1.dat"); Target : MAT.Targets.Target_Type; Reader : MAT.Readers.Files.File_Reader_Type; begin Target.Initialize (Reader); Reader.Open (Path); Reader.Read_All; end Test_Read_File; end MAT.Targets.Tests; ```
bdecf96f-bbc4-4afc-931c-d32dd326f50c
{ "language": "Ada" }
```ada ``` Add new unit tests for the timer management package
```ada ----------------------------------------------------------------------- -- util-events-timers-tests -- Unit tests for timers -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package Util.Events.Timers.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test and Util.Events.Timers.Timer with record Count : Natural := 0; end record; overriding procedure Time_Handler (Sub : in out Test; Event : in out Timer_Ref'Class); procedure Test_Timer_Event (T : in out Test); end Util.Events.Timers.Tests; ```
b803bc2b-c0b5-4c40-bbbe-575a948f9c39
{ "language": "Ada" }
```ada ``` Add the ASIS file $i
```ada ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . A _ S T A N D -- -- -- -- S p e c -- -- -- -- $Revision: 15117 $ -- -- -- Copyright (c) 2002, 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, 59 Temple Place -- -- - Suite 330, Boston, MA 02111-1307, 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 Ada Core Technologies Inc -- -- (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- We need this renaming because the GNAT Stand package and the ASIS A4G.Stand -- package conflict if mentioned in the same context clause. This renaming -- seems to be the cheapest way to correct the old bad choice of the name -- of the ASIS package (A4G.Stand) with A4G.Stand; package A4G.A_Stand renames A4G.Stand; ```
eb3fe6a2-7f58-42f1-9316-69205f5927aa
{ "language": "Ada" }
```ada ``` Implement the Initialize procedure with SSL support (AWS version starting from gnat-2015)
```ada ----------------------------------------------------------------------- -- awa-mail-clients-aws_smtp-initialize -- Initialize SMTP client with SSL support -- Copyright (C) 2016 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- separate (AWA.Mail.Clients.AWS_SMTP) procedure Initialize (Client : in out AWS_Mail_Manager'Class; Props : in Util.Properties.Manager'Class) is Server : constant String := Props.Get (Name => "smtp.host", Default => "localhost"); User : constant String := Props.Get (Name => "smtp.user", Default => ""); Passwd : constant String := Props.Get (Name => "smtp.password", Default => ""); Secure : constant String := Props.Get (Name => "smtp.ssl", Default => "0"); begin Client.Secure := Secure = "1" or Secure = "yes" or Secure = "true"; if User'Length > 0 then Client.Creds := AWS.SMTP.Authentication.Plain.Initialize (User, Passwd); Client.Server := AWS.SMTP.Client.Initialize (Server_Name => Server, Port => Client.Port, Secure => Client.Secure, Credential => Client.Creds'Access); else Client.Server := AWS.SMTP.Client.Initialize (Server_Name => Server, Port => Client.Port, Secure => Client.Secure); end if; end Initialize; ```
a81c14fa-c3bc-496a-970b-0a2237366aa0
{ "language": "Ada" }
```ada ``` Add the package to build the generated Ada packages (UML packages test)
```ada ----------------------------------------------------------------------- -- Test -- Test the code generation -- Copyright (C) 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package Gen.Tests.Packages is end Gen.Tests.Packages; ```
8df72e2d-8e0d-4a43-84a8-bd289f531783
{ "language": "Ada" }
```ada ``` Define the Facebook authentication by using OAuth and Facebook Graph API
```ada ----------------------------------------------------------------------- -- security-auth-oauth-facebook -- Facebook OAuth based authentication -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Security.OAuth.Clients; package Security.Auth.OAuth.Facebook is -- ------------------------------ -- OAuth Manager -- ------------------------------ -- The <b>Manager</b> provides the core operations for the OAuth authorization process. type Manager is new Security.Auth.OAuth.Manager with private; -- Verify the OAuth access token and retrieve information about the user. overriding procedure Verify_Access_Token (Realm : in Manager; Assoc : in Association; Request : in Parameters'Class; Token : in Security.OAuth.Clients.Access_Token_Access; Result : in out Authentication); private type Manager is new Security.Auth.OAuth.Manager with null record; end Security.Auth.OAuth.Facebook; ```
fa1610ea-31b8-4e8f-9c43-09ea634ee018
{ "language": "Ada" }
```ada ``` Add test for YAML model support
```ada ----------------------------------------------------------------------- -- gen-artifacts-yaml-tests -- Tests for YAML model files -- Copyright (C) 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Util.Test_Caller; with Gen.Configs; with Gen.Generator; package body Gen.Artifacts.Yaml.Tests is use Ada.Strings.Unbounded; package Caller is new Util.Test_Caller (Test, "Gen.Yaml"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Gen.Yaml.Read_Model", Test_Read_Yaml'Access); end Add_Tests; -- ------------------------------ -- Test reading the YAML files defines in regression tests. -- ------------------------------ procedure Test_Read_Yaml (T : in out Test) is A : Artifact; G : Gen.Generator.Handler; C : constant String := Util.Tests.Get_Parameter ("config_dir", "config"); Path : constant String := Util.Tests.Get_Path ("regtests/files/users.yaml"); Model : Gen.Model.Packages.Model_Definition; Iter : Gen.Model.Packages.Package_Cursor; Cnt : Natural := 0; begin Gen.Generator.Initialize (G, Ada.Strings.Unbounded.To_Unbounded_String (C), False); A.Read_Model (Path, Model, G); Iter := Model.First; while Gen.Model.Packages.Has_Element (Iter) loop Cnt := Cnt + 1; Gen.Model.Packages.Next (Iter); end loop; Util.Tests.Assert_Equals (T, 1, Cnt, "Missing some packages"); end Test_Read_Yaml; end Gen.Artifacts.Yaml.Tests; ```
e82754ce-2d69-4434-85b1-612009d1058f
{ "language": "Ada" }
```ada ``` Add simple example for text transformations
```ada ----------------------------------------------------------------------- -- escape -- Text Transformations -- Copyright (C) 2001, 2002, 2003, 2006, 2008, 2009, 2010 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Strings.Transforms; with Ada.Strings.Unbounded; with Ada.Text_IO; with Ada.Command_Line; procedure Escape is use Ada.Strings.Unbounded; Count : constant Natural := Ada.Command_Line.Argument_Count; begin if Count = 0 then Ada.Text_IO.Put_Line ("Usage: escape string..."); return; end if; for I in 1 .. Count loop declare S : constant String := Ada.Command_Line.Argument (I); begin Ada.Text_IO.Put_Line ("Escape javascript : " & Util.Strings.Transforms.Escape_Javascript (S)); Ada.Text_IO.Put_Line ("Escape XML : " & Util.Strings.Transforms.Escape_Xml (S)); end; end loop; end Escape; ```
72beaf46-7845-4cbd-8678-2beae19e1703
{ "language": "Ada" }
```ada ``` Implement a new test to verify the Base64 encoding stream
```ada ----------------------------------------------------------------------- -- util-streams-buffered-encoders-tests -- Unit tests for encoding buffered streams -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with Util.Streams.Files; with Util.Streams.Texts; with Util.Files; with Ada.Streams.Stream_IO; package body Util.Streams.Buffered.Encoders.Tests is use Util.Tests; use Util.Streams.Files; use Ada.Streams.Stream_IO; package Caller is new Util.Test_Caller (Test, "Streams.Buffered.Encoders"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Streams.Buffered.Encoders.Write, Read", Test_Base64_Stream'Access); end Add_Tests; procedure Test_Base64_Stream (T : in out Test) is Stream : aliased File_Stream; Buffer : aliased Util.Streams.Buffered.Encoders.Encoding_Stream; Print : Util.Streams.Texts.Print_Stream; Path : constant String := Util.Tests.Get_Test_Path ("regtests/result/test-stream.b64"); Expect : constant String := Util.Tests.Get_Path ("regtests/expect/test-stream.b64"); begin Print.Initialize (Output => Buffer'Unchecked_Access, Size => 5); Buffer.Initialize (Output => Stream'Unchecked_Access, Size => 1024, Format => Util.Encoders.BASE_64); Stream.Create (Mode => Out_File, Name => Path); for I in 1 .. 32 loop Print.Write ("abcd"); Print.Write (" fghij"); Print.Write (ASCII.LF); end loop; Print.Flush; Stream.Close; Util.Tests.Assert_Equal_Files (T => T, Expect => Expect, Test => Path, Message => "Base64 stream"); end Test_Base64_Stream; end Util.Streams.Buffered.Encoders.Tests; ```
d1994d7d-dacd-420e-886b-ed820cc76191
{ "language": "Ada" }
```ada ``` Implement the operations for the SHA256 package
```ada ----------------------------------------------------------------------- -- util-encoders-sha256 -- Compute SHA-1 hash -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Encoders.Base64; package body Util.Encoders.SHA256 is -- ------------------------------ -- Computes the SHA256 hash and returns the raw binary hash in <b>Hash</b>. -- ------------------------------ procedure Finish (E : in out Context; Hash : out Hash_Array) is begin Hash := GNAT.SHA256.Digest (E); E := GNAT.SHA256.Initial_Context; end Finish; -- ------------------------------ -- Computes the SHA256 hash and returns the hexadecimal hash in <b>Hash</b>. -- ------------------------------ procedure Finish (E : in out Context; Hash : out Digest) is begin Hash := GNAT.SHA256.Digest (E); E := GNAT.SHA256.Initial_Context; end Finish; -- ------------------------------ -- Computes the SHA256 hash and returns the base64 hash in <b>Hash</b>. -- ------------------------------ procedure Finish_Base64 (E : in out Context; Hash : out Base64_Digest) is Buf : Ada.Streams.Stream_Element_Array (1 .. Hash'Length); for Buf'Address use Hash'Address; pragma Import (Ada, Buf); H : Hash_Array; B : Util.Encoders.Base64.Encoder; Last : Ada.Streams.Stream_Element_Offset; Encoded : Ada.Streams.Stream_Element_Offset; begin Finish (E, H); E := GNAT.SHA256.Initial_Context; B.Transform (Data => H, Into => Buf, Last => Last, Encoded => Encoded); end Finish_Base64; end Util.Encoders.SHA256; ```
899913b1-acbb-4905-85a2-44290b8a83dc
{ "language": "Ada" }
```ada ``` Add missing ads file for package Orka.SIMD.AVX.Longs.Convert
```ada -- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2021 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. with Orka.SIMD.AVX.Doubles; package Orka.SIMD.AVX.Longs.Convert is pragma Pure; use SIMD.AVX.Doubles; function Convert (Elements : m256d) return m256l with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_cvtpd2dq256"; function Convert (Elements : m256l) return m256d with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_cvtdq2pd256"; end Orka.SIMD.AVX.Longs.Convert; ```
17e51e8e-7535-462e-a313-9e05c79aadad
{ "language": "Ada" }
```ada ``` Define the Cache_Control package with Cache_Control_Filter type to add a Cache-Control, Vary headers in the HTTP response
```ada ----------------------------------------------------------------------- -- asf-filters-cache_control -- HTTP response Cache-Control settings -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with ASF.Requests; with ASF.Responses; with ASF.Servlets; -- The <b>ASF.Filters.Cache_Control</b> package implements a servlet filter to add -- cache control headers in a response. -- package ASF.Filters.Cache_Control is -- Filter configuration parameter, when not empty, add a Vary header in the response. VARY_HEADER_PARAM : constant String := "header.vary"; -- Filter configuration parameter, defines the expiration date in seconds relative -- to the current date. When 0, disable browser caching. CACHE_CONTROL_PARAM : constant String := "header.cache-control"; type Cache_Control_Filter is new ASF.Filters.Filter with record Vary : Ada.Strings.Unbounded.Unbounded_String; Cache_Control_Header : Ada.Strings.Unbounded.Unbounded_String; end record; -- The Do_Filter method of the Filter is called by the container each time -- a request/response pair is passed through the chain due to a client request -- for a resource at the end of the chain. The <b>Cache_Control</b> filter adds -- a <tt>Cache-Control</tt>, <tt>Expires</tt>, <tt>Pragma</tt> and optionally a -- <tt>Vary</tt> header in the HTTP response. overriding procedure Do_Filter (F : in Cache_Control_Filter; Request : in out Requests.Request'Class; Response : in out Responses.Response'Class; Chain : in out ASF.Servlets.Filter_Chain); -- Called by the servlet container to indicate to a filter that the filter -- instance is being placed into service. procedure Initialize (Server : in out Cache_Control_Filter; Config : in ASF.Servlets.Filter_Config); end ASF.Filters.Cache_Control; ```
ba1871b7-4b4e-485b-bb15-7541447c9b4a
{ "language": "Ada" }
```ada ``` Implement the Get_Value procedure for the Counter_Bean
```ada ----------------------------------------------------------------------- -- awa-counters-beans -- Counter bean definition -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body AWA.Counters.Beans is -- ------------------------------ -- Get the value identified by the name. -- ------------------------------ overriding function Get_Value (From : in Counter_Bean; Name : in String) return Util.Beans.Objects.Object is begin return Util.Beans.Objects.To_Object (From.Value); end Get_Value; end AWA.Counters.Beans; ```
adcdd8a4-9e51-49c3-9888-0092f0090508
{ "language": "Ada" }
```ada ``` Implement the Initialize procedure for AWS version before gnat-2015 (aws 3.1)
```ada ----------------------------------------------------------------------- -- awa-mail-clients-aws_smtp-initialize -- Initialize SMTP client without SSL support -- Copyright (C) 2016 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- separate (AWA.Mail.Clients.AWS_SMTP) procedure Initialize (Client : in out AWS_Mail_Manager'Class; Props : in Util.Properties.Manager'Class) is Server : constant String := Props.Get (Name => "smtp.host", Default => "localhost"); User : constant String := Props.Get (Name => "smtp.user", Default => ""); Passwd : constant String := Props.Get (Name => "smtp.password", Default => ""); begin if User'Length > 0 then Client.Creds := AWS.SMTP.Authentication.Plain.Initialize (User, Passwd); Client.Server := AWS.SMTP.Client.Initialize (Server_Name => Server, Port => Client.Port, Credential => Client.Creds'Access); else Client.Server := AWS.SMTP.Client.Initialize (Server_Name => Server, Port => Client.Port); end if; end Initialize; ```
28eb8eab-8b72-48e5-85f0-16fc14f88fe6
{ "language": "Ada" }
```ada ``` Add the ASIS file $i
```ada ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . A _ S E M -- -- -- -- 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, 59 Temple Place -- -- - Suite 330, Boston, MA 02111-1307, 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 Ada Core Technologies Inc -- -- (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- This package is the root of the ASIS-for-GNAT implementation hierarchy. -- All the implementation components, except Asis.Set_Get and -- Asis.Text.Set_Get (which need access to the private parts of the -- corresponding ASIS interface packages), are children or grandchildren of -- A4G. (A4G stands for Asis For GNAT). -- -- The primary aim of this package is to constrain the pollution of the user -- namespace when using the ASIS library to create ASIS applications, by -- children of A4G. package A4G is pragma Pure (A4G); end A4G; ```
dd3380b3-bd09-45dc-93d7-afc32bcaac5a
{ "language": "Ada" }
```ada ``` Define the Facebook authentication by using OAuth and Facebook Graph API
```ada ----------------------------------------------------------------------- -- security-auth-oauth-facebook -- Facebook OAuth based authentication -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Security.OAuth.Clients; package Security.Auth.OAuth.Facebook is -- ------------------------------ -- OAuth Manager -- ------------------------------ -- The <b>Manager</b> provides the core operations for the OAuth authorization process. type Manager is new Security.Auth.OAuth.Manager with private; -- Verify the OAuth access token and retrieve information about the user. overriding procedure Verify_Access_Token (Realm : in Manager; Assoc : in Association; Request : in Parameters'Class; Token : in Security.OAuth.Clients.Access_Token_Access; Result : in out Authentication); private type Manager is new Security.Auth.OAuth.Manager with null record; end Security.Auth.OAuth.Facebook; ```
247eb77c-9f7e-44da-8621-cf7405abbade
{ "language": "Ada" }
```ada ``` Implement the new unit tests for the timer management
```ada ----------------------------------------------------------------------- -- util-events-timers-tests -- Unit tests for timers -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; with Util.Test_Caller; package body Util.Events.Timers.Tests is use Util.Tests; use type Ada.Real_Time.Time; package Caller is new Util.Test_Caller (Test, "Events.Timers"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Events.Channels.Post_Event", Test_Timer_Event'Access); end Add_Tests; overriding procedure Time_Handler (Sub : in out Test; Event : in out Timer_Ref'Class) is begin Sub.Count := Sub.Count + 1; end Time_Handler; procedure Test_Timer_Event (T : in out Test) is M : Timer_List; R : Timer_Ref; Start : Ada.Real_Time.Time := Ada.Real_Time.Clock; Deadline : Ada.Real_Time.Time; Now : Ada.Real_Time.Time; begin T.Assert (not R.Is_Scheduled, "Empty timer should not be scheduled"); for Retry in 1 .. 10 loop M.Set_Timer (T'Unchecked_Access, R, Start + Ada.Real_Time.Milliseconds (10)); M.Process (Deadline); Now := Ada.Real_Time.Clock; exit when Now < Deadline; end loop; T.Assert (Now < Deadline, "The timer deadline is not correct"); delay until Deadline; M.Process (Deadline); Assert_Equals (T, 1, T.Count, "The timer handler was not called"); end Test_Timer_Event; end Util.Events.Timers.Tests; ```
8a178ac6-ee7f-45f0-91ca-450effcec01c
{ "language": "Ada" }
```ada ``` Declare the Conditions package with the Condition_Plugin type for the support of conditional inclusion in wiki text
```ada ----------------------------------------------------------------------- -- wiki-plugins-conditions -- Condition Plugin -- Copyright (C) 2016 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Wiki.Strings; -- === Conditions Plugins === -- The <b>Wiki.Plugins.Conditions</b> package defines a set of conditional plugins -- to show or hide wiki content according to some conditions evaluated during the parsing phase. -- package Wiki.Plugins.Conditions is MAX_CONDITION_DEPTH : constant Natural := 31; type Condition_Depth is new Natural range 0 .. MAX_CONDITION_DEPTH; type Condition_Type is (CONDITION_IF, CONDITION_ELSIF, CONDITION_ELSE, CONDITION_END); type Condition_Plugin is new Wiki_Plugin with private; -- Evaluate the condition and return it as a boolean status. function Evaluate (Plugin : in Condition_Plugin; Params : in Wiki.Attributes.Attribute_List) return Boolean; -- Get the type of condition (IF, ELSE, ELSIF, END) represented by the plugin. function Get_Condition_Kind (Plugin : in Condition_Plugin; Params : in Wiki.Attributes.Attribute_List) return Condition_Type; -- Evaluate the condition described by the parameters and hide or show the wiki -- content. overriding procedure Expand (Plugin : in out Condition_Plugin; Document : in out Wiki.Documents.Document; Params : in out Wiki.Attributes.Attribute_List; Context : in Plugin_Context); -- Append the attribute name/value to the condition plugin parameter list. procedure Append (Plugin : in out Condition_Plugin; Name : in Wiki.Strings.WString; Value : in Wiki.Strings.WString); private type Boolean_Array is array (Condition_Depth) of Boolean; pragma Pack (Boolean_Array); type Condition_Plugin is new Wiki_Plugin with record Depth : Condition_Depth := 1; Values : Boolean_Array := (others => False); Params : Wiki.Attributes.Attribute_List; end record; end Wiki.Plugins.Conditions; ```
98683671-3fa0-41c0-a07d-08fc6ca93498
{ "language": "Ada" }
```ada ``` Implement the Get_Permission and Register operations
```ada ----------------------------------------------------------------------- -- asf-rest -- REST Support -- Copyright (C) 2016 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body ASF.Rest is -- ------------------------------ -- Get the permission index associated with the REST operation. -- ------------------------------ function Get_Permission (Handler : in Descriptor) return Security.Permissions.Permission_Index is begin return Handler.Permission; end Get_Permission; -- ------------------------------ -- Register the API descriptor in a list. -- ------------------------------ procedure Register (List : in out Descriptor_Access; Item : in Descriptor_Access) is begin Item.Next := Item; List := Item; end Register; end ASF.Rest; ```
7127fa91-817c-485a-8f2a-db17da6e77e0
{ "language": "Ada" }
```ada ``` Define some new tests for the database drivers support
```ada ----------------------------------------------------------------------- -- ado-drivers-tests -- Unit tests for database drivers -- Copyright (C) 2014 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package ADO.Drivers.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Test the Get_Config operation. procedure Test_Get_Config (T : in out Test); -- Test the Get_Driver operation. procedure Test_Get_Driver (T : in out Test); -- Test loading some invalid database driver. procedure Test_Load_Invalid_Driver (T : in out Test); -- Test the Get_Driver_Index operation. procedure Test_Get_Driver_Index (T : in out Test); end ADO.Drivers.Tests; ```
c43db0af-0ee3-4153-9eb0-c9278e02dfaf
{ "language": "Ada" }
```ada ``` Add the new tests for Headers package
```ada ----------------------------------------------------------------------- -- util-http-headers-tests - Unit tests for Headers -- Copyright (C) 2022 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; package body Util.Http.Headers.Tests is use Util.Tests; package Caller is new Util.Test_Caller (Test, "Headers"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Http.Headers.Get_Accepted", Test_Get_Accepted'Access); end Add_Tests; -- ------------------------------ -- Test the Get_Accepted function. -- ------------------------------ procedure Test_Get_Accepted (T : in out Test) is use type Mimes.Mime_Access; M : Mimes.Mime_Access; begin M := Get_Accepted ("image/gif", Mimes.Images); T.Assert (M /= null, "Null mime returned"); T.Assert_Equals (M.all, Mimes.Gif, "Bad accept"); M := Get_Accepted ("image/*", Mimes.Images); T.Assert (M /= null, "Null mime returned"); T.Assert_Equals (M.all, Mimes.Jpg, "Bad accept"); M := Get_Accepted ("image/* q=0.2, image/svg+xml", Mimes.Images); T.Assert (M /= null, "Null mime returned"); T.Assert_Equals (M.all, Mimes.Svg, "Bad accept"); M := Get_Accepted ("image/* q=0.2, image/svg+xml", Mimes.Api); T.Assert (M = null, "Should not match"); end Test_Get_Accepted; end Util.Http.Headers.Tests; ```
4e9de579-e038-41f4-af46-277bd98507ea
{ "language": "Ada" }
```ada ``` Define the store interface to support several storage services (file, database, Amazon)
```ada ----------------------------------------------------------------------- -- awa-storages-stores -- The storage interface -- Copyright (C) 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ADO.Sessions; with AWA.Storages.Models; package AWA.Storages.Stores is -- ------------------------------ -- Store Service -- ------------------------------ type Store is limited interface; type Store_Access is access all Store'Class; procedure Save (Storage : in Store; Into : in out AWA.Storages.Models.Storage_Ref'Class; Path : in String) is abstract; procedure Load (Storage : in Store; From : in AWA.Storages.Models.Storage_Ref'Class; Into : in String) is abstract; end AWA.Storages.Stores; ```
f88e2e84-3789-4d65-acef-da65f8ce1d83
{ "language": "Ada" }
```ada ``` Add the ASIS file $i
```ada ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . A _ S E M -- -- -- -- 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, 59 Temple Place -- -- - Suite 330, Boston, MA 02111-1307, 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 Ada Core Technologies Inc -- -- (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- This package is the root of the ASIS-for-GNAT implementation hierarchy. -- All the implementation components, except Asis.Set_Get and -- Asis.Text.Set_Get (which need access to the private parts of the -- corresponding ASIS interface packages), are children or grandchildren of -- A4G. (A4G stands for Asis For GNAT). -- -- The primary aim of this package is to constrain the pollution of the user -- namespace when using the ASIS library to create ASIS applications, by -- children of A4G. package A4G is pragma Pure (A4G); end A4G; ```
5c056f9c-cbf6-41c4-924a-2e0907a5a5fb
{ "language": "Ada" }
```ada ``` Implement the cache manager operation
```ada ----------------------------------------------------------------------- -- ado-cache -- Simple cache management -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Unchecked_Deallocation; package body ADO.Caches is -- -------------------- -- Expand the name from the given group into a target parameter value to be used in -- the SQL query. The expander can look in a cache or in some configuration to find -- the value associated with the name and return it. The Expander can return a -- T_NULL when a value is not found or it may also raise some exception. -- -------------------- overriding function Expand (Instance : in Cache_Manager; Group : in String; Name : in String) return ADO.Parameters.Parameter is use type Ada.Strings.Unbounded.Unbounded_String; C : Cache_Type_Access := Instance.First; begin while C /= null loop if C.Name = Group then return C.Expand (Name); end if; C := C.Next; end loop; raise No_Value; end Expand; -- -------------------- -- Insert a new cache in the manager. The cache is identified by the given name. -- -------------------- procedure Add_Cache (Manager : in out Cache_Manager; Name : in String; Cache : in Cache_Type_Access) is begin Cache.Next := Manager.First; Cache.Name := Ada.Strings.Unbounded.To_Unbounded_String (Name); Manager.First := Cache; end Add_Cache; -- -------------------- -- Finalize the cache manager releasing every cache group. -- -------------------- overriding procedure Finalize (Manager : in out Cache_Manager) is procedure Free is new Ada.Unchecked_Deallocation (Object => Cache_Type'Class, Name => Cache_Type_Access); Cache : Cache_Type_Access; begin loop Cache := Manager.First; exit when Cache = null; Manager.First := Cache.Next; Free (Cache); end loop; end Finalize; end ADO.Caches; ```
e7e245f2-f080-4cdd-bf23-e46de58b431f
{ "language": "Ada" }
```ada ``` Implement a test filter that counts the number of times it is traversed
```ada ----------------------------------------------------------------------- -- Filters Tests - Unit tests for ASF.Filters -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body ASF.Filters.Tests is -- ------------------------------ -- Increment the counter each time Do_Filter is called. -- ------------------------------ procedure Do_Filter (F : in Test_Filter; Request : in out Requests.Request'Class; Response : in out Responses.Response'Class; Chain : in out ASF.Servlets.Filter_Chain) is begin F.Count.all := F.Count.all + 1; ASF.Servlets.Do_Filter (Chain => Chain, Request => Request, Response => Response); end Do_Filter; -- ------------------------------ -- Initialize the test filter. -- ------------------------------ overriding procedure Initialize (Server : in out Test_Filter; Context : in ASF.Servlets.Servlet_Registry'Class) is pragma Unreferenced (Context); begin Server.Count := Server.Counter'Unchecked_Access; end Initialize; end ASF.Filters.Tests; ```
e713ee31-ecc1-4670-b8eb-d9943641b494
{ "language": "Ada" }
```ada ``` Define the OAuth based authorization
```ada ----------------------------------------------------------------------- -- security-auth-oauth -- OAuth based authentication -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Security.OAuth.Clients; private package Security.Auth.OAuth is -- ------------------------------ -- OAuth Manager -- ------------------------------ -- The <b>Manager</b> provides the core operations for the OAuth authorization process. type Manager is abstract new Security.Auth.Manager with private; -- Initialize the authentication realm. overriding procedure Initialize (Realm : in out Manager; Params : in Parameters'Class; Provider : in String := PROVIDER_OPENID); -- Discover the OpenID provider that must be used to authenticate the user. -- The <b>Name</b> can be an URL or an alias that identifies the provider. -- A cached OpenID provider can be returned. -- Read the XRDS document from the URI and initialize the OpenID provider end point. -- (See OpenID Section 7.3 Discovery) overriding procedure Discover (Realm : in out Manager; Name : in String; Result : out End_Point); -- Associate the application (relying party) with the OpenID provider. -- The association can be cached. -- (See OpenID Section 8 Establishing Associations) overriding procedure Associate (Realm : in out Manager; OP : in End_Point; Result : out Association); overriding function Get_Authentication_URL (Realm : in Manager; OP : in End_Point; Assoc : in Association) return String; -- Verify the authentication result overriding procedure Verify (Realm : in out Manager; Assoc : in Association; Request : in Parameters'Class; Result : out Authentication); -- Verify the OAuth access token and retrieve information about the user. procedure Verify_Access_Token (Realm : in Manager; Assoc : in Association; Request : in Parameters'Class; Token : in Security.OAuth.Clients.Access_Token_Access; Result : in out Authentication) is abstract; private type Manager is abstract new Security.Auth.Manager with record Return_To : Unbounded_String; Realm : Unbounded_String; Scope : Unbounded_String; App : Security.OAuth.Clients.Application; end record; end Security.Auth.OAuth; ```
d43f4e0b-fe5a-4550-a46a-049ecb902fc7
{ "language": "Ada" }
```ada ``` Define a method and binding for an Ada bean to receive an uploaded file
```ada ----------------------------------------------------------------------- -- asf-parts -- ASF Parts -- Copyright (C) 2011, 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with EL.Methods.Proc_In; package ASF.Parts.Upload_Method is new EL.Methods.Proc_In (Param1_Type => ASF.Parts.Part'Class); ```
aebbc8f9-7423-41b4-8aa1-3fe6cabf1d85
{ "language": "Ada" }
```ada ``` Declare the Wiki.Streams.Html.Builders package for the HTML output stream
```ada ----------------------------------------------------------------------- -- wiki-streams-html-builders -- Wiki writer to a string builder -- Copyright (C) 2011, 2012, 2013, 2015, 2016 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Wiki.Streams.Builders; -- == Writer interfaces == -- The <tt>Wiki.Writers</tt> package defines the interfaces used by the renderer to write -- their outputs. -- package Wiki.Streams.Html.Builders is type Html_Output_Builder_Stream is limited new Wiki.Streams.Builders.Output_Builder_Stream and Wiki.Streams.Html.Html_Output_Stream with private; type Html_Output_Builder_Stream_Access is access all Html_Output_Builder_Stream'Class; overriding procedure Write_Wide_Element (Stream : in out Html_Output_Builder_Stream; Name : in String; Content : in Wiki.Strings.WString); overriding procedure Write_Wide_Attribute (Stream : in out Html_Output_Builder_Stream; Name : in String; Content : in Unbounded_Wide_Wide_String); -- Write an XML attribute within an XML element. -- The attribute value is escaped according to the XML escape rules. overriding procedure Write_Wide_Attribute (Stream : in out Html_Output_Builder_Stream; Name : in String; Content : in Wiki.Strings.WString); overriding procedure Start_Element (Stream : in out Html_Output_Builder_Stream; Name : in String); overriding procedure End_Element (Stream : in out Html_Output_Builder_Stream; Name : in String); overriding procedure Write_Wide_Text (Stream : in out Html_Output_Builder_Stream; Content : in Wiki.Strings.WString); private type Html_Output_Builder_Stream is limited new Wiki.Streams.Builders.Output_Builder_Stream and Wiki.Streams.Html.Html_Output_Stream with record -- Whether an XML element must be closed (that is a '>' is necessary) Close_Start : Boolean := False; end record; end Wiki.Streams.Html.Builders; ```
ed5c3ab4-d7ff-491d-858a-3ebe9197bf59
{ "language": "Ada" }
```ada ``` Declare the method binding types
```ada ----------------------------------------------------------------------- -- EL.Beans.Methods -- Bean methods -- Copyright (C) 2010 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Strings; package EL.Beans.Methods is pragma Preelaborate; type Method_Binding is tagged limited record Name : Util.Strings.Name_Access; end record; type Method_Binding_Access is access constant Method_Binding'Class; type Method_Binding_Array is array (Natural range <>) of Method_Binding_Access; type Method_Binding_Array_Access is access constant Method_Binding_Array; type Method_Bean is limited Interface; type Method_Bean_Access is access all Method_Bean'Class; function Get_Method_Bindings (From : in Method_Bean) return Method_Binding_Array_Access is abstract; end EL.Beans.Methods; ```
80611cd4-546e-4aa1-8cba-55ef07fa861f
{ "language": "Ada" }
```ada ``` Implement To_Identifier and To_Object operations
```ada ----------------------------------------------------------------------- -- ado-utils -- Utility operations for ADO -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body ADO.Utils is -- ------------------------------ -- Build a bean object from the identifier. -- ------------------------------ function To_Object (Id : in ADO.Identifier) return Util.Beans.Objects.Object is begin if Id = ADO.NO_IDENTIFIER then return Util.Beans.Objects.Null_Object; else return Util.Beans.Objects.To_Object (Long_Long_Integer (Id)); end if; end To_Object; -- ------------------------------ -- Build the identifier from the bean object. -- ------------------------------ function To_Identifier (Value : in Util.Beans.Objects.Object) return ADO.Identifier is begin if Util.Beans.Objects.Is_Null (Value) then return ADO.NO_IDENTIFIER; else return ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Value)); end if; end To_Identifier; end ADO.Utils; ```
4db24e60-5e35-45ae-a8a6-f3b5544ca721
{ "language": "Ada" }
```ada ``` Implement the UIChosen support to generate the jQuery chosen activation script
```ada ----------------------------------------------------------------------- -- components-widgets-selects -- Select component with jQuery Chosen -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ASF.Contexts.Writer; with ASF.Components.Base; package body ASF.Components.Widgets.Selects is -- ------------------------------ -- Render the chosen configuration script. -- ------------------------------ overriding procedure Encode_End (UI : in UIChosen; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is use type ASF.Components.Base.UIComponent_Access; procedure Process (Content : in String); Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer; Facets : ASF.Components.Base.UIComponent_Access; procedure Process (Content : in String) is begin Writer.Queue_Script (Content); end Process; begin if not UI.Is_Rendered (Context) then return; end if; Writer.Queue_Script ("$('#"); Writer.Queue_Script (UI.Get_Client_Id); Writer.Queue_Script ("').chosen({"); -- If there is an options facet, render it now. Facets := UI.Get_Facet (OPTIONS_FACET_NAME); if Facets /= null then Facets.Wrap_Encode_Children (Context, Process'Access); end if; Writer.Queue_Script ("})"); Facets := UI.Get_Facet (EVENTS_FACET_NAME); if Facets /= null then Facets.Wrap_Encode_Children (Context, Process'Access); end if; Writer.Queue_Script (";"); end Encode_End; end ASF.Components.Widgets.Selects; ```
08752f6c-eb35-46bc-bd2a-9cb9f3baf540
{ "language": "Ada" }
```ada ``` Declare the AWA.OAuth.Services package with the Auth_Manager
```ada ----------------------------------------------------------------------- -- awa-oauth-services -- OAuth Server Side -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Security.OAuth.Servers; package AWA.OAuth.Services is type Auth_Manager is new Security.OAuth.Servers.Auth_Manager with private; type Auth_Manager_Access is access all Auth_Manager'Class; private type Auth_Manager is new Security.OAuth.Servers.Auth_Manager with record N : Natural; end record; end AWA.OAuth.Services; ```
5c6c7ef4-7a52-4be4-a096-07e8cf682387
{ "language": "Ada" }
```ada -- -*- Mode: Ada -*- -- Filename : last_chance_handler.ads -- Description : Definition of the exception handler for the kernel. -- Author : Luke A. Guest -- Created On : Thu Jun 14 12:06:21 2012 -- Licence : See LICENCE in the root directory. with System; procedure Last_Chance_Handler (Source_Location : System.Address; Line : Integer); pragma Export (C, Last_Chance_Handler, "__gnat_last_chance_handler"); ``` Make this package Preelaborate so a-except can depend on it.
```ada -- -*- Mode: Ada -*- -- Filename : last_chance_handler.ads -- Description : Definition of the exception handler for the kernel. -- Author : Luke A. Guest -- Created On : Thu Jun 14 12:06:21 2012 -- Licence : See LICENCE in the root directory. with System; procedure Last_Chance_Handler (Source_Location : System.Address; Line : Integer); pragma Export (C, Last_Chance_Handler, "__gnat_last_chance_handler"); pragma Preelaborate (Last_Chance_Handler); ```
e807bde5-9194-411b-9feb-4c0fcf1e5c9c
{ "language": "Ada" }
```ada ``` Implement the Initialize, Get and Get_Gateways operations
```ada ----------------------------------------------------------------------- -- druss-config -- Configuration management for Druss -- Copyright (C) 2017 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Environment_Variables; with Ada.Directories; with Util.Files; package body Druss.Config is Cfg : Util.Properties.Manager; -- ------------------------------ -- Initialize the configuration. -- ------------------------------ procedure Initialize is Home : constant String := Ada.Environment_Variables.Value ("HOME"); Path : constant String := Util.Files.Compose (Home, ".config/druss/druss.properties"); begin if Ada.Directories.Exists (Path) then Cfg.Load_Properties (Path); end if; end Initialize; -- ------------------------------ -- Get the configuration parameter. -- ------------------------------ function Get (Name : in String) return String is begin return Cfg.Get (Name); end Get; -- ------------------------------ -- Initalize the list of gateways from the configuration file. -- ------------------------------ procedure Get_Gateways (List : in out Druss.Gateways.Gateway_Vector) is begin Druss.Gateways.Initialize (Cfg, List); end Get_Gateways; end Druss.Config; ```
b9629965-084c-4800-8746-19d9b2135bda
{ "language": "Ada" }
```ada ``` Add package AWA.Commands.Info to report configuration information
```ada ----------------------------------------------------------------------- -- akt-commands-info -- Info command to describe the current configuration -- Copyright (C) 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 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 GNAT.Command_Line; with AWA.Commands.Drivers; with AWA.Applications; with AWA.Modules; with ASF.Locales; generic with package Command_Drivers is new AWA.Commands.Drivers (<>); package AWA.Commands.Info is type Command_Type is new Command_Drivers.Application_Command_Type with record Bundle : ASF.Locales.Bundle; Long_List : aliased Boolean := False; Value_Length : Positive := 50; end record; -- Print the configuration about the application. overriding procedure Execute (Command : in out Command_Type; Application : in out AWA.Applications.Application'Class; Args : in Argument_List'Class; Context : in out Context_Type); -- Setup the command before parsing the arguments and executing it. overriding procedure Setup (Command : in out Command_Type; Config : in out GNAT.Command_Line.Command_Line_Configuration; Context : in out Context_Type); -- Write the help associated with the command. overriding procedure Help (Command : in out Command_Type; Name : in String; Context : in out Context_Type); -- Print the configuration identified by the given name. procedure Print (Command : in out Command_Type; Name : in String; Value : in String; Default : in String; Context : in out Context_Type); procedure Print (Command : in out Command_Type; Application : in out AWA.Applications.Application'Class; Name : in String; Default : in String; Context : in out Context_Type); procedure Print (Command : in out Command_Type; Module : in AWA.Modules.Module'Class; Name : in String; Default : in String; Context : in out Context_Type); Command : aliased Command_Type; end AWA.Commands.Info; ```
8dadf544-954a-40da-be31-cf6358901a15
{ "language": "Ada" }
```ada ``` Implement the GNAT_Parser package to parse arguments using GNAT Getopt
```ada ----------------------------------------------------------------------- -- util-commands-parsers.gnat_parser -- GNAT command line parser for command drivers -- Copyright (C) 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with GNAT.OS_Lib; package body Util.Commands.Parsers.GNAT_Parser is function To_OS_Lib_Argument_List (Args : in Argument_List'Class) return GNAT.OS_Lib.Argument_List_Access; function To_OS_Lib_Argument_List (Args : in Argument_List'Class) return GNAT.OS_Lib.Argument_List_Access is Count : constant Natural := Args.Get_Count; New_Arg : GNAT.OS_Lib.Argument_List (1 .. Count); begin for I in 1 .. Count loop New_Arg (I) := new String '(Args.Get_Argument (I)); end loop; return new GNAT.OS_Lib.Argument_List '(New_Arg); end To_OS_Lib_Argument_List; procedure Execute (Config : in out Config_Type; Args : in Util.Commands.Argument_List'Class; Process : access procedure (Cmd_Args : in Commands.Argument_List'Class)) is Parser : GNAT.Command_Line.Opt_Parser; Cmd_Args : Dynamic_Argument_List; Params : GNAT.OS_Lib.Argument_List_Access := To_OS_Lib_Argument_List (Args); begin GNAT.Command_Line.Initialize_Option_Scan (Parser, Params); GNAT.Command_Line.Getopt (Config => Config, Parser => Parser); loop declare S : constant String := GNAT.Command_Line.Get_Argument (Parser => Parser); begin exit when S'Length = 0; Cmd_Args.List.Append (S); end; end loop; Process (Cmd_Args); GNAT.OS_Lib.Free (Params); exception when others => GNAT.OS_Lib.Free (Params); raise; end Execute; end Util.Commands.Parsers.GNAT_Parser; ```
e967fcc9-a6b3-4e3e-b7af-4d097b0bb726
{ "language": "Ada" }
```ada ``` Implement the unit test on datasets
```ada ----------------------------------------------------------------------- -- ado-datasets-tests -- Test executing queries and using datasets -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with Util.Properties; with Regtests.Simple.Model; with ADO.Queries.Loaders; package body ADO.Datasets.Tests is package Caller is new Util.Test_Caller (Test, "ADO.Datasets"); package User_List_Query_File is new ADO.Queries.Loaders.File (Path => "regtests/files/user-list.xml", Sha1 => ""); package User_List_Query is new ADO.Queries.Loaders.Query (Name => "user-list", File => User_List_Query_File.File'Access); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test ADO.Datasets.List", Test_List'Access); end Add_Tests; procedure Test_List (T : in out Test) is DB : ADO.Sessions.Master_Session := Regtests.Get_Master_Database; Query : ADO.Queries.Context; Data : ADO.Datasets.Dataset; Props : constant Util.Properties.Manager := Util.Tests.Get_Properties; begin -- Configure the XML query loader. ADO.Queries.Loaders.Initialize (Props.Get ("ado.queries.paths", ".;db"), Props.Get ("ado.queries.load", "false") = "true"); for I in 1 .. 100 loop declare User : Regtests.Simple.Model.User_Ref; begin User.Set_Name ("John " & Integer'Image (I)); User.Set_Select_Name ("test-list"); User.Set_Value (ADO.Identifier (I)); User.Save (DB); end; end loop; DB.Commit; Query.Set_Query (User_List_Query.Query'Access); Query.Bind_Param ("filter", String '("test-list")); ADO.Datasets.List (Data, DB, Query); Util.Tests.Assert_Equals (T, 100, Data.Get_Count, "Invalid dataset size"); end Test_List; end ADO.Datasets.Tests; ```
a5184482-e2c5-4798-b2a7-86a953de9fea
{ "language": "Ada" }
```ada ``` Add a new set of unit tests for the date converter
```ada ----------------------------------------------------------------------- -- asf-converters-tests - Unit tests for ASF.Converters -- Copyright (C) 2014 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; with ASF.Contexts.Faces.Tests; package ASF.Converters.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new ASF.Contexts.Faces.Tests.Test with null record; -- Test the date short converter. procedure Test_Date_Short_Converter (T : in out Test); -- Test the date medium converter. procedure Test_Date_Medium_Converter (T : in out Test); -- Test the date long converter. procedure Test_Date_Long_Converter (T : in out Test); -- Test the date full converter. procedure Test_Date_Full_Converter (T : in out Test); -- Test the time short converter. procedure Test_Time_Short_Converter (T : in out Test); -- Test the time short converter. procedure Test_Time_Medium_Converter (T : in out Test); -- Test the time long converter. procedure Test_Time_Long_Converter (T : in out Test); end ASF.Converters.Tests; ```
2b24646c-788d-4fb7-affc-a7547ae9510d
{ "language": "Ada" }
```ada ``` Define the MAT.Events.Gtkmat package to display the events in some window
```ada ----------------------------------------------------------------------- -- gprofiler-events - Profiler Events Description -- Copyright (C) 2014 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Cairo; with Gtk.Drawing_Area; with MAT.Events.Targets; package MAT.Events.Gtkmat is type Event_Drawing_Type is record Drawing : Gtk.Drawing_Area.Gtk_Drawing_Area; List : MAT.Events.Targets.Target_Event_Vector; end record; type Event_Drawing_Type_Access is access Event_Drawing_Type; procedure Create (Drawing : in out Event_Drawing_Type); procedure Draw (Onto : in Event_Drawing_Type; Cr : in Cairo.Cairo_Context); end MAT.Events.Gtkmat; ```
9ede8696-20fa-4e63-8f90-a2017fbf7a3c
{ "language": "Ada" }
```ada ``` Implement the Frames_Types package to protect the frame creation in multi-threaded contexts
```ada ----------------------------------------------------------------------- -- mat-frames-targets - Representation of stack frames -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body MAT.Frames.Targets is -- ------------------------------ -- Insert in the frame tree the new stack frame represented by <tt>Pc</tt>. -- If the frame is already known, the frame reference counter is incremented. -- The frame represented by <tt>Pc</tt> is returned in <tt>Result</tt>. -- ------------------------------ procedure Insert (Frame : in out Target_Frames; Pc : in Frame_Table; Result : out Frame_Type) is begin Frame.Frames.Insert (Pc, Result); end Insert; protected body Frames_Type is -- ------------------------------ -- Insert in the frame tree the new stack frame represented by <tt>Pc</tt>. -- If the frame is already known, the frame reference counter is incremented. -- The frame represented by <tt>Pc</tt> is returned in <tt>Result</tt>. -- ------------------------------ procedure Insert (Pc : in Frame_Table; Result : out Frame_Type) is begin MAT.Frames.Insert (Root, Pc, Result); end Insert; -- ------------------------------ -- Clear and destroy all the frame instances. -- ------------------------------ procedure Clear is begin Destroy (Root); end Clear; end Frames_Type; -- ------------------------------ -- Release all the stack frames. -- ------------------------------ overriding procedure Finalize (Frames : in out Target_Frames) is begin Frames.Frames.Clear; end Finalize; end MAT.Frames.Targets; ```
4dd7903f-0500-45cc-8eb1-5c144885ca3b
{ "language": "Ada" }
```ada ``` Implement the operations for the <mail:attachment> component
```ada ----------------------------------------------------------------------- -- awa-mail-components-attachments -- Mail UI Attachments -- Copyright (C) 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 this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Util.Beans.Objects; package body AWA.Mail.Components.Attachments is use Ada.Strings.Unbounded; -- ------------------------------ -- Render the mail subject and initializes the message with its content. -- ------------------------------ overriding procedure Encode_Children (UI : in UIMailAttachment; Context : in out ASF.Contexts.Faces.Faces_Context'Class) is procedure Process (Content : in Unbounded_String); Content_Type : Util.Beans.Objects.Object; File_Name : Util.Beans.Objects.Object; Id : constant Unbounded_String := UI.Get_Client_Id; procedure Process (Content : in Unbounded_String) is Msg : constant AWA.Mail.Clients.Mail_Message_Access := UI.Get_Message; Typ : constant String := (if Util.Beans.Objects.Is_Empty (Content_Type) then "" else Util.Beans.Objects.To_String (Content_Type)); begin Msg.Add_Attachment (Content, To_String (Id), Typ); end Process; begin Content_Type := UI.Get_Attribute (Name => "contentType", Context => Context); File_Name := UI.Get_Attribute (Name => "fileName", Context => Context); UI.Wrap_Encode_Children (Context, Process'Access); end Encode_Children; end AWA.Mail.Components.Attachments; ```
381067ac-bff7-4137-ac65-0163e2739e26
{ "language": "Ada" }
```ada ``` Add navigation rule unit test
```ada ----------------------------------------------------------------------- -- asf-navigations-tests - Tests for ASF navigation -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package ASF.Navigations.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Initialize the test application overriding procedure Set_Up (T : in out Test); -- Test a form navigation with an exact match (view, outcome, action). procedure Test_Exact_Navigation (T : in out Test); -- Test a form navigation with a partial match (view, outcome). procedure Test_Partial_Navigation (T : in out Test); -- Test a form navigation with a exception match (view, outcome). procedure Test_Exception_Navigation (T : in out Test); -- Check the navigation for an URI and expect the result to match the regular expression. procedure Check_Navigation (T : in out Test; Name : in String; Match : in String; Raise_Flag : in Boolean := False); end ASF.Navigations.Tests; ```
fa5174fa-a392-4b56-9f9a-2c9e77175945
{ "language": "Ada" }
```ada ``` Add a unit test for the babel stream compositions
```ada ----------------------------------------------------------------------- -- babel-streams-tests - Unit tests for babel streams -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package Babel.Streams.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Test the Find function resolving some existing user. procedure Test_Stream_Composition (T : in out Test); end Babel.Streams.Tests; ```
cf995e46-6ee4-41e6-ba47-9a3892525e92
{ "language": "Ada" }
```ada ``` Add the package to build the generated Ada packages (UML packages test)
```ada ----------------------------------------------------------------------- -- Test -- Test the code generation -- Copyright (C) 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package Gen.Tests.Packages is end Gen.Tests.Packages; ```
5f360f0a-828f-4317-8022-e9b8f3b3b272
{ "language": "Ada" }
```ada ``` Define a vectors of objects
```ada ----------------------------------------------------------------------- -- Util.Beans.Objects.Vectors -- Object vectors -- Copyright (C) 2011 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Containers.Vectors; package Util.Beans.Objects.Vectors is new Ada.Containers.Vectors (Index_Type => Natural, Element_Type => Object); ```
f98d4c91-0a5f-4241-be76-351f54d5b966
{ "language": "Ada" }
```ada ``` Add the ASIS file $i
```ada ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . A _ S T A N D -- -- -- -- S p e c -- -- -- -- $Revision: 15117 $ -- -- -- Copyright (c) 2002, 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, 59 Temple Place -- -- - Suite 330, Boston, MA 02111-1307, 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 Ada Core Technologies Inc -- -- (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- We need this renaming because the GNAT Stand package and the ASIS A4G.Stand -- package conflict if mentioned in the same context clause. This renaming -- seems to be the cheapest way to correct the old bad choice of the name -- of the ASIS package (A4G.Stand) with A4G.Stand; package A4G.A_Stand renames A4G.Stand; ```
51e44382-2003-4690-9bd9-abe27a3043ba
{ "language": "Ada" }
```ada ``` Package ASF.Servlets.Files renames Servlet.Core.Files but make it obscolesent (provided as backward compatibility)
```ada ----------------------------------------------------------------------- -- asf-servlets-files -- Files servlet -- Copyright (C) 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Servlet.Core.Files; package ASF.Servlets.Files renames Servlet.Core.Files; pragma Obsolescent ("use the 'Servlet.Core.Files' package"); ```
67a01a54-5e56-4b0c-86ef-f44aeb6f126b
{ "language": "Ada" }
```ada ``` Add unit tests for OAuth package and Create_Nonce operation
```ada ----------------------------------------------------------------------- -- Security-oauth-clients-tests - Unit tests for OAuth -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with Util.Measures; with Util.Strings.Sets; package body Security.OAuth.Clients.Tests is package Caller is new Util.Test_Caller (Test, "Security.OAuth.Clients"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Security.OAuth.Clients.Create_Nonce", Test_Create_Nonce'Access); end Add_Tests; -- ------------------------------ -- Test Create_Nonce operation. -- ------------------------------ procedure Test_Create_Nonce (T : in out Test) is Nonces : Util.Strings.Sets.Set; begin for I in 1 .. 1_000 loop for I in 32 .. 734 loop declare S : constant String := Create_Nonce (I * 3); begin T.Assert (not Nonces.Contains (S), "Nonce was not unique: " & S); Nonces.Include (S); end; end loop; end loop; declare S : Util.Measures.Stamp; begin for I in 1 .. 1_000 loop declare Nonce : constant String := Create_Nonce (128); pragma Unreferenced (Nonce); begin null; end; end loop; Util.Measures.Report (S, "128 bits nonce generation (1000 calls)"); end; end Test_Create_Nonce; end Security.OAuth.Clients.Tests; ```
e7b8e816-611f-4078-8c51-c4aff16a00a6
{ "language": "Ada" }
```ada ``` Define the OAuth based authorization
```ada ----------------------------------------------------------------------- -- security-auth-oauth -- OAuth based authentication -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Security.OAuth.Clients; private package Security.Auth.OAuth is -- ------------------------------ -- OAuth Manager -- ------------------------------ -- The <b>Manager</b> provides the core operations for the OAuth authorization process. type Manager is abstract new Security.Auth.Manager with private; -- Initialize the authentication realm. overriding procedure Initialize (Realm : in out Manager; Params : in Parameters'Class; Provider : in String := PROVIDER_OPENID); -- Discover the OpenID provider that must be used to authenticate the user. -- The <b>Name</b> can be an URL or an alias that identifies the provider. -- A cached OpenID provider can be returned. -- Read the XRDS document from the URI and initialize the OpenID provider end point. -- (See OpenID Section 7.3 Discovery) overriding procedure Discover (Realm : in out Manager; Name : in String; Result : out End_Point); -- Associate the application (relying party) with the OpenID provider. -- The association can be cached. -- (See OpenID Section 8 Establishing Associations) overriding procedure Associate (Realm : in out Manager; OP : in End_Point; Result : out Association); overriding function Get_Authentication_URL (Realm : in Manager; OP : in End_Point; Assoc : in Association) return String; -- Verify the authentication result overriding procedure Verify (Realm : in out Manager; Assoc : in Association; Request : in Parameters'Class; Result : out Authentication); -- Verify the OAuth access token and retrieve information about the user. procedure Verify_Access_Token (Realm : in Manager; Assoc : in Association; Request : in Parameters'Class; Token : in Security.OAuth.Clients.Access_Token_Access; Result : in out Authentication) is abstract; private type Manager is abstract new Security.Auth.Manager with record Return_To : Unbounded_String; Realm : Unbounded_String; Scope : Unbounded_String; App : Security.OAuth.Clients.Application; end record; end Security.Auth.OAuth; ```
cb48838b-b957-41fc-ad7c-c8d14eea4f50
{ "language": "Ada" }
```ada ``` Implement the Set_Buffer and Finalize procedures
```ada ----------------------------------------------------------------------- -- babel-Streams -- Stream management -- Copyright (C) 2014, 2015 Stephane.Carrez -- Written by Stephane.Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body Babel.Streams is -- ------------------------------ -- Set the internal buffer that the stream can use. -- ------------------------------ procedure Set_Buffer (Stream : in out Stream_Type; Buffer : in Babel.Files.Buffers.Buffer_Access) is begin Stream.Buffer := Buffer; end Set_Buffer; -- ------------------------------ -- Release the stream buffer if there is one. -- ------------------------------ overriding procedure Finalize (Stream : in out Stream_Type) is use type Babel.Files.Buffers.Buffer_Access; begin if Stream.Buffer /= null then Babel.Files.Buffers.Release (Stream.Buffer); end if; end Finalize; end Babel.Streams; ```
017414ed-be7d-4f90-b266-54592a8cb3bb
{ "language": "Ada" }
```ada ``` Implement the Cache_Control_Filter to add a Cache-Control and Vary header in the HTTP response
```ada ----------------------------------------------------------------------- -- asf-filters-cache_control -- HTTP response Cache-Control settings -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- package body ASF.Filters.Cache_Control is -- ------------------------------ -- The Do_Filter method of the Filter is called by the container each time -- a request/response pair is passed through the chain due to a client request -- for a resource at the end of the chain. The <b>Cache_Control</b> filter adds -- a <tt>Cache-Control</tt>, <tt>Expires</tt>, <tt>Pragma</tt> and optionally a -- <tt>Vary</tt> header in the HTTP response. -- ------------------------------ overriding procedure Do_Filter (F : in Cache_Control_Filter; Request : in out Requests.Request'Class; Response : in out Responses.Response'Class; Chain : in out ASF.Servlets.Filter_Chain) is use Ada.Strings.Unbounded; begin if Length (F.Cache_Control_Header) > 0 then Response.Add_Header ("Cache-Control", To_String (F.Cache_Control_Header)); end if; if Length (F.Vary) > 0 then Response.Add_Header ("Vary", To_String (F.Vary)); end if; ASF.Servlets.Do_Filter (Chain => Chain, Request => Request, Response => Response); end Do_Filter; -- ------------------------------ -- Called by the servlet container to indicate to a filter that the filter -- instance is being placed into service. -- ------------------------------ procedure Initialize (Server : in out Cache_Control_Filter; Config : in ASF.Servlets.Filter_Config) is begin Server.Vary := Servlets.Get_Init_Parameter (Config, VARY_HEADER_PARAM); Server.Cache_Control_Header := Servlets.Get_Init_Parameter (Config, CACHE_CONTROL_PARAM); end Initialize; end ASF.Filters.Cache_Control; ```
8adab319-9a8d-4e8a-9015-1e55923ec457
{ "language": "Ada" }
```ada ``` Add the ASIS file $i
```ada ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT INTERFACE COMPONENTS -- -- -- -- A S I S . E R R O R S -- -- -- -- S p e c -- -- -- -- $Revision: 14416 $ -- -- -- This specification is adapted from the Ada Semantic Interface -- -- Specification Standard (ISO/IEC 15291) for use with GNAT. In accordance -- -- with the copyright of that document, you can freely copy and modify this -- -- specification, provided that if you redistribute a modified version, any -- -- changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 4 package Asis.Errors ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ package Asis.Errors is ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- -- ASIS reports all operational errors by raising an exception. Whenever an -- ASIS implementation raises one of the exceptions declared in package -- Asis.Exceptions, it will previously have set the values returned by the -- Status and Diagnosis queries to indicate the cause of the error. The -- possible values for Status are indicated in the definition of Error_Kinds -- below, with suggestions for the associated contents of the Diagnosis -- string as a comment. -- -- The Diagnosis and Status queries are provided in the Asis.Implementation -- package to supply more information about the reasons for raising any -- exception. -- -- ASIS applications are encouraged to follow this same convention whenever -- they explicitly raise any ASIS exception--always record a Status and -- Diagnosis prior to raising the exception. ------------------------------------------------------------------------------ -- 4.1 type Error_Kinds ------------------------------------------------------------------------------ -- This enumeration type describes the various kinds of errors. -- type Error_Kinds is ( Not_An_Error, -- No error is presently recorded Value_Error, -- Routine argument value invalid Initialization_Error, -- ASIS is uninitialized Environment_Error, -- ASIS could not initialize Parameter_Error, -- Bad Parameter given to Initialize Capacity_Error, -- Implementation overloaded Name_Error, -- Context/unit not found Use_Error, -- Context/unit not use/open-able Data_Error, -- Context/unit bad/invalid/corrupt Text_Error, -- The program text cannot be located Storage_Error, -- Storage_Error suppressed Obsolete_Reference_Error, -- Argument or result is invalid due to -- and inconsistent compilation unit Unhandled_Exception_Error, -- Unexpected exception suppressed Not_Implemented_Error, -- Functionality not implemented Internal_Error); -- Implementation internal failure end Asis.Errors; ```
607089cd-4d76-4637-9d5c-3261c14e6056
{ "language": "Ada" }
```ada ``` Declare the AWA.Images.Servlets package with the Image_Servlet type
```ada ----------------------------------------------------------------------- -- awa-images-servlets -- Serve images saved in the storage service -- Copyright (C) 2016 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Calendar; with ASF.Requests; with AWA.Storages.Servlets; with ADO; package AWA.Images.Servlets is -- The <b>Image_Servlet</b> represents the component that will handle -- an HTTP request received by the server. type Image_Servlet is new AWA.Storages.Servlets.Storage_Servlet with private; -- Load the data content that correspond to the GET request and get the name as well -- as mime-type and date. overriding procedure Load (Server : in Image_Servlet; Request : in out ASF.Requests.Request'Class; Name : out Ada.Strings.Unbounded.Unbounded_String; Mime : out Ada.Strings.Unbounded.Unbounded_String; Date : out Ada.Calendar.Time; Data : out ADO.Blob_Ref); private type Image_Servlet is new AWA.Storages.Servlets.Storage_Servlet with null record; end AWA.Images.Servlets; ```
9ae81251-5043-43fe-99ed-ee5a5a23264c
{ "language": "Ada" }
```ada ``` Define ASF.Rest package for the server-side API REST support
```ada ----------------------------------------------------------------------- -- asf-rest -- REST Support -- Copyright (C) 2016 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Strings; with ASF.Requests; with ASF.Responses; with Security.Permissions; -- == REST == -- The <tt>ASF.Rest</tt> package provides support to implement easily some RESTful API. package ASF.Rest is type Request is abstract new ASF.Requests.Request with null record; type Response is abstract new ASF.Responses.Response with null record; -- The HTTP rest method. type Method_Type is (GET, HEAD, POST, PUT, DELETE, OPTIONS); type Descriptor is abstract tagged limited private; type Descriptor_Access is access all Descriptor'Class; -- Get the permission index associated with the REST operation. function Get_Permission (Handler : in Descriptor) return Security.Permissions.Permission_Index; -- Dispatch the request to the API handler. procedure Dispatch (Handler : in Descriptor; Req : in out ASF.Rest.Request'Class; Reply : in out ASF.Rest.Response'Class) is abstract; private type Descriptor is abstract tagged limited record Next : Descriptor_Access; Method : Method_Type; Pattern : Util.Strings.Name_Access; Permission : Security.Permissions.Permission_Index := 0; end record; -- Register the API descriptor in a list. procedure Register (List : in out Descriptor_Access; Item : in Descriptor_Access); end ASF.Rest; ```
00e56eea-7d9f-48b2-b24f-65d8b488563d
{ "language": "Ada" }
```ada ``` Add unit tests for JWT
```ada ----------------------------------------------------------------------- -- Security-oayth-jwt-tests - Unit tests for JSON Web Token -- Copyright (C) 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; package Security.OAuth.JWT.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Test Decode operation with errors. procedure Test_Decode_Error (T : in out Test); generic with function Get (From : in Token) return String; Value : String; procedure Test_Operation (T : in out Test); generic with function Get (From : in Token) return Ada.Calendar.Time; Value : String; procedure Test_Time_Operation (T : in out Test); end Security.OAuth.JWT.Tests; ```
5289ec7f-10b3-407b-85f9-fa79cd823e72
{ "language": "Ada" }
```ada ``` Package to implement the Load_Schema procedure
```ada ----------------------------------------------------------------------- -- ado-schemas-sqlite -- SQLite Database Schemas -- Copyright (C) 2015 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ADO.Drivers.Connections; package ADO.Schemas.Sqlite is -- Load the database schema procedure Load_Schema (C : in ADO.Drivers.Connections.Database_Connection'Class; Schema : out Schema_Definition); end ADO.Schemas.Sqlite; ```