Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Implement the Initialize procedure and use it
----------------------------------------------------------------------- -- ado-mysql -- Database Drivers -- Copyright (C) 2019 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ADO.Configs; with ADO.Connections.Mysql; package body ADO.Mysql is -- ------------------------------ -- Initialize the drivers and the library by reading the property file -- and configure the runtime with it. -- ------------------------------ procedure Initialize (Config : in String) is begin ADO.Configs.Initialize (Config); ADO.Connections.Mysql.Initialize; end Initialize; -- ------------------------------ -- Initialize the drivers and the library and configure the runtime with the given properties. -- ------------------------------ procedure Initialize (Config : in Util.Properties.Manager'Class) is begin ADO.Configs.Initialize (Config); ADO.Connections.Mysql.Initialize; end Initialize; end ADO.Mysql;
----------------------------------------------------------------------- -- ado-mysql -- Database Drivers -- Copyright (C) 2019 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with ADO.Configs; with ADO.Connections.Mysql; package body ADO.Mysql is -- ------------------------------ -- Initialize the Mysql driver. -- ------------------------------ procedure Initialize is begin ADO.Connections.Mysql.Initialize; end Initialize; -- ------------------------------ -- Initialize the drivers and the library by reading the property file -- and configure the runtime with it. -- ------------------------------ procedure Initialize (Config : in String) is begin ADO.Configs.Initialize (Config); Initialize; end Initialize; -- ------------------------------ -- Initialize the drivers and the library and configure the runtime with the given properties. -- ------------------------------ procedure Initialize (Config : in Util.Properties.Manager'Class) is begin ADO.Configs.Initialize (Config); Initialize; end Initialize; end ADO.Mysql;
Call the Finish procedure after executing the testsuite Finish will destroy the AWA application that was allocated dynamically
----------------------------------------------------------------------- -- AWA - 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. ----------------------------------------------------------------------- with AWA.Testsuite; with Util.Tests; with AWA.Tests; procedure AWA_Harness is procedure Harness is new Util.Tests.Harness (AWA.Testsuite.Suite, AWA.Tests.Initialize); begin Harness ("awa-tests.xml"); end AWA_Harness;
----------------------------------------------------------------------- -- AWA - Unit tests -- Copyright (C) 2009, 2010, 2011, 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with AWA.Testsuite; with Util.Tests; with AWA.Tests; procedure AWA_Harness is procedure Harness is new Util.Tests.Harness (AWA.Testsuite.Suite, AWA.Tests.Initialize, AWA.Tests.Finish); begin Harness ("awa-tests.xml"); end AWA_Harness;
Add the new unit tests
----------------------------------------------------------------------- -- Security testsuite - Ada Security Test suite -- 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 Security.OpenID.Tests; with Security.Permissions.Tests; with Security.Policies.Tests; package body Security.Testsuite is Tests : aliased Util.Tests.Test_Suite; function Suite return Util.Tests.Access_Test_Suite is Ret : constant Util.Tests.Access_Test_Suite := Tests'Access; begin Security.OpenID.Tests.Add_Tests (Ret); Security.Permissions.Tests.Add_Tests (Ret); Security.Policies.Tests.Add_Tests (Ret); return Ret; end Suite; end Security.Testsuite;
----------------------------------------------------------------------- -- Security testsuite - Ada Security Test suite -- Copyright (C) 2011, 2012, 2013 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Security.OpenID.Tests; with Security.Permissions.Tests; with Security.Policies.Tests; with Security.OAuth.JWT.Tests; package body Security.Testsuite is Tests : aliased Util.Tests.Test_Suite; function Suite return Util.Tests.Access_Test_Suite is Ret : constant Util.Tests.Access_Test_Suite := Tests'Access; begin Security.OAuth.JWT.Tests.Add_Tests (Ret); Security.OpenID.Tests.Add_Tests (Ret); Security.Permissions.Tests.Add_Tests (Ret); Security.Policies.Tests.Add_Tests (Ret); return Ret; end Suite; end Security.Testsuite;
Add the Ada beans in the workspace documentation
----------------------------------------------------------------------- -- awa-workspaces -- Module workspaces -- 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. ----------------------------------------------------------------------- -- == Introduction == -- The *workspaces* plugin defines a workspace area for other plugins. -- -- == Data Model == -- @include Workspace.hbm.xml -- package AWA.Workspaces is end AWA.Workspaces;
----------------------------------------------------------------------- -- awa-workspaces -- Module workspaces -- 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. ----------------------------------------------------------------------- -- == Introduction == -- The *workspaces* plugin defines a workspace area for other plugins. -- -- == Ada Beans == -- @include workspaces.xml -- -- == Data Model == -- @include Workspace.hbm.xml -- package AWA.Workspaces is end AWA.Workspaces;
Add To_Object and To_Time with a Nullable_Time type
----------------------------------------------------------------------- -- Util.Beans.Objects.Time -- Helper conversion for Ada Calendar Time -- 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 Ada.Calendar; package Util.Beans.Objects.Time is -- Create an object from the given value. function To_Object (Value : in Ada.Calendar.Time) return Object; -- Convert the object into a time. -- Raises Constraint_Error if the object cannot be converter to the target type. function To_Time (Value : in Object) return Ada.Calendar.Time; -- Force the object to be a time. function Cast_Time (Value : Object) return Object; end Util.Beans.Objects.Time;
----------------------------------------------------------------------- -- util-beans-objects-time -- Helper conversion for Ada Calendar Time -- Copyright (C) 2010, 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 Ada.Calendar; with Util.Nullables; package Util.Beans.Objects.Time is -- Create an object from the given value. function To_Object (Value : in Ada.Calendar.Time) return Object; function To_Object (Value : in Nullables.Nullable_Time) return Object; -- Convert the object into a time. -- Raises Constraint_Error if the object cannot be converter to the target type. function To_Time (Value : in Object) return Ada.Calendar.Time; function To_Time (Value : in Object) return Nullables.Nullable_Time; -- Force the object to be a time. function Cast_Time (Value : Object) return Object; end Util.Beans.Objects.Time;
Document the Tags plugin in AWA
----------------------------------------------------------------------- -- awa-tags -- Tags management -- 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. ----------------------------------------------------------------------- -- == Introduction == -- The <b>Tags</b> module allows to associate general purpose tags to any database entity. -- -- == Model == -- [http://ada-awa.googlecode.com/svn/wiki/awa_tags_model.png] -- -- @include awa-tags-modules.ads package AWA.Tags is pragma Pure; end AWA.Tags;
----------------------------------------------------------------------- -- awa-tags -- Tags management -- 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. ----------------------------------------------------------------------- -- == Introduction == -- The <b>Tags</b> module allows to associate general purpose tags to any database entity. -- It provides a JSF component that allows to insert easily a list of tags in a page and -- in a form. An application can use the bean types defined in <tt>AWA.Tags.Beans</tt> -- to define the tags and it will use the <tt>awa:tagList</tt> component to display them. -- -- == Model == -- [http://ada-awa.googlecode.com/svn/wiki/awa_tags_model.png] -- -- @include awa-tags-modules.ads -- @include awa-tags-beans.ads -- @include awa-tags-components.ads -- package AWA.Tags is pragma Pure; end AWA.Tags;
Update to use the new command implementation
----------------------------------------------------------------------- -- gen-commands-database -- Database creation from application model -- 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. ----------------------------------------------------------------------- package Gen.Commands.Database is -- ------------------------------ -- Database Creation Command -- ------------------------------ -- This command creates the database for the application. type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. procedure Execute (Cmd : in Command; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. procedure Help (Cmd : in Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Database;
----------------------------------------------------------------------- -- gen-commands-database -- Database creation from application model -- Copyright (C) 2011, 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 Gen.Commands.Database is -- ------------------------------ -- Database Creation Command -- ------------------------------ -- This command creates the database for the application. type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Database;
Update to use the new command implementation
----------------------------------------------------------------------- -- gen-commands-propset -- Set a property on dynamo project -- 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. ----------------------------------------------------------------------- package Gen.Commands.Propset is -- ------------------------------ -- Propset Command -- ------------------------------ -- This command sets a property in the dynamo project configuration. type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. procedure Execute (Cmd : in Command; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. procedure Help (Cmd : in Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Propset;
----------------------------------------------------------------------- -- gen-commands-propset -- Set a property on dynamo project -- Copyright (C) 2011, 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 Gen.Commands.Propset is -- ------------------------------ -- Propset Command -- ------------------------------ -- This command sets a property in the dynamo project configuration. type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Propset;
Add a device selector to the Do_List procedure
----------------------------------------------------------------------- -- druss-commands-devices -- Print information about the devices -- 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.Devices is type Command_Type is new Druss.Commands.Drivers.Command_Type with null record; procedure Do_List (Command : in Command_Type; Args : in Argument_List'Class; Context : in out Context_Type); -- Execute a status command to report information about the Bbox. 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.Devices;
----------------------------------------------------------------------- -- druss-commands-devices -- Print information about the devices -- 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.Devices is type Command_Type is new Druss.Commands.Drivers.Command_Type with null record; procedure Do_List (Command : in Command_Type; Args : in Argument_List'Class; Selector : in Device_Selector_Type; Context : in out Context_Type); -- Execute a status command to report information about the Bbox. 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.Devices;
Add coverage test for simple generic package
-- @file coverage_for_ada_task.adb -- @date 28 May 2022 -- @author Chester Gillon -- @brief Example program to test getting coverage for an Ada task with Ada.Text_IO; procedure Coverage_For_Ada_Task is task Print_Task is entry Print; end Print_Task; task body Print_Task is begin loop select accept Print do Ada.Text_IO.Put_Line ("In task Print_Task"); end Print; or terminate; end select; end loop; end Print_Task; begin for index in 1..3 loop Print_Task.Print; end loop; Ada.Text_IO.Put_Line ("In main"); end Coverage_For_Ada_Task;
-- @file coverage_for_ada_task.adb -- @date 28 May 2022 -- @author Chester Gillon -- @brief Example program to test getting coverage for an Ada task with Ada.Text_IO; procedure Coverage_For_Ada_Task is generic Name : String; package Generic_Name is procedure Display_Name; end Generic_Name; package body Generic_Name is procedure Display_Name is begin Ada.Text_IO.Put_Line ("My name is " & Name); end Display_Name; end Generic_Name; task Print_Task is entry Print; end Print_Task; task body Print_Task is begin loop select accept Print do Ada.Text_IO.Put_Line ("In task Print_Task"); end Print; or terminate; end select; end loop; end Print_Task; package Package_A is new Generic_Name ("A"); package Package_B is new Generic_Name ("B"); begin Package_A.Display_Name; for index in 1..3 loop Print_Task.Print; end loop; Package_B.Display_Name; Ada.Text_IO.Put_Line ("In main"); end Coverage_For_Ada_Task;
Increase loop for FreeBSD test
-- t0032.adb - Tue Jan 14 20:20:46 2014 -- -- (c) Warren W. Gay VE3WWG ve3wwg@gmail.com -- -- Protected under the following license: -- GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 with Ada.Text_IO; with Posix; use Posix; procedure T0032 is use Ada.Text_IO; Res : s_rusage; Error : errno_t; pragma Volatile(Error); begin Put_Line("Test 0032 - Getrlimit/Setrlimit"); Error := 0; for X in 0..999999 loop if Error < 32000 then Error := Error + 1; else Error := 0; end if; end loop; Getrusage(RUSAGE_SELF,Res,Error); pragma Assert(Error = 0); pragma Assert(Res.ru_utime.tv_sec >= 0); pragma Assert(Res.ru_utime.tv_usec > 0 or else Res.ru_utime.tv_sec > 0); Put_Line("Test 0032 Passed."); end T0032;
-- t0032.adb - Tue Jan 14 20:20:46 2014 -- -- (c) Warren W. Gay VE3WWG ve3wwg@gmail.com -- -- Protected under the following license: -- GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 with Ada.Text_IO; with Posix; use Posix; procedure T0032 is use Ada.Text_IO; Res : s_rusage; Error : errno_t; pragma Volatile(Error); begin Put_Line("Test 0032 - Getrlimit/Setrlimit"); Error := 0; for X in 0..9999999 loop if Error < 32000 then Error := Error + 1; else Error := 0; end if; end loop; Getrusage(RUSAGE_SELF,Res,Error); pragma Assert(Error = 0); pragma Assert(Res.ru_utime.tv_sec >= 0); pragma Assert(Res.ru_utime.tv_usec > 0 or else Res.ru_utime.tv_sec > 0); Put_Line("Test 0032 Passed."); end T0032;
Package ASF.Security moved to Servlet.Security
----------------------------------------------------------------------- -- 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. ----------------------------------------------------------------------- with EL.Functions; package ASF.Security is -- EL function name exposed by Set_Functions. HAS_PERMISSION_FN : constant String := "hasPermission"; -- URI for the EL functions exposed by the security package (See Set_Functions). AUTH_NAMESPACE_URI : constant String := "http://code.google.com/p/ada-asf/auth"; -- Register a set of functions in the namespace -- xmlns:fn="http://code.google.com/p/ada-asf/auth" -- Functions: -- hasPermission(NAME) -- Returns True if the permission NAME is granted procedure Set_Functions (Mapper : in out EL.Functions.Function_Mapper'Class); end ASF.Security;
----------------------------------------------------------------------- -- 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. ----------------------------------------------------------------------- with EL.Functions; package ASF.Security is -- EL function name exposed by Set_Functions. HAS_PERMISSION_FN : constant String := "hasPermission"; -- URI for the EL functions exposed by the security package (See Set_Functions). AUTH_NAMESPACE_URI : constant String := "http://code.google.com/p/ada-asf/auth"; -- Register a set of functions in the namespace -- xmlns:fn="http://code.google.com/p/ada-asf/auth" -- Functions: -- hasPermission(NAME) -- Returns True if the permission NAME is granted procedure Set_Functions (Mapper : in out EL.Functions.Function_Mapper'Class); end ASF.Security;
Add the specific queries and Ada beans in the documentation
----------------------------------------------------------------------- -- awa-blogs -- Blogs module -- 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. ----------------------------------------------------------------------- -- == Introduction == -- The *blogs* plugin is a small blog application which allows users to publish articles. -- -- @include blogs.xml -- -- == Model == -- [http://ada-awa.googlecode.com/svn/wiki/awa_blogs_model.png] -- -- @include Blog.hbm.xml -- package AWA.Blogs is end AWA.Blogs;
----------------------------------------------------------------------- -- awa-blogs -- Blogs module -- 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. ----------------------------------------------------------------------- -- == Introduction == -- The *blogs* plugin is a small blog application which allows users to publish articles. -- -- == Ada Beans == -- @include blogs.xml -- -- == Queries == -- @include blog-admin-post-list.xml -- @include blog-post-list.xml -- @include blog-list.xml -- -- == Model == -- [http://ada-awa.googlecode.com/svn/wiki/awa_blogs_model.png] -- -- @include Blog.hbm.xml -- package AWA.Blogs is end AWA.Blogs;
Add the Ada beans in the Storages plugin documentation
----------------------------------------------------------------------- -- awa-storages -- Storage module -- 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. ----------------------------------------------------------------------- -- == Introduction == -- The <b>Storages</b> module provides a set of storage services allowing an application -- to store data files, documents, images in a persistent area. -- -- == Data Model == -- @include Storages.hbm.xml package AWA.Storages is end AWA.Storages;
----------------------------------------------------------------------- -- awa-storages -- Storage module -- 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. ----------------------------------------------------------------------- -- == Introduction == -- The <b>Storages</b> module provides a set of storage services allowing an application -- to store data files, documents, images in a persistent area. -- -- == Ada Beans == -- @include storages.xml -- -- == Data Model == -- @include Storages.hbm.xml package AWA.Storages is end AWA.Storages;
Check that accessing a struct field that occurs before the start of the struct (!) works correctly.
-- RUN: %llvmgcc -c %s with System; procedure Negative_Field_Offset (N : Integer) is type String_Pointer is access String; -- Force use of a thin pointer. for String_Pointer'Size use System.Word_Size; P : String_Pointer; begin P := new String (1 .. N); end;
-- RUN: %llvmgcc -c %s with System; procedure Negative_Field_Offset (N : Integer) is type String_Pointer is access String; -- Force use of a thin pointer. for String_Pointer'Size use System.Word_Size; P : String_Pointer; procedure Q (P : String_Pointer) is begin P (1) := 'Z'; end; begin P := new String (1 .. N); Q (P); end;
Add the permission in the documentation
----------------------------------------------------------------------- -- security -- Security -- Copyright (C) 2010, 2011, 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- -- == Introduction == -- -- -- @include security-contexts.ads -- @include security-controllers.ads package Security is end Security;
----------------------------------------------------------------------- -- security -- Security -- Copyright (C) 2010, 2011, 2012 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- -- == Introduction == -- The <tt>Security</tt> package provides security frameworks that allows -- an application to use OpenID or OAuth security frameworks. This security -- framework was first developed within the Ada Server Faces project. -- -- @include security-permissions.ads -- @include security-openid.ads -- @include security-oauth.ads -- @include security-contexts.ads -- @include security-controllers.ads package Security is end Security;
Read from usart1 in interruptive mode.
#if MCU="ATMEGA2560" then with AVR.USART; with AVR.INTERRUPTS; #end if; procedure Main is -- Out_Flag_Char : Character; begin #if MCU="ATMEGA2560" then AVR.INTERRUPTS.Disable; AVR.USART.Initialize (In_Port => AVR.USART.USART1, In_Setup => (Sync_Mode => AVR.USART.ASYNCHRONOUS, Double_Speed => True, Baud_Rate => 9600, Data_Bits => AVR.USART.BITS_8, Parity => AVR.USART.NONE, Stop_Bits => 1, Model => AVR.USART.INTERRUPTIVE)); AVR.USART.Put_Line (Port => AVR.USART.USART1, Data => "#### Initialization ok. ####"); AVR.INTERRUPTS.Enable; loop -- Out_Flag_Char := AVR.USART.Get; -- AVR.USART.Put -- (Port => AVR.USART.USART1, -- Data => Out_Flag_Char); null; end loop; #else null; #end if; end Main;
#if MCU="ATMEGA2560" then with AVR.USART; with AVR.INTERRUPTS; #end if; procedure Main is Counter : Long_Integer := 0; Out_Buffer : AVR.USART.Buffer_64_Type; begin #if MCU="ATMEGA2560" then AVR.INTERRUPTS.Disable; AVR.USART.Initialize (In_Port => AVR.USART.USART1, In_Setup => (Sync_Mode => AVR.USART.ASYNCHRONOUS, Double_Speed => True, Baud_Rate => 9600, Data_Bits => AVR.USART.BITS_8, Parity => AVR.USART.NONE, Stop_Bits => 1, Model => AVR.USART.INTERRUPTIVE)); AVR.USART.Put_Line (Port => AVR.USART.USART1, Data => "#### Initialization ok. ####"); AVR.INTERRUPTS.Enable; loop Counter := Counter + 1; if AVR.USART.Get_Raw_Buffer (In_Port => AVR.USART.USART1, Out_Data => Out_Buffer) then AVR.USART.Put_Buffer (In_Port => AVR.USART.USART1); end if; end loop; #else null; #end if; end Main;
Define the abstract Database type to represent the database of backup files
----------------------------------------------------------------------- -- babel-base -- File filters -- 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. ----------------------------------------------------------------------- package Babel.Base is end Babel.Base;
----------------------------------------------------------------------- -- babel-base -- Database for files -- 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.Finalization; with ADO; package Babel.Base is type Database is abstract new Ada.Finalization.Limited_Controlled with private; private type Database is abstract new Ada.Finalization.Limited_Controlled with record Name : Integer; end record; end Babel.Base;
Change the Definition function into a Register procedure
----------------------------------------------------------------------- -- components-ajax-factory -- Factory for AJAX Components -- 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 ASF.Factory; package ASF.Components.Ajax.Factory is use ASF; -- Get the Ajax component factory. function Definition return ASF.Factory.Factory_Bindings_Access; end ASF.Components.Ajax.Factory;
----------------------------------------------------------------------- -- components-ajax-factory -- Factory for AJAX Components -- Copyright (C) 2011, 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 ASF.Factory; package ASF.Components.Ajax.Factory is -- Register the Ajax component factory. procedure Register (Factory : in out ASF.Factory.Component_Factory); end ASF.Components.Ajax.Factory;
Add unit test for undo vote
----------------------------------------------------------------------- -- awa-votes-modules-tests -- Unit tests for vote service -- 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 AWA.Tests; package AWA.Votes.Modules.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new AWA.Tests.Test with record Manager : AWA.Votes.Modules.Vote_Module_Access; end record; -- Test vote. procedure Test_Vote_Up (T : in out Test); end AWA.Votes.Modules.Tests;
----------------------------------------------------------------------- -- awa-votes-modules-tests -- Unit tests for vote service -- 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 AWA.Tests; package AWA.Votes.Modules.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new AWA.Tests.Test with record Manager : AWA.Votes.Modules.Vote_Module_Access; end record; -- Test vote. procedure Test_Vote_Up (T : in out Test); -- Test vote. procedure Test_Vote_Undo (T : in out Test); end AWA.Votes.Modules.Tests;
Add the symbols in the target object
----------------------------------------------------------------------- -- Targets - Representation of target information -- 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 MAT.Types; with Ada.Strings.Unbounded; with MAT.Memory.Targets; with MAT.Readers; package MAT.Targets is type Target_Type is tagged limited private; type Target_Type_Access is access all Target_Type'Class; -- Initialize the target object to manage the memory slots, the stack frames -- and setup the reader to analyze the memory and other events. procedure Initialize (Target : in out Target_Type; Reader : in out MAT.Readers.Manager_Base'Class); private type Target_Type is tagged limited record Memory : MAT.Memory.Targets.Target_Memory; end record; end MAT.Targets;
----------------------------------------------------------------------- -- Targets - Representation of target information -- 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 MAT.Types; with Ada.Strings.Unbounded; with MAT.Memory.Targets; with MAT.Symbols.Targets; with MAT.Readers; package MAT.Targets is -- type Target_Type is tagged limited private; type Target_Type is tagged limited record Memory : MAT.Memory.Targets.Target_Memory; Symbols : MAT.Symbols.Targets.Target_Symbols; end record; type Target_Type_Access is access all Target_Type'Class; -- Initialize the target object to manage the memory slots, the stack frames -- and setup the reader to analyze the memory and other events. procedure Initialize (Target : in out Target_Type; Reader : in out MAT.Readers.Manager_Base'Class); -- -- private -- -- type Target_Type is tagged limited record -- Memory : MAT.Memory.Targets.Target_Memory; -- end record; end MAT.Targets;
Declare the Test_Copy_Stream procedure to test the Util.Streams.Copy procedures
----------------------------------------------------------------------- -- util-streams-tests -- Unit tests for encoding buffered streams -- Copyright (C) 2017, 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.Tests; with Util.Encoders.AES; package Util.Streams.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; procedure Test_AES (T : in out Test; Item : in String; Count : in Positive; Mode : in Util.Encoders.AES.AES_Mode; Label : in String); procedure Test_Base64_Stream (T : in out Test); end Util.Streams.Tests;
----------------------------------------------------------------------- -- util-streams-tests -- Unit tests for encoding buffered streams -- Copyright (C) 2017, 2019, 2021 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Tests; with Util.Encoders.AES; package Util.Streams.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; procedure Test_AES (T : in out Test; Item : in String; Count : in Positive; Mode : in Util.Encoders.AES.AES_Mode; Label : in String); procedure Test_Base64_Stream (T : in out Test); procedure Test_Copy_Stream (T : in out Test); end Util.Streams.Tests;
Declare the Iterate and Copy procedures
----------------------------------------------------------------------- -- babel-base -- Database for files -- 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.Finalization; with ADO; with Babel.Files; package Babel.Base is type Database is abstract new Ada.Finalization.Limited_Controlled with private; type Database_Access is access all Database'Class; -- Insert the file in the database. procedure Insert (Into : in out Database; File : in Babel.Files.File_Type) is abstract; private type Database is abstract new Ada.Finalization.Limited_Controlled with record Name : Integer; end record; end Babel.Base;
----------------------------------------------------------------------- -- babel-base -- Database for files -- 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.Finalization; with ADO; with Babel.Files; package Babel.Base is type Database is abstract new Ada.Finalization.Limited_Controlled with private; type Database_Access is access all Database'Class; -- Insert the file in the database. procedure Insert (Into : in out Database; File : in Babel.Files.File_Type) is abstract; procedure Iterate (From : in Database; Process : not null access procedure (File : in Babel.Files.File_Type)) is abstract; procedure Copy (Into : in out Database'Class; From : in Database'Class); private type Database is abstract new Ada.Finalization.Limited_Controlled with record Name : Integer; end record; end Babel.Base;
Update to use the new command implementation
----------------------------------------------------------------------- -- gen-commands-model -- Model creation command for dynamo -- 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. ----------------------------------------------------------------------- package Gen.Commands.Model is -- ------------------------------ -- Model Creation Command -- ------------------------------ -- This command adds a model file to the web application. type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. procedure Execute (Cmd : in Command; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. procedure Help (Cmd : in Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Model;
----------------------------------------------------------------------- -- gen-commands-model -- Model creation command for dynamo -- Copyright (C) 2011, 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 Gen.Commands.Model is -- ------------------------------ -- Model Creation Command -- ------------------------------ -- This command adds a model file to the web application. type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Model;
Declare Test_Table_Iterator procedure to test the table iterator
----------------------------------------------------------------------- -- schemas Tests -- Test loading of database schema -- Copyright (C) 2009, 2010, 2011, 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 ADO.Schemas.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Test reading the entity cache and the Find_Entity_Type operation procedure Test_Find_Entity_Type (T : in out Test); -- Test calling Find_Entity_Type with an invalid table. procedure Test_Find_Entity_Type_Error (T : in out Test); -- Test the Load_Schema operation and check the result schema. procedure Test_Load_Schema (T : in out Test); end ADO.Schemas.Tests;
----------------------------------------------------------------------- -- schemas Tests -- Test loading of database schema -- Copyright (C) 2009, 2010, 2011, 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 ADO.Schemas.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; -- Test reading the entity cache and the Find_Entity_Type operation procedure Test_Find_Entity_Type (T : in out Test); -- Test calling Find_Entity_Type with an invalid table. procedure Test_Find_Entity_Type_Error (T : in out Test); -- Test the Load_Schema operation and check the result schema. procedure Test_Load_Schema (T : in out Test); -- Test the Table_Cursor operations and check the result schema. procedure Test_Table_Iterator (T : in out Test); end ADO.Schemas.Tests;
Remove unused with clause Util.Serialize.IO.JSON
----------------------------------------------------------------------- -- asf-streams-json -- JSON Print streams for servlets -- 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.Serialize.IO.JSON; package body ASF.Streams.JSON is -- ------------------------------ -- Initialize the stream -- ------------------------------ procedure Initialize (Stream : in out Print_Stream; To : in ASF.Streams.Print_Stream'Class) is begin Stream.Initialize (To.Target); end Initialize; end ASF.Streams.JSON;
----------------------------------------------------------------------- -- asf-streams-json -- JSON Print streams for servlets -- Copyright (C) 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. ----------------------------------------------------------------------- package body ASF.Streams.JSON is -- ------------------------------ -- Initialize the stream -- ------------------------------ procedure Initialize (Stream : in out Print_Stream; To : in ASF.Streams.Print_Stream'Class) is begin Stream.Initialize (To.Target); end Initialize; end ASF.Streams.JSON;
Add a Path parameter to the Initialize procedure
----------------------------------------------------------------------- -- 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 Util.Properties; with Druss.Gateways; package Druss.Config is -- Initialize the configuration. procedure Initialize; -- Get the configuration parameter. function Get (Name : in String) return String; -- Initalize the list of gateways from the configuration file. procedure Get_Gateways (List : in out Druss.Gateways.Gateway_Vector); end Druss.Config;
----------------------------------------------------------------------- -- 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 Druss.Gateways; package Druss.Config is -- Initialize the configuration. procedure Initialize (Path : in String); -- Get the configuration parameter. function Get (Name : in String) return String; -- Initalize the list of gateways from the configuration file. procedure Get_Gateways (List : in out Druss.Gateways.Gateway_Vector); end Druss.Config;
Add Name parameter to the Help procedure
----------------------------------------------------------------------- -- gen-commands-database -- Database creation from application model -- Copyright (C) 2011, 2017, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use 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.Commands.Database is -- ------------------------------ -- Database Creation Command -- ------------------------------ -- This command creates the database for the application. type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in out Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in out Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Database;
----------------------------------------------------------------------- -- gen-commands-database -- Database creation from application model -- Copyright (C) 2011, 2017, 2018, 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. ----------------------------------------------------------------------- package Gen.Commands.Database is -- ------------------------------ -- Database Creation Command -- ------------------------------ -- This command creates the database for the application. type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in out Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in out Command; Name : in String; Generator : in out Gen.Generator.Handler); end Gen.Commands.Database;
Make protected type Counter lock free
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2017 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package Orka.Atomics is pragma Pure; protected type Counter (Initial_Value : Natural) is procedure Add (Addition : Natural); procedure Increment; procedure Decrement (Zero : out Boolean); procedure Reset; function Count return Natural; private Value : Natural := Initial_Value; end Counter; end Orka.Atomics;
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2017 onox <denkpadje@gmail.com> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. package Orka.Atomics is pragma Pure; protected type Counter (Initial_Value : Natural) is pragma Lock_Free; procedure Add (Addition : Natural); procedure Increment; procedure Decrement (Zero : out Boolean); procedure Reset; function Count return Natural; private Value : Natural := Initial_Value; end Counter; end Orka.Atomics;
Remove declaration of internal Parse_Table procedure
----------------------------------------------------------------------- -- wiki-parsers-markdown -- Markdown parser operations -- Copyright (C) 2016 - 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. ----------------------------------------------------------------------- private package Wiki.Parsers.Markdown is pragma Preelaborate; subtype Parser_Type is Parser; -- Parse a markdown table/column. -- Example: -- | col1 | col2 | ... | colN | procedure Parse_Table (P : in out Parser; Token : in Wiki.Strings.WChar); procedure Parse_Line (Parser : in out Parser_Type; Text : in Wiki.Buffers.Buffer_Access); procedure Parse_Inline_Text (Parser : in out Parser_Type; Text : in Wiki.Buffers.Buffer_Access); end Wiki.Parsers.Markdown;
----------------------------------------------------------------------- -- wiki-parsers-markdown -- Markdown parser operations -- Copyright (C) 2016 - 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. ----------------------------------------------------------------------- private package Wiki.Parsers.Markdown is pragma Preelaborate; subtype Parser_Type is Parser; procedure Parse_Line (Parser : in out Parser_Type; Text : in Wiki.Buffers.Buffer_Access); procedure Parse_Inline_Text (Parser : in out Parser_Type; Text : in Wiki.Buffers.Buffer_Access); end Wiki.Parsers.Markdown;
Update to use the new command implementation
----------------------------------------------------------------------- -- gen-commands-generate -- Generate command for dynamo -- 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. ----------------------------------------------------------------------- package Gen.Commands.Generate is -- ------------------------------ -- Generator Command -- ------------------------------ type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. procedure Execute (Cmd : in Command; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. procedure Help (Cmd : in Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Generate;
----------------------------------------------------------------------- -- gen-commands-generate -- Generate command for dynamo -- Copyright (C) 2011, 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 Gen.Commands.Generate is -- ------------------------------ -- Generator Command -- ------------------------------ type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Generate;
Change the Element operation to a procedure that gets and updates the position
----------------------------------------------------------------------- -- wiki-helpers-parser -- Generic procedure for the wiki parser -- 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; with Wiki.Documents; with Wiki.Streams; generic type Engine_Type is limited private; type Element_Type is limited private; with function Element (Item : in Element_Type; Pos : in Natural) return Wiki.Strings.WChar is <>; with function Length (Item : in Element_Type) return Natural is <>; with procedure Parse (Engine : in out Engine_Type; Stream : in Wiki.Streams.Input_Stream_Access; Doc : in out Wiki.Documents.Document) is <>; procedure Wiki.Helpers.Parser (Engine : in out Engine_Type; Content : in Element_Type; Doc : in out Wiki.Documents.Document); pragma Preelaborate (Wiki.Helpers.Parser);
----------------------------------------------------------------------- -- wiki-helpers-parser -- Generic procedure for the wiki parser -- 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; with Wiki.Documents; with Wiki.Streams; generic type Engine_Type is limited private; type Element_Type (<>) is limited private; with procedure Element (Item : in Element_Type; Pos : in out Natural; Char : out Wiki.Strings.WChar) is <>; with function Length (Item : in Element_Type) return Natural is <>; with procedure Parse (Engine : in out Engine_Type; Stream : in Wiki.Streams.Input_Stream_Access; Doc : in out Wiki.Documents.Document) is <>; procedure Wiki.Helpers.Parser (Engine : in out Engine_Type; Content : in Element_Type; Doc : in out Wiki.Documents.Document); pragma Preelaborate (Wiki.Helpers.Parser);
Fix LCD too slow on the STM32F7-Disco.
with STM32.LTDC; with STM32.LCDInit; package STM32.LCD is new STM32.LTDC (LCD_Width => 480, LCD_Height => 272, LCD_HSync => 41, LCD_HBP => 13, LCD_HFP => 32, LCD_VSYNC => 10, LCD_VBP => 2, LCD_VFP => 2, PLLSAI_N => 429, PLLSAI_R => 5, DivR => 2, Pre_LTDC_Initialize => STM32.LCDInit.Initialize, Post_LTDC_Initialize => STM32.LCDInit.Post_Init);
with STM32.LTDC; with STM32.LCDInit; package STM32.LCD is new STM32.LTDC (LCD_Width => 480, LCD_Height => 272, LCD_HSync => 41, LCD_HBP => 13, LCD_HFP => 32, LCD_VSYNC => 10, LCD_VBP => 2, LCD_VFP => 2, PLLSAI_N => 200, PLLSAI_R => 5, DivR => 2, Pre_LTDC_Initialize => STM32.LCDInit.Initialize, Post_LTDC_Initialize => STM32.LCDInit.Post_Init);
Declare the Get_Request_Bean generic function
----------------------------------------------------------------------- -- asf-helpers-beans -- Helper packages to write ASF applications -- 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 Util.Beans.Basic; package ASF.Helpers.Beans is -- Get a bean instance associated under the given name from the current faces context. -- A null value is returned if the bean does not exist or is not of the good type. generic type Element_Type is new Util.Beans.Basic.Readonly_Bean with private; type Element_Access is access all Element_Type'Class; function Get_Bean (Name : in String) return Element_Access; end ASF.Helpers.Beans;
----------------------------------------------------------------------- -- asf-helpers-beans -- Helper packages to write ASF applications -- Copyright (C) 2012, 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.Beans.Basic; with ASF.Requests; package ASF.Helpers.Beans is -- Get a bean instance associated under the given name from the current faces context. -- A null value is returned if the bean does not exist or is not of the good type. generic type Element_Type is new Util.Beans.Basic.Readonly_Bean with private; type Element_Access is access all Element_Type'Class; function Get_Bean (Name : in String) return Element_Access; -- Get a bean instance associated under the given name from the request. -- A null value is returned if the bean does not exist or is not of the good type. generic type Element_Type is new Util.Beans.Basic.Readonly_Bean with private; type Element_Access is access all Element_Type'Class; function Get_Request_Bean (Request : in ASF.Requests.Request'Class; Name : in String) return Element_Access; end ASF.Helpers.Beans;
Add Name parameter to the Help procedure
----------------------------------------------------------------------- -- gen-commands-layout -- Layout creation command for dynamo -- Copyright (C) 2011, 2017, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use 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.Commands.Layout is -- ------------------------------ -- Layout Creation Command -- ------------------------------ -- This command adds a XHTML layout to the web application. type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in out Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in out Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Layout;
----------------------------------------------------------------------- -- gen-commands-layout -- Layout creation command for dynamo -- Copyright (C) 2011, 2017, 2018, 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. ----------------------------------------------------------------------- package Gen.Commands.Layout is -- ------------------------------ -- Layout Creation Command -- ------------------------------ -- This command adds a XHTML layout to the web application. type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in out Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in out Command; Name : in String; Generator : in out Gen.Generator.Handler); end Gen.Commands.Layout;
Add Name parameter to the Help procedure
----------------------------------------------------------------------- -- gen-commands-plugins -- Plugin creation and management commands for dynamo -- Copyright (C) 2012, 2017, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may 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.Commands.Plugins is -- ------------------------------ -- Generator Command -- ------------------------------ type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in out Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in out Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Plugins;
----------------------------------------------------------------------- -- gen-commands-plugins -- Plugin creation and management commands for dynamo -- Copyright (C) 2012, 2017, 2018, 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. ----------------------------------------------------------------------- package Gen.Commands.Plugins is -- ------------------------------ -- Generator Command -- ------------------------------ type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in out Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in out Command; Name : in String; Generator : in out Gen.Generator.Handler); end Gen.Commands.Plugins;
Define the Insert operation on the Database abstract type
----------------------------------------------------------------------- -- babel-base -- Database for files -- 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.Finalization; with ADO; package Babel.Base is type Database is abstract new Ada.Finalization.Limited_Controlled with private; private type Database is abstract new Ada.Finalization.Limited_Controlled with record Name : Integer; end record; end Babel.Base;
----------------------------------------------------------------------- -- babel-base -- Database for files -- 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.Finalization; with ADO; with Babel.Files; package Babel.Base is type Database is abstract new Ada.Finalization.Limited_Controlled with private; -- Insert the file in the database. procedure Insert (Into : in out Database; File : in Babel.Files.File_Type) is abstract; private type Database is abstract new Ada.Finalization.Limited_Controlled with record Name : Integer; end record; end Babel.Base;
Add a device selector to the Do_Ping procedure
----------------------------------------------------------------------- -- 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;
----------------------------------------------------------------------- -- 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; Selector : in Device_Selector_Type; 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;
Add Name parameter to the Help procedure
----------------------------------------------------------------------- -- gen-commands-generate -- Generate command for dynamo -- Copyright (C) 2011, 2017, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use 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.Commands.Generate is -- ------------------------------ -- Generator Command -- ------------------------------ type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in out Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in out Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Generate;
----------------------------------------------------------------------- -- gen-commands-generate -- Generate command for dynamo -- Copyright (C) 2011, 2017, 2018, 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. ----------------------------------------------------------------------- package Gen.Commands.Generate is -- ------------------------------ -- Generator Command -- ------------------------------ type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in out Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in out Command; Name : in String; Generator : in out Gen.Generator.Handler); end Gen.Commands.Generate;
Add Name parameter to the Help procedure
----------------------------------------------------------------------- -- gen-commands-model -- Model creation command for dynamo -- Copyright (C) 2011, 2017, 2018 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use 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.Commands.Model is -- ------------------------------ -- Model Creation Command -- ------------------------------ -- This command adds a model file to the web application. type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in out Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in out Command; Generator : in out Gen.Generator.Handler); end Gen.Commands.Model;
----------------------------------------------------------------------- -- gen-commands-model -- Model creation command for dynamo -- Copyright (C) 2011, 2017, 2018, 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. ----------------------------------------------------------------------- package Gen.Commands.Model is -- ------------------------------ -- Model Creation Command -- ------------------------------ -- This command adds a model file to the web application. type Command is new Gen.Commands.Command with null record; -- Execute the command with the arguments. overriding procedure Execute (Cmd : in out Command; Name : in String; Args : in Argument_List'Class; Generator : in out Gen.Generator.Handler); -- Write the help associated with the command. overriding procedure Help (Cmd : in out Command; Name : in String; Generator : in out Gen.Generator.Handler); end Gen.Commands.Model;
Change license text to mixed case instead of SHOUTING it
-- Lumen -- A simple graphical user interface library based on OpenGL -- -- Chip Richards, NiEstu, Phoenix AZ, Spring 2010 -- Lumen would not be possible without the support and contributions of a cast -- of thousands, including and primarily Rod Kay. -- This code is covered by the ISC License: -- -- Copyright (c) 2010, NiEstu -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -- SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -- IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. package Lumen is pragma Pure (Lumen); end Lumen;
-- Lumen -- A simple graphical user interface library based on OpenGL -- -- Chip Richards, NiEstu, Phoenix AZ, Spring 2010 -- Lumen would not be possible without the support and contributions of a cast -- of thousands, including and primarily Rod Kay. -- This code is covered by the ISC License: -- -- Copyright (c) 2010, NiEstu -- -- Permission to use, copy, modify, and/or distribute this software for any -- purpose with or without fee is hereby granted, provided that the above -- copyright notice and this permission notice appear in all copies. -- -- The software is provided "as is" and the author disclaims all warranties -- with regard to this software including all implied warranties of -- merchantability and fitness. In no event shall the author be liable for any -- special, direct, indirect, or consequential damages or any damages -- whatsoever resulting from loss of use, data or profits, whether in an -- action of contract, negligence or other tortious action, arising out of or -- in connection with the use or performance of this software. package Lumen is pragma Pure (Lumen); end Lumen;
Change the Definition function into a Register procedure
----------------------------------------------------------------------- -- html-factory -- Factory for HTML UI Components -- Copyright (C) 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 ASF.Factory; package ASF.Components.Html.Factory is use ASF; -- Get the HTML component factory. function Definition return ASF.Factory.Factory_Bindings_Access; end ASF.Components.Html.Factory;
----------------------------------------------------------------------- -- html-factory -- Factory for HTML UI Components -- Copyright (C) 2009, 2010, 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 ASF.Factory; package ASF.Components.Html.Factory is -- Register the HTML component factory. procedure Register (Factory : in out ASF.Factory.Component_Factory); end ASF.Components.Html.Factory;
Fix O_CLOEXEC undefined in keystore-io-files.adb (win32)
-- Generated by utildgen.c from system includes with Interfaces.C; package Util.Systems.Constants is pragma Pure; -- Flags used when opening a file with open/creat. O_RDONLY : constant Interfaces.C.int := 8#000000#; O_WRONLY : constant Interfaces.C.int := 8#000001#; O_RDWR : constant Interfaces.C.int := 8#000002#; O_CREAT : constant Interfaces.C.int := 8#000400#; O_EXCL : constant Interfaces.C.int := 8#002000#; O_TRUNC : constant Interfaces.C.int := 8#001000#; O_APPEND : constant Interfaces.C.int := 8#000010#; DLL_OPTIONS : constant String := ""; SYMBOL_PREFIX : constant String := ""; end Util.Systems.Constants;
-- Generated by utildgen.c from system includes with Interfaces.C; package Util.Systems.Constants is pragma Pure; -- Flags used when opening a file with open/creat. O_RDONLY : constant Interfaces.C.int := 8#000000#; O_WRONLY : constant Interfaces.C.int := 8#000001#; O_RDWR : constant Interfaces.C.int := 8#000002#; O_CREAT : constant Interfaces.C.int := 8#000400#; O_EXCL : constant Interfaces.C.int := 8#002000#; O_TRUNC : constant Interfaces.C.int := 8#001000#; O_APPEND : constant Interfaces.C.int := 8#000010#; O_CLOEXEC : constant Interfaces.C.int := 0; O_SYNC : constant Interfaces.C.int := 0; O_DIRECT : constant Interfaces.C.int := 0; DLL_OPTIONS : constant String := ""; SYMBOL_PREFIX : constant String := ""; end Util.Systems.Constants;
Declare Precision_Type enumeration Declare new Image function
----------------------------------------------------------------------- -- util-dates-iso8601 -- ISO8601 dates -- Copyright (C) 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. ----------------------------------------------------------------------- with Ada.Calendar; package Util.Dates.ISO8601 is -- Parses an ISO8601 date and return it as a calendar time. -- Raises Constraint_Error if the date format is not recognized. function Value (Date : in String) return Ada.Calendar.Time; -- Return the ISO8601 date. function Image (Date : in Ada.Calendar.Time) return String; function Image (Date : in Date_Record) return String; end Util.Dates.ISO8601;
----------------------------------------------------------------------- -- util-dates-iso8601 -- ISO8601 dates -- Copyright (C) 2011, 2013, 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.Calendar; package Util.Dates.ISO8601 is type Precision_Type is (YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, SUBSECOND); -- Parses an ISO8601 date and return it as a calendar time. -- Raises Constraint_Error if the date format is not recognized. function Value (Date : in String) return Ada.Calendar.Time; -- Return the ISO8601 date. function Image (Date : in Ada.Calendar.Time) return String; function Image (Date : in Date_Record) return String; function Image (Date : in Ada.Calendar.Time; Precision : in Precision_Type) return String; function Image (Date : in Date_Record; Precision : in Precision_Type) return String; end Util.Dates.ISO8601;
Include the AWA commands documentation
----------------------------------------------------------------------- -- awa -- Ada Web Application -- Copyright (C) 2009 - 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. ----------------------------------------------------------------------- -- = AWA Core == -- -- @include awa-applications.ads -- @include awa-modules.ads -- @include awa-permissions.ads -- @include awa-events.ads -- @include awa.xml package AWA is pragma Pure; end AWA;
----------------------------------------------------------------------- -- awa -- Ada Web Application -- Copyright (C) 2009 - 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. ----------------------------------------------------------------------- -- = AWA Core == -- -- @include awa-applications.ads -- @include awa-modules.ads -- @include awa-permissions.ads -- @include awa-events.ads -- @include awa-commands.ads -- @include awa.xml package AWA is pragma Pure; end AWA;
Change the Event type to a limited type
----------------------------------------------------------------------- -- util-events -- Events -- Copyright (C) 2001, 2002, 2003, 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 Ada.Calendar; package Util.Events is type Event is tagged private; -- Get the time identifying when the event was created. function Get_Time (Ev : Event) return Ada.Calendar.Time; type Event_Listener is limited interface; private type Event is tagged record Date : Ada.Calendar.Time := Ada.Calendar.Clock; end record; end Util.Events;
----------------------------------------------------------------------- -- util-events -- Events -- Copyright (C) 2001, 2002, 2003, 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. ----------------------------------------------------------------------- with Ada.Calendar; package Util.Events is type Event is tagged limited private; -- Get the time identifying when the event was created. function Get_Time (Ev : Event) return Ada.Calendar.Time; type Event_Listener is limited interface; private type Event is tagged limited record Date : Ada.Calendar.Time := Ada.Calendar.Clock; end record; end Util.Events;
Add unit test for undo vote
----------------------------------------------------------------------- -- awa-votes-modules-tests -- Unit tests for vote service -- 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 AWA.Tests; package AWA.Votes.Modules.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new AWA.Tests.Test with record Manager : AWA.Votes.Modules.Vote_Module_Access; end record; -- Test vote. procedure Test_Vote_Up (T : in out Test); end AWA.Votes.Modules.Tests;
----------------------------------------------------------------------- -- awa-votes-modules-tests -- Unit tests for vote service -- 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 AWA.Tests; package AWA.Votes.Modules.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new AWA.Tests.Test with record Manager : AWA.Votes.Modules.Vote_Module_Access; end record; -- Test vote. procedure Test_Vote_Up (T : in out Test); -- Test vote. procedure Test_Vote_Undo (T : in out Test); end AWA.Votes.Modules.Tests;
Change the Definition function into a Register procedure
----------------------------------------------------------------------- -- core-factory -- Factory for UI Core Components -- Copyright (C) 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 ASF.Factory; package ASF.Components.Core.Factory is use ASF; -- Get the Core component factory. function Definition return ASF.Factory.Factory_Bindings_Access; end ASF.Components.Core.Factory;
----------------------------------------------------------------------- -- core-factory -- Factory for UI Core Components -- Copyright (C) 2009, 2010, 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 ASF.Factory; package ASF.Components.Core.Factory is -- Register the Core component factory. procedure Register (Factory : in out ASF.Factory.Component_Factory); end ASF.Components.Core.Factory;
Declare Test_Output and Write_Stream procedures
----------------------------------------------------------------------- -- serialize-io-json-tests -- Unit tests for JSON parser -- 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 Util.Tests; package Util.Serialize.IO.JSON.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; procedure Test_Parse_Error (T : in out Test); procedure Test_Parser (T : in out Test); end Util.Serialize.IO.JSON.Tests;
----------------------------------------------------------------------- -- serialize-io-json-tests -- Unit tests for JSON parser -- Copyright (C) 2011, 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.Tests; package Util.Serialize.IO.JSON.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; procedure Test_Parse_Error (T : in out Test); procedure Test_Parser (T : in out Test); -- Generate some output stream for the test. procedure Write_Stream (Stream : in out Util.Serialize.IO.Output_Stream'Class); -- Test the JSON output stream generation. procedure Test_Output (T : in out Test); end Util.Serialize.IO.JSON.Tests;
Update to call the target Start procedure
----------------------------------------------------------------------- -- mat-types -- Global types -- 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.IO_Exceptions; with MAT.Commands; with MAT.Targets; with MAT.Consoles.Text; with MAT.Readers.Streams.Sockets; procedure Matp is Target : MAT.Targets.Target_Type; Console : aliased MAT.Consoles.Text.Console_Type; Server : MAT.Readers.Streams.Sockets.Socket_Listener_Type; begin Target.Console (Console'Unchecked_Access); Target.Initialize_Options; MAT.Commands.Initialize_Files (Target); Server.Start (Options.Address); MAT.Commands.Interactive (Target); Server.Stop; exception when Ada.IO_Exceptions.End_Error | MAT.Targets.Usage_Error => Server.Stop; end Matp;
----------------------------------------------------------------------- -- mat-types -- Global types -- 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.IO_Exceptions; with MAT.Commands; with MAT.Targets; with MAT.Consoles.Text; with MAT.Readers.Streams.Sockets; procedure Matp is Target : MAT.Targets.Target_Type; Console : aliased MAT.Consoles.Text.Console_Type; Server : MAT.Readers.Streams.Sockets.Socket_Listener_Type; begin Target.Console (Console'Unchecked_Access); Target.Initialize_Options; MAT.Commands.Initialize_Files (Target); Target.Start; MAT.Commands.Interactive (Target); Server.Stop; exception when Ada.IO_Exceptions.End_Error | MAT.Targets.Usage_Error => Server.Stop; end Matp;
Add unit tests for the questionVote bean
----------------------------------------------------------------------- -- awa-questions-services-tests -- Unit tests for question service -- 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 AWA.Tests; package AWA.Questions.Services.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new AWA.Tests.Test with record Manager : AWA.Questions.Services.Question_Service_Access; end record; -- Test creation of a question. procedure Test_Create_Question (T : in out Test); -- Test list of questions. procedure Test_List_Questions (T : in out Test); end AWA.Questions.Services.Tests;
----------------------------------------------------------------------- -- awa-questions-services-tests -- Unit tests for question service -- 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 AWA.Tests; package AWA.Questions.Services.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new AWA.Tests.Test with record Manager : AWA.Questions.Services.Question_Service_Access; end record; -- Test creation of a question. procedure Test_Create_Question (T : in out Test); -- Test list of questions. procedure Test_List_Questions (T : in out Test); -- Test anonymous user voting for a question. procedure Test_Question_Vote_Anonymous (T : in out Test); -- Test voting for a question. procedure Test_Question_Vote (T : in out Test); private -- Do a vote on a question through the question vote bean. procedure Do_Vote (T : in out Test); end AWA.Questions.Services.Tests;
Add the stack frames unit tests
----------------------------------------------------------------------- -- mat-testsuite - MAT Testsuite -- 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 MAT.Readers.Tests; with MAT.Targets.Tests; package body MAT.Testsuite is Tests : aliased Util.Tests.Test_Suite; function Suite return Util.Tests.Access_Test_Suite is Result : constant Util.Tests.Access_Test_Suite := Tests'Access; begin MAT.Readers.Tests.Add_Tests (Result); MAT.Targets.Tests.Add_Tests (Result); return Result; end Suite; end MAT.Testsuite;
----------------------------------------------------------------------- -- mat-testsuite - MAT Testsuite -- 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 MAT.Readers.Tests; with MAT.Targets.Tests; with MAT.Frames.Tests; package body MAT.Testsuite is Tests : aliased Util.Tests.Test_Suite; function Suite return Util.Tests.Access_Test_Suite is Result : constant Util.Tests.Access_Test_Suite := Tests'Access; begin MAT.Frames.Tests.Add_Tests (Result); MAT.Readers.Tests.Add_Tests (Result); MAT.Targets.Tests.Add_Tests (Result); return Result; end Suite; end MAT.Testsuite;
Define a targets package for the Gtk UI
----------------------------------------------------------------------- -- mat-targets-gtkmat - Gtk target 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 Gtk.Widget; with Gtkada.Builder; package MAT.Targets.Gtkmat is type Target_Type is new MAT.Targets.Target_Type with private; -- Initialize the widgets and create the Gtk gui. procedure Initialize_Widget (Target : in out Target_Type; Widget : out Gtk.Widget.Gtk_Widget); -- Create a process instance to hold and keep track of memory and other information about -- the given process ID. overriding procedure Create_Process (Target : in out Target_Type; Pid : in MAT.Types.Target_Process_Ref; Path : in Ada.Strings.Unbounded.Unbounded_String; Process : out Target_Process_Type_Access); private type Target_Type is new MAT.Targets.Target_Type with record Builder : Gtkada.Builder.Gtkada_Builder; end record; end MAT.Targets.Gtkmat;
Implement the unit test on datasets
----------------------------------------------------------------------- -- 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;
Implement the Has_Directory and Peek_Directory operation for the Directory_Queue
----------------------------------------------------------------------- -- babel-files-queues -- File and directory queues -- 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.Strings.Unbounded; with Ada.Calendar; with Ada.Directories; with Ada.Containers.Vectors; with Util.Encoders.SHA1; with Util.Concurrent.Fifos; with Util.Strings.Vectors; with ADO; with Babel.Base.Models; package body Babel.Files.Queues is -- ------------------------------ -- Returns true if there is a directory in the queue. -- ------------------------------ function Has_Directory (Queue : in Directory_Queue) return Boolean is begin return not Queue.Directories.Is_Empty; end Has_Directory; -- ------------------------------ -- Get the next directory from the queue. -- ------------------------------ procedure Peek_Directory (Queue : in out Directory_Queue; Directory : out Directory_Type) is begin Directory := Queue.Directories.Last_Element; Queue.Directories.Delete_Last; end Peek_Directory; end Babel.Files.Queues;
Implement the generic procedure Wiki.Helpers.Parser to allow easily provide a Parser with various content types
----------------------------------------------------------------------- -- wiki-helpers-parser -- Generic procedure for the wiki parser -- 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.Helpers; with Wiki.Streams; procedure Wiki.Helpers.Parser (Engine : in out Engine_Type; Content : in Element_Type; Doc : in out Wiki.Documents.Document) is use type Wiki.Streams.Input_Stream_Access; type Wide_Input is new Wiki.Streams.Input_Stream with record Pos : Positive; Len : Natural; end record; overriding procedure Read (Buf : in out Wide_Input; Token : out Wiki.Strings.WChar; Is_Eof : out Boolean); procedure Read (Buf : in out Wide_Input; Token : out Wiki.Strings.WChar; Is_Eof : out Boolean) is begin if Buf.Pos > Buf.Len then Is_Eof := True; Token := Wiki.Helpers.CR; else Token := Element (Content, Buf.Pos); Buf.Pos := Buf.Pos + 1; Is_Eof := False; end if; end Read; Buffer : aliased Wide_Input; begin Buffer.Pos := 1; Buffer.Len := Length (Content); Parse (Engine, Buffer'Unchecked_Access, Doc); end Wiki.Helpers.Parser;
Change the UICounter to use the UIHtmlComponent base type
----------------------------------------------------------------------- -- awa-counters-components -- Counter UI component -- 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.Factory; with ASF.Contexts.Faces; with ASF.Components.Html; -- == Counter Component == -- package AWA.Counters.Components is type UICounter is new ASF.Components.Html.UIHtmlComponent with private; -- Render the counter component. Starts the DL/DD list and write the input -- component with the possible associated error message. overriding procedure Encode_Begin (UI : in UICounter; Context : in out ASF.Contexts.Faces.Faces_Context'Class); -- Get the AWA Counter component factory. function Definition return ASF.Factory.Factory_Bindings_Access; private type UICounter is new ASF.Components.Html.UIHtmlComponent with null record; end AWA.Counters.Components;
Add the ASIS file $i
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . I T E S T S -- -- -- -- 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). -- -- -- ------------------------------------------------------------------------------ -- This package defines tests for defining if an Element based on the -- given node should test Is_Implicit, Is_Inherited and Is_From_Instance with Types; use Types; package A4G.Itests is function Is_Inherited_Discriminant (N : Node_Id) return Boolean; -- Tests if N corresponds to the defining occurrence of an inherited -- discriminant. N should be of N_Defining_Identifier kind -- -- INCOMPLETE and INRELIABLE for now! function Is_From_Instance (N : Node_Id) return Boolean; -- Tests if N corresponds to an implicit or explicit construction from -- the result of some generic instantiation (that is, from an expanded -- generic template) end A4G.Itests;
Refactor the HTML Text_IO stream into a generic package
----------------------------------------------------------------------- -- wiki-streams-html-stream -- Generic Wiki HTML output stream -- Copyright (C) 2016, 2020 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use 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; generic type Output_Stream is limited new Wiki.Streams.Output_Stream with private; package Wiki.Streams.Html.Stream is type Html_Output_Stream is limited new Output_Stream and Html.Html_Output_Stream with private; -- 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_Stream; Name : in String; Content : in Wiki.Strings.UString); -- 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_Stream; Name : in String; Content : in Wide_Wide_String); -- Start an XML element with the given name. overriding procedure Start_Element (Stream : in out Html_Output_Stream; Name : in String); -- Closes an XML element of the given name. overriding procedure End_Element (Stream : in out Html_Output_Stream; Name : in String); -- Write a text escaping any character as necessary. overriding procedure Write_Wide_Text (Stream : in out Html_Output_Stream; Content : in Wiki.Strings.WString); private type Html_Output_Stream is limited new Output_Stream and 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.Stream;
Define the Readline package with the Get_Line operation
----------------------------------------------------------------------- -- readline -- A simple readline binding -- 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 Interfaces; package Readline is -- Print the prompt and a read a line from the terminal. -- Raise the Ada.IO_Exceptions.End_Error when the EOF is reached. function Get_Line (Prompt : in String) return String; end Readline;
Add the ASIS file $i
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT INTERFACE COMPONENTS -- -- -- -- A S I S . E X C E P T I O N 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. -- -- -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- 5 package Asis.Exceptions ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ package Asis.Exceptions is ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- ASIS exceptions are: ASIS_Inappropriate_Context : exception; ------------------------------------------------------------------------------ -- Raised when ASIS is passed a Context value that is not appropriate for the -- operation. This exception will typically indicate that a user error -- has occurred within the application. ------------------------------------------------------------------------------ ASIS_Inappropriate_Container : exception; ------------------------------------------------------------------------------ -- Raised when ASIS is passed a Container value that is not appropriate for -- the operation. This exception will typically indicate that a user error -- has occurred within the application. ------------------------------------------------------------------------------ ASIS_Inappropriate_Compilation_Unit : exception; ------------------------------------------------------------------------------ -- Raised when ASIS is passed a Compilation_Unit value that is not -- appropriate. This exception will typically indicate that a user -- error has occurred within the application. ------------------------------------------------------------------------------ ASIS_Inappropriate_Element : exception; ------------------------------------------------------------------------------ -- Raised when ASIS is given an Element value that is not appropriate. This -- exception will typically indicate that a user error has occurred within -- the application. ------------------------------------------------------------------------------ ASIS_Inappropriate_Line : exception; ------------------------------------------------------------------------------ -- Raised when ASIS is given a Line value that is not appropriate. ------------------------------------------------------------------------------ ASIS_Inappropriate_Line_Number : exception; ------------------------------------------------------------------------------ -- Raised when ASIS is given a Line_Number value that is not appropriate. -- This exception will typically indicate that a user error has occurred -- within the application. ------------------------------------------------------------------------------ ASIS_Failed : exception; ------------------------------------------------------------------------------ -- This is a catch-all exception that may be raised for different reasons -- in different ASIS implementations. All ASIS routines may raise ASIS_Failed -- whenever they cannot normally complete their operation. This exception -- will typically indicate a failure of the underlying ASIS implementation. ------------------------------------------------------------------------------ end Asis.Exceptions;
Implement the SIGINT interrupt handler with operations to install, check and clear the interrupt flag
----------------------------------------------------------------------- -- mat-interrupts - SIGINT management to stop long running commands -- 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.Interrupts; with Ada.Interrupts.Names; with Util.Log.Loggers; package body MAT.Interrupts is pragma Interrupt_State (Name => Ada.Interrupts.Names.SIGINT, State => USER); -- The logger Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("MAT.Interrupts"); protected Interrupts is procedure Interrupt; pragma Interrupt_Handler (Interrupt); function Is_Interrupted return Boolean; procedure Clear; private Interrupted : Boolean; end Interrupts; protected body Interrupts is function Is_Interrupted return Boolean is begin return Interrupted; end Is_Interrupted; procedure Clear is begin Interrupted := False; end Clear; procedure Interrupt is begin Interrupted := True; Log.Info ("SIGINT signal received"); end Interrupt; end Interrupts; -- ------------------------------ -- Install the SIGINT handler. -- ------------------------------ procedure Install is begin Ada.Interrupts.Attach_Handler (Interrupts.Interrupt'Access, Ada.Interrupts.Names.SIGINT); Log.Info ("Interrupt handler for SIGINT is installed"); end Install; -- ------------------------------ -- Reset the interrupted flag. -- ------------------------------ procedure Clear is begin Interrupts.Clear; end Clear; -- ------------------------------ -- Check if we have been interrupted. -- ------------------------------ function Is_Interrupted return Boolean is begin return Interrupts.Is_Interrupted; end Is_Interrupted; end MAT.Interrupts;
Implement the variables plugin to set variables from wiki text
----------------------------------------------------------------------- -- wiki-plugins-variables -- Variables plugin -- 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 Wiki.Filters.Variables; package body Wiki.Plugins.Variables is -- ------------------------------ -- Set or update a variable in the `Wiki.Filters.Variable` filter. -- ------------------------------ overriding procedure Expand (Plugin : in out Variable_Plugin; Document : in out Wiki.Documents.Document; Params : in out Wiki.Attributes.Attribute_List; Context : in Plugin_Context) is pragma Unreferenced (Plugin, Document); begin if Wiki.Attributes.Length (Params) >= 3 then declare First : Wiki.Attributes.Cursor := Wiki.Attributes.First (Params); Second : Wiki.Attributes.Cursor; begin Wiki.Attributes.Next (First); Second := First; Wiki.Attributes.Next (Second); Wiki.Filters.Variables.Add_Variable (Context.Filters, Wiki.Attributes.Get_Wide_Value (First), Wiki.Attributes.Get_Wide_Value (Second)); end; end if; end Expand; end Wiki.Plugins.Variables;
Add navigation rule unit test
----------------------------------------------------------------------- -- 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;
Implement new test for Parse_Form and register it for execution
----------------------------------------------------------------------- -- util-properties-form-tests -- Test reading JSON file into properties -- 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 Util.Test_Caller; with Util.Files; package body Util.Properties.Form.Tests is package Caller is new Util.Test_Caller (Test, "Properties.Properties.Form"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Properties.Form.Parse_Form", Test_Parse_Form'Access); end Add_Tests; -- Test loading a JSON file into a properties object. procedure Test_Parse_Form (T : in out Test) is procedure Check (Name : in String; Value : in String); P : Util.Properties.Manager; procedure Check (Name : in String; Value : in String) is begin T.Assert (P.Exists (Name), "Missing property: " & Name); Util.Tests.Assert_Equals (T, Value, String '(P.Get (Name)), "Invalid property: " & Name); end Check; Path : constant String := Util.Tests.Get_Test_Path ("regtests/files/test-1.form"); S : Ada.Strings.Unbounded.Unbounded_String; begin Util.Files.Read_File (Path, S); Util.Properties.Form.Parse_Form (P, Ada.Strings.Unbounded.To_String (S)); Check ("access_token", "97356"); Check ("token_type", "bearer"); Check ("refresh_token_expires_in", "15724800"); Check ("refresh_token", "r1.714b6"); Check ("scope", ""); Check ("scope", ""); end Test_Parse_Form; end Util.Properties.Form.Tests;
Implement a simple unit test for the Find operation
----------------------------------------------------------------------- -- babel-base-users-tests - Unit tests for babel users -- 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; package body Babel.Base.Users.Tests is use type Util.Strings.Name_Access; package Caller is new Util.Test_Caller (Test, "Base.Users"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Babel.Base.Users.Find", Test_Find'Access); end Add_Tests; -- ------------------------------ -- Test the Find function resolving some existing user. -- ------------------------------ procedure Test_Find (T : in out Test) is Db : Babel.Base.Users.Database; User : User_Type; begin User := Db.Find (0, 0); T.Assert (User.Name /= null, "User uid=0 was not found"); T.Assert (User.Group /= null, "User gid=0 was not found"); Util.Tests.Assert_Equals (T, "root", User.Name.all, "Invalid root user name"); Util.Tests.Assert_Equals (T, "root", User.Group.all, "Invalid root group name"); end Test_Find; end Babel.Base.Users.Tests;
Implement the widget component factory
----------------------------------------------------------------------- -- 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.Views.Nodes; with ASF.Components.Base; with ASF.Components.Widgets.Inputs; package body ASF.Components.Widgets.Factory is use ASF.Components.Base; function Create_Input return UIComponent_Access; -- ------------------------- -- ------------------------------ -- Create a UIFile component -- ------------------------------ function Create_Input return UIComponent_Access is begin return new ASF.Components.Widgets.Inputs.UIInput; end Create_Input; use ASF.Views.Nodes; URI : aliased constant String := "http://code.google.com/p/ada-asf/widget"; INPUT_TEXT_TAG : aliased constant String := "inputText"; Widget_Bindings : aliased constant ASF.Factory.Binding_Array := (1 => (Name => INPUT_TEXT_TAG'Access, Component => Create_Input'Access, Tag => Create_Component_Node'Access) ); Core_Factory : aliased constant ASF.Factory.Factory_Bindings := (URI => URI'Access, Bindings => Widget_Bindings'Access); -- ------------------------------ -- Get the widget component factory. -- ------------------------------ function Definition return ASF.Factory.Factory_Bindings_Access is begin return Core_Factory'Access; end Definition; end ASF.Components.Widgets.Factory;
Implement the MAT.Events.Tools package with the Find operation
----------------------------------------------------------------------- -- 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. ----------------------------------------------------------------------- package body MAT.Events.Tools is -- ------------------------------ -- 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 is Iter : Target_Event_Cursor := List.First; Event : Target_Event_Type; begin while Target_Event_Vectors.Has_Element (Iter) loop Event := Target_Event_Vectors.Element (Iter); if Event.Index = Kind then return Event; end if; Target_Event_Vectors.Next (Iter); end loop; raise Not_Found; end Find; end MAT.Events.Tools;
Package to read the memory events
----------------------------------------------------------------------- -- Memory Events - Definition and Analysis of memory 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 MAT.Types; with MAT.Events; -- with MAT.Ipc; with Util.Events; with MAT.Readers; with MAT.Memory.Targets; -- with MAT.Memory.Clients; -- with MAT.Ipc.Clients; -- with MAT.Events; use MAT.Events; package MAT.Memory.Readers is type Memory_Servant is new MAT.Readers.Reader_Base with record Data : MAT.Memory.Targets.Client_Memory; -- Slots : Client_Memory_Ref; -- Impl : Client_Memory_Ref; end record; -- The memory servant is a proxy for the generic communication -- channel to process incomming events (such as memory allocations). overriding procedure Dispatch (For_Servant : in out Memory_Servant; Id : in MAT.Events.Internal_Reference; Params : in MAT.Events.Const_Attribute_Table_Access; Msg : in out MAT.Readers.Message); procedure Bind (For_Servant : in out Memory_Servant); -- Bind the servant with the object adapter to register the -- events it recognizes. end MAT.Memory.Readers;
Implement the Rest definition package to dispatch the request to the API handler
----------------------------------------------------------------------- -- 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.Definition is overriding procedure Dispatch (Handler : in Descriptor; Req : in out ASF.Rest.Request'Class; Reply : in out ASF.Rest.Response'Class) is Object : Object_Type; begin Handler.Handler (Object, Req, Reply); end Dispatch; package body Definition is P : aliased String := Pattern; begin Instance.Method := Method; Instance.Permission := Permission; Instance.Handler := Handler; Instance.Pattern := P'Access; ASF.Rest.Register (Entries, Instance'Access); end Definition; end ASF.Rest.Definition;
Add unit tests for MAT.Expressions
----------------------------------------------------------------------- -- mat-expressions-tests -- Unit tests for MAT expressions -- 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 MAT.Expressions.Tests is procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite); type Test is new Util.Tests.Test with null record; procedure Test_Parse_Expression (T : in out Test); end MAT.Expressions.Tests;
Define the generic package for a counter definition
----------------------------------------------------------------------- -- awa-counters-definition -- Counter 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. ----------------------------------------------------------------------- -- The <tt>AWA.Counters.Definition</tt> package is instantiated for each counter definition. generic Table : ADO.Schemas.Class_Mapping_Access; Field : String; package AWA.Counters.Definition is Def_Name : aliased constant String := Field; package Def is new Counter_Arrays.Definition (Counter_Def '(Table, Def_Name'Access)); -- Get the counter definition index. function Index return Counter_Index_Type renames Def.Kind; end AWA.Counters.Definition;
Define the gravatar UI component
----------------------------------------------------------------------- -- components-widgets-gravatars -- Gravatar 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.Components.Html; with ASF.Contexts.Faces; package ASF.Components.Widgets.Gravatars is -- Given an Email address, return the Gravatar link to the user image. -- (See http://en.gravatar.com/site/implement/hash/ and -- http://en.gravatar.com/site/implement/images/) function Get_Link (Email : in String; Secure : in Boolean := False) return String; -- ------------------------------ -- UIGravatar -- ------------------------------ -- The <b>UIGravatar</b> component displays a small image whose link is created -- from a user email address. type UIGravatar is new ASF.Components.Html.UIHtmlComponent with null record; -- Render an image with the source link created from an email address to the Gravatars service. overriding procedure Encode_Begin (UI : in UIGravatar; Context : in out ASF.Contexts.Faces.Faces_Context'Class); end ASF.Components.Widgets.Gravatars;
Add a unit test for HTML filter internals
----------------------------------------------------------------------- -- 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;
Test that ARRAY_RANGE_REF returns an array not an element.
-- 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;
Define new generic package for the REST API definition
----------------------------------------------------------------------- -- 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;
Add the ASIS file $i
------------------------------------------------------------------------------ -- -- -- 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;
Implement new unit test for Parse_Address
----------------------------------------------------------------------- -- 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;
Add OAuth client unit tests
----------------------------------------------------------------------- -- 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;
Define a method and binding for an Ada bean to receive an uploaded file
----------------------------------------------------------------------- -- 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);
Use the Is_Test_Enabled function to ignore or take into account the test when it is added in the testsuite.
----------------------------------------------------------------------- -- 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;
----------------------------------------------------------------------- -- 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;
Implement the To_Html and To_Text functions
----------------------------------------------------------------------- -- 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;
Refactor Node_List and references to use Ada Util general references
----------------------------------------------------------------------- -- 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;
Implement the TOC filter to collect the table of content
----------------------------------------------------------------------- -- 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;
Implement the atomic counters using the gcc builtins __sync_add_and_fetch_4 and __sync_fetch_and_add_4
----------------------------------------------------------------------- -- 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;
Add the ASIS file $i
------------------------------------------------------------------------------ -- -- -- 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;
Add unit tests for JWT
----------------------------------------------------------------------- -- 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;
Add a new test for Compress_Stream using LZMA
----------------------------------------------------------------------- -- 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;
Add a new set of unit tests for the date converter
----------------------------------------------------------------------- -- 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;
Define an ASF Security package
----------------------------------------------------------------------- -- 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;
Backup store to access files (local, remote, ...)
----------------------------------------------------------------------- -- 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;
Implement the Get_Document_Name function for the Google Code wiki syntax
----------------------------------------------------------------------- -- 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;
Implement operations for blob streams
----------------------------------------------------------------------- -- 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;
Implement a new test for the HTML filters internal operations
----------------------------------------------------------------------- -- 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;
Define the Wiki.Utils package with To_Html and To_Text functions
----------------------------------------------------------------------- -- 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;
Declare the TLS package for thread local context support
----------------------------------------------------------------------- -- 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;
Add example for XML serialization
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;
Define the set of string package
----------------------------------------------------------------------- -- 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 => "=");
Implement the unit tests on datasets to verify the creation, insertion and retrieval of datasets through bean interfaces
----------------------------------------------------------------------- -- 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;
Add the ASIS file $i
------------------------------------------------------------------------------ -- -- -- 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;