content
stringlengths
23
1.05M
with ACO.Protocols.Service_Data; package body ACO.Nodes.Remotes is overriding procedure Set_State (This : in out Remote; State : in ACO.States.State) is begin This.NMT.Request_State (State); -- If there is no heartbeat or node guarding, just assume the requested -- state is correct... if This.Od.Get_Heartbeat_Producer_Period = 0 then This.NMT.Set (State); end if; end Set_State; overriding function Get_State (This : Remote) return ACO.States.State is begin return This.NMT.Get; end Get_State; overriding procedure Start (This : in out Remote) is begin This.Handler.Start; end Start; function Is_Complete (This : SDO_Request) return Boolean is begin return ACO.SDO_Sessions.Is_Complete (This.Status); end Is_Complete; procedure Suspend_Until_Result (This : in out SDO_Request; Result : out SDO_Result) is begin if This.Id in ACO.SDO_Sessions.Valid_Endpoint_Nr then declare Request : Request_Data renames This.Node.SDO.Requests (This.Id); begin Ada.Synchronous_Task_Control.Suspend_Until_True (Request.Suspension); Result := Request.Status; end; else Result := ACO.SDO_Sessions.Error; end if; end Suspend_Until_Result; procedure Suspend_Until_Result (This : in out SDO_Read_Request; Result : out SDO_Result) is begin SDO_Request (This).Suspend_Until_Result (Result); case Result is when ACO.SDO_Sessions.Complete => This.Get_Entry; when ACO.SDO_Sessions.Error => This.Node.SDO.Clear (This.Id); end case; end Suspend_Until_Result; procedure Get_Entry (This : in out SDO_Read_Request) is begin This.Node.SDO.Get_Read_Entry (This.Id, This.To_Entry.all); This.Node.SDO.Clear (This.Id); end Get_Entry; function Status (This : SDO_Request) return SDO_Status is begin if This.Id in ACO.SDO_Sessions.Valid_Endpoint_Nr then return This.Node.SDO.Requests (This.Id).Status; else return ACO.SDO_Sessions.Error; end if; end Status; procedure Write (This : in out Remote; Request : in out SDO_Write_Request'Class; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; An_Entry : in ACO.OD_Types.Entry_Base'Class) is begin This.SDO.Write_Remote_Entry (Node => This.Id, Index => Index, Subindex => Subindex, An_Entry => An_Entry, Endpoint_Id => Request.Id); if Request.Id in ACO.SDO_Sessions.Valid_Endpoint_Nr'Range then declare Req_Data : Request_Data renames This.SDO.Requests (Request.Id); begin Req_Data.Status := ACO.SDO_Sessions.Pending; Req_Data.Operation := Write; Ada.Synchronous_Task_Control.Set_False (Req_Data.Suspension); end; end if; end Write; overriding procedure Write (This : in out Remote; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; An_Entry : in ACO.OD_Types.Entry_Base'Class) is Request : SDO_Write_Request (This'Access); begin This.Write (Request => Request, Index => Index, Subindex => Subindex, An_Entry => An_Entry); declare Result : SDO_Result; begin Request.Suspend_Until_Result (Result); end; end Write; overriding procedure Read (This : in out Remote; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; To_Entry : out ACO.OD_Types.Entry_Base'Class) is Result : ACO.Nodes.Remotes.SDO_Result; begin This.Read (Index => Index, Subindex => Subindex, Result => Result, To_Entry => To_Entry); case Result is when ACO.SDO_Sessions.Complete => null; when ACO.SDO_Sessions.Error => raise Failed_To_Read_Entry_Of_Node with Result'Img & " index =" & Index'Img; end case; end Read; procedure Read (This : in out Remote; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; Result : out ACO.Nodes.Remotes.SDO_Result; To_Entry : out ACO.OD_Types.Entry_Base'Class) is Request : ACO.Nodes.Remotes.SDO_Read_Request (This'Access, To_Entry'Access); begin This.Read (Request => Request, Index => Index, Subindex => Subindex); Request.Suspend_Until_Result (Result); end Read; procedure Read (This : in out Remote; Request : in out SDO_Read_Request'Class; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex) is begin This.SDO.Read_Remote_Entry (Node => This.Id, Index => Index, Subindex => Subindex, Endpoint_Id => Request.Id); if Request.Id in ACO.SDO_Sessions.Valid_Endpoint_Nr'Range then declare Req_Data : Request_Data renames This.SDO.Requests (Request.Id); begin Req_Data.Status := ACO.SDO_Sessions.Pending; Req_Data.Operation := Read; Ada.Synchronous_Task_Control.Set_False (Req_Data.Suspension); end; end if; end Read; function Generic_Read (This : in out Remote; Index : ACO.OD_Types.Object_Index; Subindex : ACO.OD_Types.Object_Subindex) return Entry_T is An_Entry : aliased Entry_T; Request : ACO.Nodes.Remotes.SDO_Read_Request (This'Access, An_Entry'Access); Result : ACO.Nodes.Remotes.SDO_Result; begin This.Read (Request => Request, Index => Index, Subindex => Subindex); Request.Suspend_Until_Result (Result); if not Request.Is_Complete then raise Failed_To_Read_Entry_Of_Node with Result'Img & " index =" & Index'Img; end if; return An_Entry; end Generic_Read; procedure Set_Heartbeat_Timeout (This : in out Remote; Timeout : in Natural) is begin This.NMT.Set_Heartbeat_Timeout (Timeout); end Set_Heartbeat_Timeout; procedure On_Message_Dispatch (This : in out Remote; Msg : in ACO.Messages.Message) is begin if This.NMT.Is_Valid (Msg) then This.NMT.Message_Received (Msg); elsif This.EC.Is_Valid (Msg) then This.EC.Message_Received (Msg); elsif This.SDO.Is_Valid (Msg) then This.SDO.Message_Received (Msg); end if; end On_Message_Dispatch; procedure Periodic_Actions (This : in out Remote; T_Now : in Ada.Real_Time.Time) is begin This.NMT.Periodic_Actions (T_Now); This.SDO.Periodic_Actions (T_Now); end Periodic_Actions; overriding procedure Result_Callback (This : in out Remote_Client; Session : in ACO.SDO_Sessions.SDO_Session; Result : in ACO.SDO_Sessions.SDO_Result) is Request : Request_Data renames This.Requests (Session.Endpoint.Id); begin Request.Status := Result; case Request.Operation is when Write => This.Clear (Session.Endpoint.Id); when Read => null; end case; Ada.Synchronous_Task_Control.Set_True (Request.Suspension); This.Od.Events.Node_Events.Put ((Event => ACO.Events.SDO_Status_Update, SDO_Status => (Endpoint_Id => Session.Endpoint.Id, Result => Result))); end Result_Callback; overriding function Tx_CAN_Id (This : Remote_Client; Parameter : ACO.SDO_Sessions.SDO_Parameters) return ACO.Messages.Id_Type is (Parameter.CAN_Id_C2S); overriding function Rx_CAN_Id (This : Remote_Client; Parameter : ACO.SDO_Sessions.SDO_Parameters) return ACO.Messages.Id_Type is (Parameter.CAN_Id_S2C); overriding function Get_Endpoint (This : Remote_Client; Rx_CAN_Id : ACO.Messages.Id_Type) return ACO.SDO_Sessions.Endpoint_Type is use type ACO.Messages.Id_Type; -- Clients always initiate a session and a remote client always use the -- default mandatory Id's, meaning we should make sure we use the same -- endpoint as when we sent the initial request... Endpoint : constant ACO.SDO_Sessions.Endpoint_Type := This.Get_Endpoint (Server_Node => This.Id); begin if This.Rx_CAN_Id (Endpoint.Parameters) = Rx_CAN_Id then return Endpoint; else return ACO.SDO_Sessions.No_Endpoint; end if; end Get_Endpoint; overriding function Get_Endpoint (This : Remote_Client; Server_Node : ACO.Messages.Node_Nr) return ACO.SDO_Sessions.Endpoint_Type is use type ACO.Messages.Id_Type; -- As a remote client we only know the OD of the server, therefore we can -- use any of the C2S-Id's of the server. -- But the mandatory Server-Rx-Id is a good choice... Tx_CAN_Id : constant ACO.Messages.CAN_Id_Type := (As_Id => False, Code => ACO.Protocols.Service_Data.SDO_C2S_Id, Node => Server_Node); I : ACO.SDO_Sessions.Endpoint_Nr := ACO.SDO_Sessions.Valid_Endpoint_Nr'First; begin for P of This.Od.Get_SDO_Server_Parameters loop if This.Tx_CAN_Id (P) = Tx_CAN_Id.Id then return (Id => I, Parameters => P); end if; I := ACO.SDO_Sessions.Endpoint_Nr'Succ (I); end loop; return ACO.SDO_Sessions.No_Endpoint; end Get_Endpoint; end ACO.Nodes.Remotes;
pragma SPARK_Mode; with System; with Proc_Types; use Proc_Types; package body Pwm is TCCR1A : Register with Address => System'To_Address (16#80#); TCCR1B : Register with Address => System'To_Address (16#81#); ICR1 : Double_Register with Address => System'To_Address (16#86#); OCR1A : Double_Register with Address => System'To_Address (16#88#); OCR1B : Double_Register with Address => System'To_Address (16#8A#); procedure Configure_Timers is begin -- Timer 1 configuration -- prescaler: clockI/O / 1 -- outputs enabled -- phase-correct PWM -- top of 400 -- -- PWM frequency calculation -- 16MHz / 1 (prescaler) / 2 (phase-correct) / 400 (top) = 20kHz TCCR1A := 2#1010_0000#; TCCR1B := 2#0001_0001#; ICR1 := 400; end Configure_Timers; procedure SetRate (Index : Pwm_Index; Value : Word) is begin case Index is when Left => OCR1B := Double_Register (Value); when Right => OCR1A := Double_Register (Value); end case; end SetRate; end Pwm;
pragma License (Unrestricted); -- extended unit with Interfaces.C.Generic_Strings; with Interfaces.C.WChar_Pointers; package Interfaces.C.Wide_WStrings is new Generic_Strings ( Character_Type => Wide_Character, String_Type => Wide_String, Element => wchar_t, Element_Array => wchar_array, Pointers => WChar_Pointers, To_C => To_wchar_array, To_Ada => To_Wide_String); -- Wide_String and wchar_t version of Interfaces.C.Strings. pragma Preelaborate (Interfaces.C.Wide_WStrings);
with Ada.Integer_Text_IO; with Ada.Text_IO; package body Problem_11 is package IO renames Ada.Text_IO; package I_IO renames Ada.Integer_Text_IO; procedure Solve is type Row is new Positive range 1 .. 20; type Column is new Positive range 1 .. 20; type Grid is Array(Row range <>, Column range <>) of Natural; table : constant Grid := (( 8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8), (49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0), (81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65), (52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91), (22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80), (24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50), (32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70), (67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21), (24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72), (21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95), (78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92), (16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57), (86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58), (19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40), ( 4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66), (88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69), ( 4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36), (20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16), (20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54), ( 1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48)); function Check_Right(r : in Row; c: in Column) return Natural is begin if c + 3 > Column'Last then return 0; end if; return table(r,c) * table(r,c+1) * table(r,c+2) * table(r,c+3); end Check_Right; function Check_Down(r: in Row; c: in Column) return Natural is begin if r + 3 > Row'Last then return 0; end if; return table(r,c) * table(r+1,c) * table(r+2,c) * table(r+3,c); end Check_Down; function Check_Left_Down(r: in Row; c: in Column) return Natural is begin if c - 3 < Column'First or r + 3 > Row'Last then return 0; end if; return table(r,c) * table(r+1,c-1) * table(r+2,c-2) * table(r+3,c-3); end Check_Left_Down; function Check_Right_Down(r: in row; c: in Column) return Natural is begin if c + 3 > Column'Last or r + 3 > Row'Last then return 0; end if; return table(r,c) * table(r+1,c+1) * table(r+2,c+2) * table(r+3,c+3); end Check_Right_Down; best : Natural := 0; begin for r in Row loop for c in Column loop declare right : constant Natural := Check_Right(r, c); down : constant Natural := Check_Down(r, c); left_down : constant Natural := Check_Left_Down(r, c); right_down : constant Natural := Check_Right_Down(r, c); begin if right > best then best := right; end if; if down > best then best := down; end if; if left_down > best then best := left_down; end if; if right_down > best then best := right_down; end if; end; end loop; end loop; I_IO.Put(best); IO.New_Line; end Solve; end Problem_11;
package body ACO.Events is procedure Process (This : in out Node_Event_Manager) is begin This.Node_Events.Process; end Process; overriding procedure Update (This : access Handler_Event_Listener; Data : in Handler_Event_Data) is type Ref is access all Handler_Event_Listener'Class; begin if This.Event = Data.Event then Ref (This).On_Event (Data); end if; end Update; overriding procedure Update (This : access Event_Listener; Data : in Event_Data) is type Ref is access all Event_Listener'Class; begin if This.Event = Data.Event then Ref (This).On_Event (Data); end if; end Update; end ACO.Events;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . C O N F -- -- -- -- S p e c -- -- -- -- Copyright (C) 2006-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- The following package manipulates the configuration files with Prj.Tree; with Prj.Proc; package Prj.Conf is type Config_File_Hook is access procedure (Config_File : in out Prj.Tree.Project_Node_Id; Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref); -- Hook called after the config file has been parsed. This lets the -- application do last minute changes to it (GPS uses this to add the -- default naming schemes for instance). At that point, the config file -- has not been applied to the project yet. When no config file was found, -- and automatic generation is disabled, it is possible that Config_File -- is set to Empty_Node when this procedure is called. You can then decide -- to create a new config file if you need. No_Configuration_File : constant String := "/"; -- When specified as a parameter Config_File_Name in the procedures below, -- no existing configuration project file is parsed. This is used by -- gnatmake, gnatclean and the GNAT driver to avoid parsing an existing -- default configuration project file. procedure Parse_Project_And_Apply_Config (Main_Project : out Prj.Project_Id; User_Project_Node : out Prj.Tree.Project_Node_Id; Config_File_Name : String := ""; Autoconf_Specified : Boolean; Project_File_Name : String; Project_Tree : Prj.Project_Tree_Ref; Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref; Env : in out Prj.Tree.Environment; Packages_To_Check : String_List_Access; Allow_Automatic_Generation : Boolean := True; Automatically_Generated : out Boolean; Config_File_Path : out String_Access; Target_Name : String := ""; Normalized_Hostname : String; On_Load_Config : Config_File_Hook := null; Implicit_Project : Boolean := False; On_New_Tree_Loaded : Prj.Proc.Tree_Loaded_Callback := null); -- Find the main configuration project and parse the project tree rooted at -- this configuration project. -- -- Project_Node_Tree must have been initialized first (and possibly the -- value for external references and project path should also have been -- set). -- -- If the processing fails, Main_Project is set to No_Project. If the error -- happened while parsing the project itself (i.e. creating the tree), -- User_Project_Node is also set to Empty_Node. -- -- If Config_File_Name is No_Configuration_File, then no configuration -- project file is parsed. Normally, in this case On_Load_Config is not -- null, and it is used to create a configuration project file in memory. -- -- Autoconf_Specified indicates whether the user has specified --autoconf. -- If this is the case, the config file might be (re)generated, as -- appropriate, to match languages and target if the one specified doesn't -- already match. -- -- Normalized_Hostname is the host on which gprbuild is returned, -- normalized so that we can more easily compare it with what is stored in -- configuration files. It is used when the target is unspecified, although -- we need to know the target specified by the user (Target_Name) when -- computing the name of the default config file that should be used. -- -- If specified, On_Load_Config is called just after the config file has -- been created/loaded. You can then modify it before it is later applied -- to the project itself. -- -- Any error in generating or parsing the config file is reported via the -- Invalid_Config exception, with an appropriate message. Any error while -- parsing the project file results in No_Project. -- -- If Implicit_Project is True, the main project file being parsed is -- deemed to be in the current working directory, even if it is not the -- case. Implicit_Project is set to True when a tool such as gprbuild is -- invoked without a project file and is using an implicit project file -- that is virtually in the current working directory, but is physically -- in another directory. -- -- If specified, On_New_Tree_Loaded is called after each aggregated project -- has been processed succesfully. procedure Process_Project_And_Apply_Config (Main_Project : out Prj.Project_Id; User_Project_Node : Prj.Tree.Project_Node_Id; Config_File_Name : String := ""; Autoconf_Specified : Boolean; Project_Tree : Prj.Project_Tree_Ref; Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref; Env : in out Prj.Tree.Environment; Packages_To_Check : String_List_Access; Allow_Automatic_Generation : Boolean := True; Automatically_Generated : out Boolean; Config_File_Path : out String_Access; Target_Name : String := ""; Normalized_Hostname : String; On_Load_Config : Config_File_Hook := null; Reset_Tree : Boolean := True; On_New_Tree_Loaded : Prj.Proc.Tree_Loaded_Callback := null; Do_Phase_1 : Boolean := True); -- Same as above, except the project must already have been parsed through -- Prj.Part.Parse, and only the processing of the project and the -- configuration is done at this level. -- -- If Reset_Tree is true, all projects are first removed from the tree. -- When_No_Sources indicates what should be done when no sources are found -- for one of the languages of the project. -- -- If Require_Sources_Other_Lang is true, then all languages must have at -- least one source file, or an error is reported via When_No_Sources. If -- it is false, this is only required for Ada (and only if it is a language -- of the project). -- -- If Do_Phase_1 is False, then Prj.Proc.Process_Project_Tree_Phase_1 -- should not be called, as it has already been invoked successfully. Invalid_Config : exception; procedure Get_Or_Create_Configuration_File (Project : Prj.Project_Id; Conf_Project : Project_Id; Project_Tree : Prj.Project_Tree_Ref; Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref; Env : in out Prj.Tree.Environment; Allow_Automatic_Generation : Boolean; Config_File_Name : String := ""; Autoconf_Specified : Boolean; Target_Name : String := ""; Normalized_Hostname : String; Packages_To_Check : String_List_Access := null; Config : out Prj.Project_Id; Config_File_Path : out String_Access; Automatically_Generated : out Boolean; On_Load_Config : Config_File_Hook := null); -- Compute the name of the configuration file that should be used. If no -- default configuration file is found, a new one will be automatically -- generated if Allow_Automatic_Generation is true. This configuration -- project file will be generated in the object directory of project -- Conf_Project. -- -- Any error in generating or parsing the config file is reported via the -- Invalid_Config exception, with an appropriate message. -- -- On exit, Configuration_Project_Path is never null (if none could be -- found, Os.Fail was called and the program exited anyway). -- -- The choice and generation of a configuration file depends on several -- attributes of the user's project file (given by the Project argument), -- e.g. list of languages that must be supported. Project must therefore -- have been partially processed (phase one of the processing only). -- -- Config_File_Name should be set to the name of the config file specified -- by the user (either through gprbuild's --config or --autoconf switches). -- In the latter case, Autoconf_Specified should be set to true to indicate -- that the configuration file can be regenerated to match target and -- languages. This name can either be an absolute path, or the base name -- that will be searched in the default config file directories (which -- depends on the installation path for the tools). -- -- Target_Name is used to chose the configuration file that will be used -- from among several possibilities. -- -- If a project file could be found, it is automatically parsed and -- processed (and Packages_To_Check is used to indicate which packages -- should be processed). procedure Add_Default_GNAT_Naming_Scheme (Config_File : in out Prj.Tree.Project_Node_Id; Project_Tree : Prj.Tree.Project_Node_Tree_Ref); -- A hook that will create a new config file (in memory), used for -- Get_Or_Create_Configuration_File and Process_Project_And_Apply_Config -- and add the default GNAT naming scheme to it. Nothing is done if the -- config_file already exists, to avoid overriding what the user might -- have put in there. -------------- -- Runtimes -- -------------- procedure Set_Runtime_For (Language : Name_Id; RTS_Name : String); -- Specifies the runtime to use for a specific language. Most of the time -- this should be used for Ada, but other languages can also specify their -- own runtime. This is in general specified via the --RTS command line -- switch, and results in a specific component passed to gprconfig's -- --config switch then automatically generating a configuration file. function Runtime_Name_For (Language : Name_Id) return String; -- Returns the runtime name for a language. Returns an empty string if no -- runtime was specified for the language using option --RTS. function Runtime_Name_Set_For (Language : Name_Id) return Boolean; -- Returns True only if Set_Runtime_For has been called for the Language end Prj.Conf;
-- Copyright (C) 2019 Thierry Rascle <thierr26@free.fr> -- MIT license. Please refer to the LICENSE file. with Ada.Tags; use Ada.Tags; with Apsepp.Test_Node_Class.Testing; use Apsepp.Test_Node_Class.Testing; with Apsepp.Abstract_Early_Test_Case; use Apsepp.Abstract_Early_Test_Case; package Apsepp_Test_Node_Class_Early_Test_Case is function Expected_Routine_State_Array return Routine_State_Array; function Routine_State_Array_To_Tag_Array (A : Routine_State_Array) return Tag_Array with Post => Routine_State_Array_To_Tag_Array'Result'First = A'First and then Routine_State_Array_To_Tag_Array'Result'Length = A'Length and then (for all K in A'Range => Routine_State_Array_To_Tag_Array'Result(K) = A(K).T); type Apsepp_Test_Node_Class_E_T_C is limited new Early_Test_Case with null record; overriding function Early_Routine (Obj : Apsepp_Test_Node_Class_E_T_C) return Test_Routine; end Apsepp_Test_Node_Class_Early_Test_Case;
with System.Storage_Elements; package body GNAT.Debug_Utilities is function Value (S : String) return System.Address is begin return System.Storage_Elements.To_Address ( System.Storage_Elements.Integer_Address'Value (S)); end Value; end GNAT.Debug_Utilities;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Slim.Players; with League.String_Vectors; with League.Strings; package Slim.Menu_Commands.Play_File_Commands is type Play_File_Command (Player : Slim.Players.Player_Access) is new Menu_Command with record Root : League.Strings.Universal_String; M3U_Name : League.Strings.Universal_String; Start : Positive; -- Item to play Skip : Natural := 0; -- Skip seconds in the first file Relative_Path_List : League.String_Vectors.Universal_String_Vector; Title_List : League.String_Vectors.Universal_String_Vector; end record; type Play_File_Command_Access is access all Play_File_Command'Class; overriding procedure Run (Self : Play_File_Command); end Slim.Menu_Commands.Play_File_Commands;
-- convert UCD/extracted/DerivedEastAsianWidth.txt -- bin/ucd_eastasianwidth $UCD/extracted/DerivedEastAsianWidth.txt > ../source/strings/a-ueaswi.ads with Ada.Command_Line; use Ada.Command_Line; with Ada.Containers.Ordered_Maps; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Ada.Strings; use Ada.Strings; with Ada.Strings.Bounded; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; with Ada.Text_IO; use Ada.Text_IO; procedure ucd_eastasianwidth is function Value (S : String) return Wide_Wide_Character is Img : constant String := "Hex_" & (1 .. 8 - S'Length => '0') & S; begin return Wide_Wide_Character'Value (Img); end Value; procedure Put_16 (Item : Integer) is begin if Item >= 16#10000# then Put (Item, Width => 1, Base => 16); else declare S : String (1 .. 8); -- "16#XXXX#" begin Put (S, Item, Base => 16); S (1) := '1'; S (2) := '6'; S (3) := '#'; for I in reverse 4 .. 6 loop if S (I) = '#' then S (4 .. I) := (others => '0'); exit; end if; end loop; Put (S); end; end if; end Put_16; package EAW_Property_Names is new Ada.Strings.Bounded.Generic_Bounded_Length (2); use type EAW_Property_Names.Bounded_String; package CP2EAW_Maps is new Ada.Containers.Ordered_Maps (Wide_Wide_Character, EAW_Property_Names.Bounded_String); use CP2EAW_Maps; Table : aliased CP2EAW_Maps.Map; type Bit is (In_XXXX, In_1XXXX, In_XXXXXXXX); Num : array (Bit) of Natural; begin declare File : Ada.Text_IO.File_Type; begin Open (File, In_File, Argument (1)); while not End_Of_File (File) loop declare Line : constant String := Get_Line (File); P : Positive := Line'First; Next : Natural; Token_First : Positive; Token_Last : Natural; First, Last : Wide_Wide_Character; EAW : EAW_Property_Names.Bounded_String; begin if Line'Length = 0 or else Line (P) = '#' then null; -- comment else Find_Token ( Line (P .. Line'Last), Hexadecimal_Digit_Set, Inside, Token_First, Token_Last); if Token_First /= P then raise Data_Error with Line & " -- A"; end if; First := Value (Line (Token_First .. Token_Last)); P := Token_Last + 1; if Line (P) = '.' and then Line (P + 1) = '.' then P := P + 2; Find_Token ( Line (P .. Line'Last), Hexadecimal_Digit_Set, Inside, Token_First, Token_Last); if Token_First /= P then raise Data_Error with Line & " -- B"; end if; Last := Value (Line (Token_First .. Token_Last)); P := Token_Last + 1; else Last := First; end if; Next := Index_Non_Blank (Line (P .. Line'Last)); if Next = 0 or else Line (Next) /= ';' then raise Data_Error with Line & " -- C"; end if; P := Next + 1; -- skip ';' Next := Index_Non_Blank (Line (P .. Line'Last)); if Next = 0 then raise Data_Error with Line & " -- D"; end if; P := Next; Find_Token ( Line (P .. Line'Last), Letter_Set, Inside, Token_First, Token_Last); if Token_First /= P then raise Data_Error with Line & " -- E"; end if; EAW_Property_Names.Set_Bounded_String ( EAW, Line (Token_First .. Token_Last)); if EAW /= "N" then for I in First .. Last loop Insert (Table, I, EAW); end loop; end if; end if; end; end loop; Close (File); end; declare I : CP2EAW_Maps.Cursor := First (Table); begin for I in Num'Range loop Num (I) := 0; end loop; while Has_Element (I) loop declare EAW : EAW_Property_Names.Bounded_String := Element (I); L : CP2EAW_Maps.Cursor := I; N : CP2EAW_Maps.Cursor := Next (I); begin while Has_Element (N) and then Key (N) = Wide_Wide_Character'Succ (Key (L)) and then Element (N) = EAW loop L := N; N := Next (N); end loop; if Key (L) <= Wide_Wide_Character'Val (16#FFFF#) then Num (In_XXXX) := Num (In_XXXX) + Integer'( Wide_Wide_Character'Pos (Key (L)) - Wide_Wide_Character'Pos (Key (I)) + 1 + (2 ** 13 - 1)) / 2 ** 13; elsif Key (L) <= Wide_Wide_Character'Val (16#1FFFF#) then Num (In_1XXXX) := Num (In_1XXXX) + 1; else Num (In_XXXXXXXX) := Num (In_XXXXXXXX) + 1; end if; I := N; end; end loop; end; Put_Line ("pragma License (Unrestricted);"); Put_Line ("-- implementation unit, translated from DerivedEastAsianWidth.txt"); Put_Line ("package Ada.UCD.East_Asian_Width is"); Put_Line (" pragma Pure;"); New_Line; Put_Line (" type Run_Length_13 is mod 2 ** 13;"); Put_Line (" type Run_Length_29 is mod 2 ** 29;"); New_Line; Put_Line (" type Table_16_Item_Type is record"); Put_Line (" Start : UCS_2;"); Put_Line (" Length : Run_Length_13;"); Put_Line (" Width : East_Asian_Width_Type;"); Put_Line (" end record;"); Put_Line (" pragma Suppress_Initialization (Table_16_Item_Type);"); Put_Line (" for Table_16_Item_Type'Size use 32; -- 16 + 13 + 3"); Put_Line (" for Table_16_Item_Type use record"); Put_Line (" Start at 0 range 0 .. 15;"); Put_Line (" Length at 0 range 16 .. 28;"); Put_Line (" Width at 0 range 29 .. 31;"); Put_Line (" end record;"); New_Line; Put_Line (" type Table_16_Type is array (Positive range <>) of Table_16_Item_Type;"); Put_Line (" pragma Suppress_Initialization (Table_16_Type);"); Put_Line (" for Table_16_Type'Component_Size use 32;"); New_Line; Put_Line (" type Table_32_Item_Type is record"); Put_Line (" Start : UCS_4;"); Put_Line (" Length : Run_Length_29;"); Put_Line (" Width : East_Asian_Width_Type;"); Put_Line (" end record;"); Put_Line (" pragma Suppress_Initialization (Table_32_Item_Type);"); Put_Line (" for Table_32_Item_Type'Size use 64; -- 32 + 29 + 3"); Put_Line (" for Table_32_Item_Type use record"); Put_Line (" Start at 0 range 0 .. 31;"); Put_Line (" Length at 0 range 32 .. 60;"); Put_Line (" Width at 0 range 61 .. 63;"); Put_Line (" end record;"); New_Line; Put_Line (" type Table_32_Type is array (Positive range <>) of Table_32_Item_Type;"); Put_Line (" pragma Suppress_Initialization (Table_32_Type);"); Put_Line (" for Table_32_Type'Component_Size use 64;"); New_Line; Put (" subtype Table_XXXX_Type is Table_16_Type (1 .. "); Put (Num (In_XXXX), Width => 1); Put (");"); New_Line; New_Line; Put (" subtype Table_1XXXX_Type is Table_16_Type ("); Put (Num (In_XXXX) + 1, Width => 1); Put (" .. "); Put (Num (In_XXXX) + Num (In_1XXXX), Width => 1); Put (");"); New_Line; New_Line; Put (" subtype Table_XXXXXXXX_Type is Table_32_Type ("); Put (Num (In_XXXX) + Num (In_1XXXX) + 1, Width => 1); Put (" .. "); Put (Num (In_XXXX) + Num (In_1XXXX) + Num (In_XXXXXXXX), Width => 1); Put (");"); New_Line; New_Line; Put_Line (" Table_XXXX : constant Table_XXXX_Type := ("); declare State : Bit := In_XXXX; Offset : Integer := 0; I : CP2EAW_Maps.Cursor := First (Table); begin while Has_Element (I) loop declare EAW : EAW_Property_Names.Bounded_String renames Table.Constant_Reference (I).Element.all; L : CP2EAW_Maps.Cursor := I; N : CP2EAW_Maps.Cursor := Next (I); begin while Has_Element (N) and then Key (N) = Wide_Wide_Character'Succ (Key (L)) and then Element (N) = EAW loop L := N; N := Next (N); exit when State = In_XXXX and then Wide_Wide_Character'Pos (Key (L)) - Wide_Wide_Character'Pos (Key (I)) + 1 = 2 ** 13 - 1; end loop; Put (" ("); Put_16 (Wide_Wide_Character'Pos (Key (I)) - Offset); Put (", "); Put ( Integer'(Wide_Wide_Character'Pos (Key (L))) - Integer'(Wide_Wide_Character'Pos (Key (I))) + 1, Width => 1); Put (", "); Put (EAW_Property_Names.To_String (EAW)); Put (")"); if Has_Element (N) then if State = In_XXXX and then Key (N) > Wide_Wide_Character'Val (16#FFFF#) then State := In_1XXXX; Offset := 16#10000#; Put (");"); New_Line; New_Line; Put_Line (" Table_1XXXX : constant Table_1XXXX_Type := ("); elsif State = In_1XXXX and then Key (N) > Wide_Wide_Character'Val (16#1FFFF#) then State := In_XXXXXXXX; Offset := 0; Put (");"); New_Line; New_Line; Put_Line (" Table_XXXXXXXX : constant Table_XXXXXXXX_Type := ("); else Put (","); New_Line; end if; else Put (");"); New_Line; end if; I := N; end; end loop; end; New_Line; Put_Line ("end Ada.UCD.East_Asian_Width;"); end ucd_eastasianwidth;
-- ----------------------------------------------------------------- -- -- -- -- This is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public -- -- License as published by the Free Software Foundation; either -- -- version 2 of the License, or (at your option) any later version. -- -- -- -- This software is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- General Public License for more details. -- -- -- -- You should have received a copy of the GNU General Public -- -- License along with this library; if not, write to the -- -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- -- Boston, MA 02111-1307, USA. -- -- -- -- ----------------------------------------------------------------- -- -- ----------------------------------------------------------------- -- -- This is a translation, to the Ada programming language, of the -- -- original C test files written by Sam Lantinga - www.libsdl.org -- -- translation made by Antonio F. Vargas - www.adapower.net/~avargas -- -- ----------------------------------------------------------------- -- with Interfaces.C; with Interfaces.C.Strings; with Ada.Command_Line; with SDL.Video; with SDL.Events; package TestGL_Sprogs is package V renames SDL.Video; package Ev renames SDL.Events; package C renames Interfaces.C; package CS renames Interfaces.C.Strings; package CL renames Ada.Command_Line; procedure HotKey_ToggleFullScreen; procedure HotKey_ToggleGrab; procedure HotKey_Iconify; procedure RunGLTest (video_flags : in out V.Surface_Flags; logo : Boolean; slowly : Boolean; bppixel : C.int; gamma : C.C_float); end TestGL_Sprogs;
package openGL.Viewport -- -- Models an opendGL viewport. -- is function Extent return Extent_2d; procedure Extent_is (Now : in Extent_2d); end openGL.Viewport;
--=========================================================================== -- -- This is the main master program for the Tiny as an SPI Master -- --=========================================================================== -- -- Copyright 2022 (C) Holger Rodriguez -- -- SPDX-License-Identifier: BSD-3-Clause -- with HAL; with HAL.I2C; with RP.GPIO; with RP.I2C_Master; with RP.Device; with Tiny; procedure I2C is -------------------------------------------------------------------------- -- I2C 0 I2C_0 : RP.I2C_Master.I2C_Master_Port renames Tiny.I2C_0; SCL_0 : RP.GPIO.GPIO_Point renames Tiny.SCL_0_1; SDA_0 : RP.GPIO.GPIO_Point renames Tiny.SDA_0_0; -------------------------------------------------------------------------- -- I2C 1 I2C_1 : RP.I2C_Master.I2C_Master_Port renames Tiny.I2C_1; SCL_1 : RP.GPIO.GPIO_Point renames Tiny.SCL_1_3; SDA_1 : RP.GPIO.GPIO_Point renames Tiny.SDA_1_2; -------------------------------------------------------------------------- -- Selection of I2C to use I2C : RP.I2C_Master.I2C_Master_Port renames I2C_0; SCL : RP.GPIO.GPIO_Point renames SCL_0; SDA : RP.GPIO.GPIO_Point renames SDA_0; -------------------------------------------------------------------------- -- Definition of trigger port Trigger : RP.GPIO.GPIO_Point renames Tiny.GP7; procedure I2C_Initialize is begin SDA.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.I2C); SCL.Configure (RP.GPIO.Output, RP.GPIO.Pull_Up, RP.GPIO.I2C); I2C.Configure (Baudrate => 100_000); end I2C_Initialize; Address : constant HAL.I2C.I2C_Address := 16#5A#; Data : HAL.I2C.I2C_Data (1 .. 1); Status : HAL.I2C.I2C_Status; begin Tiny.Initialize; I2C_Initialize; Trigger.Configure (RP.GPIO.Output); loop -- construct the values for the transmission for Byte in HAL.UInt8'Range loop Data (1) := Byte; Data (1) := 16#55#; Trigger.Clear; if True then I2C.Master_Transmit (Addr => Address, Data => Data, Status => Status, Timeout => 0); else I2C.Mem_Write (Addr => Address, Mem_Addr => 16#55#, Mem_Addr_Size => HAL.I2C.Memory_Size_8b, Data => Data, Status => Status, Timeout => 0); end if; Trigger.Set; -- RP.Device.Timer.Delay_Milliseconds (10); Tiny.LED_Red.Toggle; end loop; end loop; end I2C;
with Ada.Command_Line; with Ada.Exceptions; with Ada.Text_IO; with OpenAL.Context; with OpenAL.Global; with OpenAL.List; package body OpenAL_Info is package AL_Context renames OpenAL.Context; package AL_Global renames OpenAL.Global; package AL_String_Vectors renames OpenAL.List.String_Vectors; package Command_Line renames Ada.Command_Line; package Exceptions renames Ada.Exceptions; package Natural_IO is new Ada.Text_IO.Integer_IO (Natural); package Text_IO renames Ada.Text_IO; Device : AL_Context.Device_t; Context : AL_Context.Context_t; Error : exception; use type AL_Context.Device_t; use type AL_Context.Context_t; procedure Versions; -- -- Defaults. -- procedure Defaults is begin Text_IO.Put ("Default playback : "); Text_IO.Put (AL_Context.Get_Default_Device_Specifier); Text_IO.New_Line; Text_IO.Put ("Default capture : "); Text_IO.Put (AL_Context.Get_Default_Capture_Device_Specifier); Text_IO.New_Line; end Defaults; -- -- Finish. -- procedure Finish is begin AL_Context.Destroy_Context (Context); AL_Context.Close_Device (Device); end Finish; -- -- Init. -- procedure Init is begin Natural_IO.Default_Width := 0; end Init; -- -- Capture devices. -- procedure List_Capture_Devices is Devices : AL_String_Vectors.Vector; procedure Process_Element (Device : in String) is begin Text_IO.Put_Line (" " & Device); end Process_Element; begin Text_IO.Put_Line ("Capture devices :"); Devices := AL_Context.Get_Available_Capture_Devices; for Index in AL_String_Vectors.First_Index (Devices) .. AL_String_Vectors.Last_Index (Devices) loop AL_String_Vectors.Query_Element (Devices, Index, Process_Element'Access); end loop; end List_Capture_Devices; -- -- Playback devices. -- procedure List_Playback_Devices is Devices : AL_String_Vectors.Vector; procedure Process_Element (Device : in String) is begin Text_IO.Put_Line (" " & Device); end Process_Element; begin Text_IO.Put_Line ("Playback devices :"); Devices := AL_Context.Get_Available_Playback_Devices; for Index in AL_String_Vectors.First_Index (Devices) .. AL_String_Vectors.Last_Index (Devices) loop AL_String_Vectors.Query_Element (Devices, Index, Process_Element'Access); end loop; end List_Playback_Devices; -- -- Open_Device. -- procedure Open_Device is begin Command_Line.Set_Exit_Status (Command_Line.Failure); Device := AL_Context.Open_Default_Device; if Device /= AL_Context.Invalid_Device then Context := AL_Context.Create_Context (Device); if Context /= AL_Context.Invalid_Context then if AL_Context.Make_Context_Current (Context) = False then raise Error with "error making context current"; else Command_Line.Set_Exit_Status (Command_Line.Success); end if; else raise Error with "error creating context"; end if; else raise Error with "error opening device"; end if; end Open_Device; -- -- Entry point. -- procedure Run is begin Init; List_Playback_Devices; List_Capture_Devices; Defaults; Open_Device; Versions; Finish; exception when E : Error => Text_IO.Put_Line (File => Text_IO.Current_Error, Item => "fatal: " & Exceptions.Exception_Message (E)); end Run; -- -- Versions. -- procedure Versions is begin Text_IO.Put ("ALC major version : "); Natural_IO.Put (AL_Context.Get_Major_Version (Device)); Text_IO.New_Line; Text_IO.Put ("ALC minor version : "); Natural_IO.Put (AL_Context.Get_Minor_Version (Device)); Text_IO.New_Line; Text_IO.Put ("ALC extensions : "); Text_IO.Put (AL_Context.Get_Extensions (Device)); Text_IO.New_Line; Text_IO.Put ("AL vendor : "); Text_IO.Put (AL_Global.Vendor); Text_IO.New_Line; Text_IO.Put ("AL renderer : "); Text_IO.Put (AL_Global.Renderer); Text_IO.New_Line; Text_IO.Put ("AL version : "); Text_IO.Put (AL_Global.Version); Text_IO.New_Line; Text_IO.Put ("AL extensions : "); Text_IO.Put (AL_Global.Extensions); Text_IO.New_Line; end Versions; end OpenAL_Info;
-- Import tests and sub-suites to run with Dl.Test_Basics; package body Dl.Test_All_Suit is use AUnit.Test_Suites; -- Statically allocate test suite: Result : aliased Test_Suite; -- Statically allocate test cases: Test_1 : aliased Dl.Test_Basics.Test_Case; ----------- -- Suite -- ----------- function Suite return AUnit.Test_Suites.Access_Test_Suite is begin Add_Test (Result'Access, Test_1'Access); return Result'Access; end Suite; end Dl.Test_All_Suit;
with Ada.Text_IO; package body RAII is overriding procedure Finalize (This : in out Controlled_File) is begin if Ada.Text_IO.Is_Open (This.File) then Ada.Text_IO.Close (This.File); end if; end Finalize; end RAII;
with lace.Environ.Paths, ada.Text_IO; procedure test_Environ_Paths is use lace.Environ.Paths, ada.Text_IO; Error : exception; begin put_Line ("Begin"); -- Test load of an empty file. -- declare Output : constant String := to_File ("data/empty.txt").load; begin if Output /= "" then raise Error with "Loading an empty file fails: '" & Output & "'"; end if; end; -- Test load of simple text. -- declare Output : constant String := to_File ("data/digits.txt").load; begin if Output /= "0123456789" then raise Error with "Loading a simple text file fails: '" & Output & "'"; end if; end; put_Line ("Success"); put_Line ("End"); end test_Environ_Paths;
with Ada.Containers.Indefinite_Ordered_Maps; with Ada.Containers.Ordered_Maps; with Ada.Finalization; generic type Symbol_Type is private; with function "<" (Left, Right : Symbol_Type) return Boolean is <>; with procedure Put (Item : Symbol_Type); type Symbol_Sequence is array (Positive range <>) of Symbol_Type; type Frequency_Type is private; with function "+" (Left, Right : Frequency_Type) return Frequency_Type is <>; with function "<" (Left, Right : Frequency_Type) return Boolean is <>; package Huffman is -- bits = booleans (true/false = 1/0) type Bit_Sequence is array (Positive range <>) of Boolean; Zero_Sequence : constant Bit_Sequence (1 .. 0) := (others => False); -- output the sequence procedure Put (Code : Bit_Sequence); -- type for freqency map package Frequency_Maps is new Ada.Containers.Ordered_Maps (Element_Type => Frequency_Type, Key_Type => Symbol_Type); type Huffman_Tree is private; -- create a huffman tree from frequency map procedure Create_Tree (Tree : out Huffman_Tree; Frequencies : Frequency_Maps.Map); -- encode a single symbol function Encode (Tree : Huffman_Tree; Symbol : Symbol_Type) return Bit_Sequence; -- encode a symbol sequence function Encode (Tree : Huffman_Tree; Symbols : Symbol_Sequence) return Bit_Sequence; -- decode a bit sequence function Decode (Tree : Huffman_Tree; Code : Bit_Sequence) return Symbol_Sequence; -- dump the encoding table procedure Dump_Encoding (Tree : Huffman_Tree); private -- type for encoding map package Encoding_Maps is new Ada.Containers.Indefinite_Ordered_Maps (Element_Type => Bit_Sequence, Key_Type => Symbol_Type); type Huffman_Node; type Node_Access is access Huffman_Node; -- a node is either internal (left_child/right_child used) -- or a leaf (left_child/right_child are null) type Huffman_Node is record Frequency : Frequency_Type; Left_Child : Node_Access := null; Right_Child : Node_Access := null; Symbol : Symbol_Type; end record; -- create a leaf node function Create_Node (Symbol : Symbol_Type; Frequency : Frequency_Type) return Node_Access; -- create an internal node function Create_Node (Left, Right : Node_Access) return Node_Access; -- fill the encoding map procedure Fill (The_Node : Node_Access; Map : in out Encoding_Maps.Map; Prefix : Bit_Sequence); -- huffman tree has a tree and an encoding map type Huffman_Tree is new Ada.Finalization.Controlled with record Tree : Node_Access := null; Map : Encoding_Maps.Map := Encoding_Maps.Empty_Map; end record; -- free memory after finalization overriding procedure Finalize (Object : in out Huffman_Tree); end Huffman;
with Ada.Containers.Vectors; with Ada.Iterator_Interfaces; with EU_Projects.Nodes.Action_Nodes; with EU_Projects.Nodes.Timed_Nodes.Deliverables; with EU_Projects.Nodes.Action_Nodes.Tasks; with EU_Projects.Nodes.Partners; with EU_Projects.Node_Tables; package EU_Projects.Nodes.Action_Nodes.WPs is type Project_WP is new Action_Node -- and Searchable_Nodes.Searchable_Node with private; type Project_WP_Access is access all Project_WP; subtype WP_Index is Node_Index; No_WP : constant Extended_Node_Index := No_Index; type WP_Label is new Node_Label; function Create (Label : WP_Label; Name : String; Short_Name : String; Leader : Partners.Partner_Label; Objectives : String; Description : String; Active_When : Action_Time; Depends_On : Node_Label_Lists.Vector; Node_Dir : in out Node_Tables.Node_Table) return Project_WP_Access with Post => Create'Result.Index = No_WP; procedure Set_Index (WP : in out Project_WP; Idx : WP_Index) with Pre => Wp.Index = No_WP, Post => Wp.Index = Idx; overriding function Full_Index (Item : Project_WP; Prefixed : Boolean) return String; overriding function Dependency_List (Item : Project_WP) return Node_Label_Lists.Vector; -- As many other "add" procedures, this procedure is in charge of assigning -- an index to the new task, unless the task has already an index (which -- must not be already present). New indexes are assigned incrementally. -- -- This, basically, is the plain english "translation" of -- the pre/postconditions... procedure Add_Task (WP : in out Project_WP; Tsk : Tasks.Project_Task_Access) with Post => ( (Tsk.Index /= Tasks.No_Task) and (WP.Contains (Tsk.Index)) and Correctly_Updated (Old_Index => Tsk.Index'Old, New_Index => Tsk.Index, Old_Max => WP.Max_Task_Index'Old, New_Max => WP.Max_Task_Index) ), Pre => (Tsk.Index = Tasks.No_Task); -- Return the maximum of the indexes of the tasks currently included -- in the WP. It is here since it is necessary for the post condition of -- Add_Task. function Max_Task_Index (WP : Project_WP) return Extended_Node_Index; procedure Add_Deliverable (WP : in out Project_WP; Item : Timed_Nodes.Deliverables.Deliverable_Access) with Pre => not Item.Is_Clone and Item.Index = Timed_Nodes.Deliverables.No_Deliverable, Post => Item.Index /= Timed_Nodes.Deliverables.No_Deliverable; function Contains (WP : Project_WP; Idx : Tasks.Task_Index) return Boolean; type Task_Cursor is private; function Has_Element (X : Task_Cursor) return Boolean; package Task_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor => Task_Cursor, Has_Element => Has_Element); type Task_Iterator is new Task_Iterator_Interfaces.Forward_Iterator with private; overriding function First (Object : Task_Iterator) return Task_Cursor; overriding function Next (Object : Task_Iterator; Position : Task_Cursor) return Task_Cursor; function All_Tasks (Item : Project_WP) return Task_Iterator_Interfaces.Forward_Iterator'Class; function Element (Index : Task_Cursor) return Tasks.Project_Task_Access; function Task_List (Item : Project_WP) return Node_Label_Lists.Vector; --------------------------- -- Deliverable Iterators -- --------------------------- type Deliverable_Cursor is private; function Has_Element (X : Deliverable_Cursor) return Boolean; package Deliverable_Iterator_Interfaces is new Ada.Iterator_Interfaces (Cursor => Deliverable_Cursor, Has_Element => Has_Element); type Deliverable_Iterator is new Deliverable_Iterator_Interfaces.Forward_Iterator with private; overriding function First (Object : Deliverable_Iterator) return Deliverable_Cursor; overriding function Next (Object : Deliverable_Iterator; Position : Deliverable_Cursor) return Deliverable_Cursor; function All_Deliverables (Item : Project_WP) return Deliverable_Iterator_Interfaces.Forward_Iterator'Class; function Element (Index : Deliverable_Cursor) return Nodes.Timed_Nodes.Deliverables.Deliverable_Access; overriding procedure Parse_Raw_Expressions (Item : in out Project_WP; Vars : Times.Time_Expressions.Parsing.Symbol_Table); private use Tasks; use type Timed_Nodes.Deliverables.Deliverable_Access; package WP_Index_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => WP_Index); package Deliverable_Vectors is new Ada.Containers.Vectors (Index_Type => Timed_Nodes.Deliverables.Deliverable_Index, Element_Type => Timed_Nodes.Deliverables.Deliverable_Access); --------------------- -- Task iteration -- --------------------- package Task_Vectors is new Ada.Containers.Vectors (Index_Type => Tasks.Task_Index, Element_Type => Tasks.Project_Task_Access); type Task_Cursor is new Task_Vectors.Cursor; type Task_Iterator is new Task_Iterator_Interfaces.Forward_Iterator with record Start : Task_Vectors.Cursor; end record; overriding function First (Object : Task_Iterator) return Task_Cursor is (Task_Cursor (Object.Start)); overriding function Next (Object : Task_Iterator; Position : Task_Cursor) return Task_Cursor is (Task_Cursor (Task_Vectors.Next (Task_Vectors.Cursor (Position)))); function Element (Index : Task_Cursor) return Tasks.Project_Task_Access is (Task_Vectors.Element (Task_Vectors.Cursor (Index))); function Has_Element (X : Task_Cursor) return Boolean is (Task_Vectors.Has_Element (Task_Vectors.Cursor (X))); ---------------- -- Finally... -- ---------------- type Project_WP is new Nodes.Action_Nodes.Action_Node with record Objectives : Unbounded_String; Depend_On : Node_Label_Lists.Vector; WP_Tasks : Task_Vectors.Vector; Deliverables : Deliverable_Vectors.Vector; end record; -- -- function Index (WP : Project_WP) return Extended_Node_Index -- is (WP_Index (WP.Index)); function Contains (WP : Project_WP; Idx : Tasks.Task_Index) return Boolean is ((Idx >= WP.WP_Tasks.First_Index and Idx <= WP.WP_Tasks.Last_Index) and then (WP.WP_Tasks (Idx) /= null)); ---------------------------- -- Deliverable iteration -- ---------------------------- type Deliverable_Cursor is record Top_Level : Deliverable_Vectors.Cursor; Clone : Natural; end record; type Deliverable_Iterator is new Deliverable_Iterator_Interfaces.Forward_Iterator with record Start : Deliverable_Vectors.Cursor; end record; overriding function First (Object : Deliverable_Iterator) return Deliverable_Cursor is (Deliverable_Cursor'(Top_Level => Object.Start, Clone => 0)); function Has_Element (X : Deliverable_Cursor) return Boolean is (Deliverable_Vectors.Has_Element (X.Top_Level)); function All_Deliverables (Item : Project_WP) return Deliverable_Iterator_Interfaces.Forward_Iterator'Class is (Deliverable_Iterator'(Start => Item.Deliverables.First)); overriding function Full_Index (Item : Project_WP; Prefixed : Boolean) return String is ((if Prefixed then "WP" else "") & Chop (Node_Index'Image (Item.Index))); function Max_Task_Index (WP : Project_WP) return Extended_Node_Index is (WP.WP_Tasks.Last_Index); function All_Tasks (Item : Project_WP) return Task_Iterator_Interfaces.Forward_Iterator'Class is (Task_Iterator'(Start => Item.WP_Tasks.First)); -- function All_Deliverables -- (Item : Project_WP) -- return Deliverable_Iterator_Interfaces.Forward_Iterator'Class -- is (Deliverable_Iterator'(Start => Item.WP_Deliverables.First)); -- -- -- function All_Milestones -- (Item : Project_WP) -- return Milestone_Iterator_Interfaces.Forward_Iterator'Class -- is (Milestone_Iterator'(Start => Item.WP_Milestones.First)); end EU_Projects.Nodes.Action_Nodes.WPs; -- procedure Add_Deliverable (WP : in out Project_WP; -- Deliverable : Timed_Nodes.Deliverables.Deliverable_Access); -- -- procedure Add_Dependence (WP : in out Project_WP; -- Label : Identifiers.Identifier); -- -- procedure Summarize_Tasks (WP : in out Project_WP); -- function Find (Where : Project_WP; -- Label : Identifiers.Identifier) -- return Searchable_Nodes.Child_Value; -- -- Search for a child with the given name and return it -- -- Return No_Child if the child does not exist -- -- function Exists (Where : Project_WP; -- Label : Identifiers.Identifier) -- return Searchable_Nodes.Child_Class;
-- { dg-do run } procedure Abstract_With_Anonymous_Result is package Pkg is type I is abstract tagged null record; type Acc_I_Class is access all I'Class; function Func (V : I) return access I'Class is abstract; procedure Proc (V : access I'Class); type New_I is new I with null record; function Func (V : New_I) return access I'Class; end Pkg; package body Pkg is X : aliased New_I; procedure Proc (V : access I'Class) is begin null; end Proc; function Func (V : New_I) return access I'Class is begin X := V; return X'Access; end Func; end Pkg; use Pkg; New_I_Obj : aliased New_I; procedure Proc2 (V : access I'Class) is begin Proc (Func (V.all)); -- Call to Func causes gigi abort 122 end Proc2; begin Proc2 (New_I_Obj'Access); end Abstract_With_Anonymous_Result;
with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure pascal is ordre : Integer; begin --Put_Line(for all I in 1..10 => I > 0); Get(ordre); declare tab : array(0..ordre) of Integer := (1, others => 0); begin for i in 0..(ordre) loop Put("ordre"&integer'image(i)&" : "); for j in reverse 1..i loop tab(j ) := tab(j) + tab(j-1); end loop; for j in 0..i loop Put(tab(j)); end loop; New_Line; end loop; end; end pascal;
pragma Check_Policy (Trace => Ignore); with Ada; -- assertions with System.Address_To_Named_Access_Conversions; with System.Formatting; with System.Long_Long_Integer_Types; with System.Storage_Elements; with System.Termination; package body System.Unwind.Occurrences is pragma Suppress (All_Checks); use type Storage_Elements.Storage_Offset; use type Representation.Machine_Occurrence_Access; use type Representation.Unwind_Exception_Class; subtype Word_Unsigned is Long_Long_Integer_Types.Word_Unsigned; -- package separated for depending on libgcc package Separated is -- equivalent to Allocate_Occurrence (a-exexpr-gcc.adb) function New_Machine_Occurrence return not null Representation.Machine_Occurrence_Access; procedure Free ( Machine_Occurrence : Representation.Machine_Occurrence_Access); end Separated; package body Separated is separate; -- for Save_Occurrence procedure memcpy ( dst, src : Address; n : Storage_Elements.Storage_Count) with Import, Convention => Intrinsic, External_Name => "__builtin_memcpy"; -- for Set_Foreign_Occurrence package MOA_Conv is new Address_To_Named_Access_Conversions ( Representation.Machine_Occurrence, Representation.Machine_Occurrence_Access); Foreign_Exception : aliased Exception_Data with Import, Convention => Ada, External_Name => "system__exceptions__foreign_exception"; -- weak references for System.Unwind.Backtrace procedure Call_Chain (Current : in out Exception_Occurrence) with Import, -- weak linking Convention => Ada, External_Name => "ada__exceptions__call_chain"; pragma Weak_External (Call_Chain); procedure Backtrace_Information ( X : Exception_Occurrence; Params : Address; Put : not null access procedure (S : String; Params : Address); New_Line : not null access procedure (Params : Address)) with Import, -- weak linking Convention => Ada, External_Name => "__drake_backtrace_information"; pragma Weak_External (Backtrace_Information); -- buffered writing to standard error output type Information_Context_Type is record Item : String ( 1 .. 256 + Exception_Msg_Max_Length + Max_Tracebacks * (3 + (Standard'Address_Size + 3) / 4)); Last : Natural; end record; pragma Suppress_Initialization (Information_Context_Type); procedure Put (S : String; Params : Address); procedure New_Line (Params : Address); procedure Put (S : String; Params : Address) is Context : Information_Context_Type; for Context'Address use Params; First : constant Positive := Context.Last + 1; begin Context.Last := Context.Last + S'Length; Context.Item (First .. Context.Last) := S; end Put; procedure New_Line (Params : Address) is Context : Information_Context_Type; for Context'Address use Params; begin Termination.Error_Put_Line (Context.Item (1 .. Context.Last)); Context.Last := 0; end New_Line; -- (a-elchha.ads) procedure Last_Chance_Handler ( Current : Exception_Occurrence); pragma No_Return (Last_Chance_Handler); procedure Last_Chance_Handler ( Current : Exception_Occurrence) is begin pragma Check (Trace, Ada.Debug.Put ("enter")); -- Only flush Text_IO, similar to abort that flushes stdio and does not -- finalize any others (atexit, __attribute__((destructor)), etc). -- GNAT runtime calls System.Standard_Library.Adafinal to complete tasks -- here, but drake does not it according with abort. Flush_IO; Report (Current, ""); Termination.Force_Abort; end Last_Chance_Handler; -- (a-exextr.adb) procedure Unhandled_Exception_Terminate ( Current : not null Exception_Occurrence_Access); pragma No_Return (Unhandled_Exception_Terminate); procedure Unhandled_Exception_Terminate ( Current : not null Exception_Occurrence_Access) is begin Last_Chance_Handler (Current.all); end Unhandled_Exception_Terminate; -- implementation procedure Save_Occurrence ( Target : out Exception_Occurrence; Source : Exception_Occurrence) is begin memcpy ( Target'Address, Source'Address, Target.Tracebacks'Position + (Tracebacks_Array'Component_Size / Standard'Storage_Unit) * Storage_Elements.Storage_Offset (Source.Num_Tracebacks)); Target.Machine_Occurrence := Null_Address; Target.Exception_Raised := False; end Save_Occurrence; procedure Backtrace (X : in out Exception_Occurrence) is begin if Call_Chain'Address /= Null_Address then Call_Chain (X); end if; end Backtrace; procedure Set_Exception_Message ( Id : not null Exception_Data_Access; File : String := ""; Line : Integer := 0; Column : Integer := 0; Message : String; X : in out Exception_Occurrence) is begin X.Id := Id; declare File_Length : constant Natural := File'Length; Last : Natural := 0; begin if File_Length > 0 then X.Msg (1 .. File_Length) := File; Last := File_Length + 1; X.Msg (Last) := ':'; end if; if Line > 0 then declare Error : Boolean; begin Formatting.Image ( Word_Unsigned (Line), X.Msg (Last + 1 .. X.Msg'Last), Last, Error => Error); end; end if; if Column > 0 then if Last < X.Msg'Last then Last := Last + 1; X.Msg (Last) := ':'; end if; declare Error : Boolean; begin Formatting.Image ( Word_Unsigned (Column), X.Msg (Last + 1 .. X.Msg'Last), Last, Error => Error); end; end if; if (File_Length > 0 or else Line > 0 or else Column > 0) and then Last < X.Msg'Last then Last := Last + 1; X.Msg (Last) := ' '; end if; declare Copy_Length : constant Natural := Integer'Min (Message'Length, X.Msg'Length - Last); begin X.Msg (Last + 1 .. Last + Copy_Length) := Message (Message'First .. Message'First + Copy_Length - 1); Last := Last + Copy_Length; end; if Last < X.Msg'Last then -- no necessary X.Msg (Last + 1) := Character'Val (0); end if; X.Msg_Length := Last; end; X.Machine_Occurrence := Null_Address; X.Exception_Raised := False; X.Pid := Local_Partition_ID; X.Num_Tracebacks := 0; end Set_Exception_Message; function New_Machine_Occurrence (Stack_Guard : Address) return not null Representation.Machine_Occurrence_Access is Result : constant not null Representation.Machine_Occurrence_Access := Separated.New_Machine_Occurrence; begin Result.Stack_Guard := Stack_Guard; return Result; end New_Machine_Occurrence; procedure Free ( Machine_Occurrence : Representation.Machine_Occurrence_Access) renames Separated.Free; procedure Set_Foreign_Occurrence ( X : in out Exception_Occurrence; Machine_Occurrence : not null Representation.Machine_Occurrence_Access) is begin X.Id := Foreign_Exception'Access; X.Machine_Occurrence := MOA_Conv.To_Address (Machine_Occurrence); X.Msg_Length := 0; X.Exception_Raised := True; X.Pid := Local_Partition_ID; X.Num_Tracebacks := 0; end Set_Foreign_Occurrence; function Get_Current_Occurrence ( TLS : not null Runtime_Context.Task_Local_Storage_Access) return Exception_Occurrence_Access is Machine_Occurrence : constant not null Representation.Machine_Occurrence_Access := TLS.Machine_Occurrence; Result : Exception_Occurrence_Access; begin if Machine_Occurrence.Header.exception_class = Representation.GNAT_Exception_Class then Result := Machine_Occurrence.Occurrence'Access; else Result := TLS.Secondary_Occurrence.Occurrence'Access; Set_Foreign_Occurrence (Result.all, Machine_Occurrence); end if; return Result; end Get_Current_Occurrence; procedure Set_Current_Machine_Occurrence ( Machine_Occurrence : Representation.Machine_Occurrence_Access) is TLS : constant not null Runtime_Context.Task_Local_Storage_Access := Runtime_Context.Get_Task_Local_Storage; begin TLS.Machine_Occurrence := Machine_Occurrence; end Set_Current_Machine_Occurrence; function Triggered_By_Abort return Boolean is TLS : constant not null Runtime_Context.Task_Local_Storage_Access := Runtime_Context.Get_Task_Local_Storage; begin -- Strictly speaking, this conditional expression suppresses to call -- __gnat_rcheck_PE_Finalize_Raised_Exception from nested blocks -- excessively. -- However, TLS.Machine_Occurrence = null because Triggered_By_Abort is -- called from finalizers, without Begin_Handler/End_Handler. return TLS.Triggered_By_Abort; end Triggered_By_Abort; procedure Unhandled_Except_Handler ( Machine_Occurrence : not null Representation.Machine_Occurrence_Access) is TLS : constant not null Runtime_Context.Task_Local_Storage_Access := Runtime_Context.Get_Task_Local_Storage; Current : Exception_Occurrence_Access; begin pragma Check (Trace, Ada.Debug.Put ("enter")); TLS.Machine_Occurrence := Machine_Occurrence; Current := Get_Current_Occurrence (TLS); Unhandled_Exception_Terminate (Current); end Unhandled_Except_Handler; procedure Exception_Information ( X : Exception_Occurrence; Params : Address; Put : not null access procedure (S : String; Params : Address); New_Line : not null access procedure (Params : Address)) is begin Put ("raised ", Params); declare Full_Name_All : String (1 .. X.Id.Name_Length - 1); for Full_Name_All'Address use X.Id.Full_Name; begin Put (Full_Name_All, Params); end; if X.Msg_Length > 0 then Put (" : ", Params); Put (X.Msg (1 .. X.Msg_Length), Params); end if; New_Line (Params); if X.Pid /= 0 then null; -- output X.Pid is unimplemented end if; if X.Num_Tracebacks > 0 and then Backtrace_Information'Address /= Null_Address then Backtrace_Information ( X, Params, Put => Put, New_Line => New_Line); end if; end Exception_Information; procedure Flush_IO is begin Flush_IO_Hook.all; end Flush_IO; procedure Put_Exception_Information (X : Exception_Occurrence) is Context : aliased Information_Context_Type; begin Context.Last := 0; Exception_Information ( X, Context'Address, Put => Put'Access, New_Line => New_Line'Access); end Put_Exception_Information; procedure Default_Report (X : Exception_Occurrence; Where : String) is Full_Name_All : String (1 .. 1); -- at least for Full_Name_All'Address use X.Id.Full_Name; By_Abort : constant Boolean := Full_Name_All (1) = '_'; -- Standard'Abort_Signal Backtrace : constant Boolean := X.Num_Tracebacks > 0 and then Backtrace_Information'Address /= Null_Address; Context : aliased Information_Context_Type; begin Termination.Error_Put_Line (""); Context.Last := 0; if Where'Length > 0 then Put (Where, Context'Address); elsif By_Abort or else Backtrace then Put ("Execution", Context'Address); end if; if By_Abort then Put (" terminated by abort", Context'Address); if Where'Length = 0 then Put (" of environment task", Context'Address); end if; New_Line (Context'Address); else if Context.Last > 0 then Put (" terminated by unhandled exception", Context'Address); New_Line (Context'Address); end if; Put_Exception_Information (X); end if; end Default_Report; procedure Report (X : Exception_Occurrence; Where : String) is begin Report_Hook (X, Where); end Report; end System.Unwind.Occurrences;
-- package pc_1_coeff_16 -- -- Predictor_Rule : Integration_Rule renames Predictor_32_16; -- -- Corrector_Rule : Integration_Rule renames Corrector_33_16; -- -- Final_Step_Corrector : Real renames Final_Step_Corrector_33_16; -- generic type Real is digits <>; package pc_1_coeff_16 is subtype PC_Rule_Range is Integer range 0..31; type Integration_Rule is array(PC_Rule_Range) of Real; Predictor_32_16 : constant Integration_Rule := ( 1.58300518561266533943346621881725639E-1 , -1.29876625475370034718072947139023693E+0 , 4.08038803570099378644538489588287274E+0 , -5.34517919834444521244521540495575313E+0 , 3.61867046938644977617190941719731385E-1 , 4.94387814442015362635933744395570521E+0 , -1.33311784058679597000325521422753672E-1 , -4.88481926160045550931502334078563944E+0 , -1.98514513096958107495118615432471231E+0 , 3.79516652147618740528140370884652535E+0 , 4.48945452211270155041001170243884142E+0 , -6.08913984637978046197175520063574426E-1 , -5.09432720955784671489282779858681116E+0 , -3.58986670578422060094487808484896819E+0 , 2.22106463864400713642358994160133830E+0 , 5.73287708015947215526779361004914445E+0 , 2.79864895278001169722108664353913256E+0 , -3.58002627256686139050999303967998796E+0 , -6.23029649806745365350103160485114476E+0 , -1.66125591870475616307472423126889012E+0 , 5.37307289570721897689119609382917739E+0 , 6.33380540959737973567463679920587502E+0 , -9.96508986451831371865376831719588840E-1 , -7.92869376300750525719141098077052746E+0 , -4.02073832723037767121246271796228813E+0 , 7.18556206904183494433857556023700275E+0 , 7.73889414644388957286362432601467654E+0 , -7.60970756314567834945759313759117461E+0 , -9.35666574696170458983537964733816155E+0 , 1.67334787146447018005662423638477732E+1 , -1.04582249771658562608592013488936036E+1 , 3.83598888678046791113111418340429426E+0 ); Predictor_31_16 : constant Integration_Rule := ( 0.0, 1.61964525541938718410748900387936178E-1 , -1.38024145464834499141446063627795109E+0 , 4.57375271300547134124480194804133446E+0 , -6.60232069266188695905729295578448529E+0 , 1.49788628884206431626996501477822148E+0 , 5.70502528511599489475110206084580133E+0 , -1.61837805738696489699294891163488297E+0 , -5.93363360000023049152727042800237239E+0 , -5.81061468452390142544320660101199752E-1 , 5.68298113333015294761661068304958989E+0 , 3.95996762379691248301875296440379467E+0 , -3.17684381509259149474927438866882814E+0 , -6.38796297296861737467833359619459442E+0 , -1.59805676377896478137830013392751453E+0 , 5.41522465569058427326476793161402791E+0 , 6.11779894831184736325921309026516388E+0 , -6.88094305375897668833566759546795976E-1 , -7.13054766536430634009841119397143607E+0 , -5.11183375979000725999424536657196052E+0 , 3.68767525069032271596940917043882204E+0 , 8.49367158264866153612872671321617978E+0 , 2.06112775163275967136988444790382707E+0 , -8.26645365112514838089231840633524132E+0 , -7.22750011270174911241647330213783524E+0 , 6.32975915987975758087048743006152797E+0 , 1.08257449496249946681616023300404548E+1 , -6.81389056751830818128174075574143171E+0 , -1.29229095926420925456520331506832699E+1 , 1.92098016915670586737065525219902710E+1 , -1.12065423563697373897519153752210264E+1 , 3.92388927619871682722028081376387321E+0 ); Extrap_Factor: constant Real := 1.0 / 13.5; Corrector_33_16 : constant Integration_Rule := ( -5.92138757680204403480450739823438411E-3 , 4.71529646398076770746645919748945853E-2 , -1.41959758984457396755822008734451536E-1 , 1.71336067299466442711704947849133112E-1 , 1.10490109418350139719369856676719393E-2 , -1.63964759869585517075180125677805339E-1 , -2.70063206482973911112588031432581866E-2 , 1.52066249786243970799186517684557913E-1 , 1.00155650098853141128884792571980512E-1 , -9.19265209080620006315378638089444143E-2 , -1.65620504102850611638391505801204852E-1 , -3.42543212454091267276847145466291618E-2 , 1.41702257557639300635110495048252948E-1 , 1.59426985455442255199794510323763370E-1 , -2.68728230220207663210940297967834589E-3 , -1.69695870987537516415228279671544523E-1 , -1.58366061762764557700156430430808771E-1 , 2.86930071193890420624802784342966873E-2 , 1.97310587352917902013760425137613317E-1 , 1.57109853754320897375366617216077242E-1 , -6.77622451138449910754323817709247206E-2 , -2.35274460856051964774188251936536428E-1 , -1.31914702313893409729153721044145660E-1 , 1.55918952268904968596020000828950313E-1 , 2.72497964042755836271502373878819580E-1 , 5.62283624391623979843956545551872919E-3 , -3.24872332285431384466419706098424840E-1 , -1.46999632767589668902530345840077217E-1 , 3.91178879758291378559010152239189427E-1 , 1.61373748009217999823860922142966325E-1 , -6.98897791454449889054440574225252627E-1 , 1.10915828164775842475255986387835791E+0 ); Final_Step_Corrector_33_16 : constant Real := 3.05370657202469055950055582775877095E-1; Predictor_Rule : Integration_Rule renames Predictor_31_16; Corrector_Rule : Integration_Rule renames Corrector_33_16; Final_Step_Corrector : Real renames Final_Step_Corrector_33_16; end pc_1_coeff_16;
-- -- This library is free software; you can redistribute it and/or modify -- it under the terms of the GNU Library General Public License as -- published by the Free Software Foundation; either version 3 of the -- License; or (at your option) any later version. with Ada.Unchecked_Deallocation; package body Unbounded_Sequential_Stacks is ---------- -- Push -- ---------- procedure Push (Onto : in out Stack; Item : in Element) is begin Onto.Head := new Node'(Value => Item, Next => Onto.Head); Onto.Count := Onto.Count + 1; end Push; ---------- -- Free -- ---------- procedure Free is new Ada.Unchecked_Deallocation (Object => Node, Name => List); --------- -- Pop -- --------- procedure Pop (From : in out Stack; Item : out Element) is Temp : List; begin if From.Count = 0 then raise Underflow; end if; Item := From.Head.Value; Temp := From.Head; From.Head := From.Head.Next; From.Count := From.Count - 1; Free (Temp); end Pop; --------- -- Pop -- --------- procedure Pop (This : in out Stack) is Temp : List; begin if This.Count = 0 then raise Underflow; end if; Temp := This.Head; This.Head := This.Head.Next; This.Count := This.Count - 1; Free (Temp); end Pop; --------- -- Clear -- --------- procedure Clear (This : in out Stack) is Temp : List; begin if This.Count = 0 then return; end if; while This.Count > 0 loop Temp := This.Head; This.Head := This.Head.Next; This.Count := This.Count - 1; Free (Temp); end loop; end Clear; ----------- -- Depth -- ----------- function Depth (This : Stack) return Natural is begin return This.Count; end Depth; ----------- -- Empty -- ----------- function Empty (This : Stack) return Boolean is begin return This.Count = 0; end Empty; --------- -- Top -- --------- function Top (This : Stack) return Reference is begin return This.Head.Value'Access; end Top; end Unbounded_Sequential_Stacks;
with ada.Strings.Hash; package body any_Math.any_Geometry.any_d3.any_Modeller is use ada.Containers; function Hash (Site : in my_Vertex) return ada.Containers.Hash_type is use ada.Strings; begin return Hash ( Site (1)'Image & Site (2)'Image & Site (3)'Image); end Hash; function demand_Index (Self : in out Item; for_Vertex : in my_Vertex) return Natural -- -- If the vertex exists in the map, return the associated index. -- Otherwise add the new vertex and return it's index. -- is use Vertex_Maps_of_Index; Cursor : constant Vertex_Maps_of_Index.Cursor := Self.Index_Map.find (for_Vertex); begin if has_Element (Cursor) then return Element (Cursor); end if; Self.Vertices.append (Vertex (for_Vertex)); declare new_Index : constant Natural := Natural (Self.Vertices.Length); begin Self.Index_Map.insert (for_Vertex, new_Index); return new_Index; end; end demand_Index; function "<" (Left, Right : in Index_Triangle) return Boolean is begin if Left (1) < Right (1) then return True; end if; if Left (1) > Right (1) then return False; end if; if Left (2) < Right (2) then return True; end if; if Left (2) > Right (2) then return False; end if; if Left (3) < Right (3) then return True; end if; return False; end "<"; procedure add_Triangle (Self : in out Item; Vertex_1, Vertex_2, Vertex_3 : in Site) is vertex_1_Index : constant Natural := demand_Index (Self, my_Vertex (Vertex_1)); vertex_2_Index : constant Natural := demand_Index (Self, my_Vertex (Vertex_2)); vertex_3_Index : constant Natural := demand_Index (Self, my_Vertex (Vertex_3)); new_Triangle : constant index_Triangle := (vertex_1_Index, vertex_2_Index, vertex_3_Index); new_Triangle_rotated_1 : constant index_Triangle := (vertex_3_Index, vertex_1_Index, vertex_2_Index); new_Triangle_rotated_2 : constant index_Triangle := (vertex_2_Index, vertex_3_Index, vertex_1_Index); begin if new_Triangle (1) = new_Triangle (2) or else new_Triangle (1) = new_Triangle (3) or else new_Triangle (2) = new_Triangle (3) then null; -- Discard collapsed triangle. else if Self.Triangles.contains (new_triangle) or else Self.Triangles.contains (new_triangle_rotated_1) or else Self.Triangles.contains (new_triangle_rotated_2) then null; -- Triangle is already present. else Self.Triangles.include (new_Triangle); end if; end if; end add_Triangle; procedure clear (Self : in out Item) is begin Self.Triangles.clear; Self.Vertices .clear; Self.Index_Map.clear; end clear; function Triangle_Count (Self : in Item) return Natural is begin return Natural (Self.Triangles.Length); end triangle_Count; function Model (Self : in Item) return a_Model is Result : a_Model := (Site_Count => Integer (Self.Vertices.Length), Tri_Count => Integer (Self.Triangles.Length), Sites => <>, Triangles => <>); begin for i in 1 .. Index (Result.site_Count) loop Result.Sites (i) := Self.Vertices.Element (i); end loop; declare use Index_Triangle_Sets; Cursor : Index_Triangle_Sets.Cursor := Self.Triangles.First; begin for i in 1 .. Result.Tri_Count loop Result.Triangles (i) := Element (Cursor); next (Cursor); end loop; end; return Result; end Model; function bounding_Sphere_Radius (Self : in out Item) return Real is use Functions; begin if Self.bounding_Sphere_Radius = Real'First then for Each of Self.Vertices loop Self.bounding_sphere_Radius := Real'Max (Self.bounding_sphere_Radius, SqRt ( Each (1) * Each (1) + Each (2) * Each (2) + Each (3) * Each (3))); end loop; end if; return Self.bounding_sphere_Radius; end bounding_sphere_Radius; end any_Math.any_Geometry.any_d3.any_Modeller;
with GNAT.Sockets; use GNAT.Sockets; with Ada.Text_IO; use Ada.Text_IO; with Ada.Containers.Vectors; procedure Server is Address : Sock_Addr_Type; Server : Socket_Type; Client_Socket : Socket_Type; package Client_Vectors is new Ada.Containers.Vectors (Element_Type => Socket_Type, Index_Type => Positive); Clients : Client_Vectors.Vector; procedure Broadcast (Sock : Socket_Type; Message : String) is Channel : Stream_Access; begin for Socket of Clients loop if Sock /= Socket then Channel := Stream (Socket); String'Output (Channel, Message); end if; end loop; end Broadcast; task type Client_Task is entry Start (Socket : Socket_Type); end Client_Task; task body Client_Task is Sock : Socket_Type; Channel : Stream_Access; begin accept Start (Socket : Socket_Type) do Sock := Socket; end Start; Put_Line ("Client connected..."); Clients.Append (Sock); Channel := Stream (Sock); loop declare -- Recieves message from associated socket Message : String := String'Input (Channel); begin Address := Get_Address (Channel); Broadcast (Sock, Image (Address) & ": " & Message); end; end loop; end Client_Task; type Client_Access is access Client_Task; Client_Instance : Client_Access; begin -- Must be called before socket routine Initialize (Process_Blocking_IO => False); -- Get internet address of host. (Localhost here) Address.Addr := Addresses (Get_Host_By_Name (Host_Name), 1); Address.Port := 1_024; -- Socket will need to be associated with an address on server sockets Create_Socket (Server); Set_Socket_Option (Server, Socket_Level, (Reuse_Address, True)); Bind_Socket (Server, Address); -- Bind Socket Listen_Socket (Server); -- Start listening for any incoming sockets loop Put_Line ("Accepting new sockets..."); -- Accept any incoming sockets Accept_Socket (Server, Client_Socket, Address); delay 0.2; -- Start a new task for a new client Client_Instance := new Client_Task; Client_Instance.Start (Client_Socket); end loop; -- Put_Line ("Closing Socket..."); -- Close_Socket (Server); -- Close_Socket (Socket); -- Finalize; end Server;
with Ada.Text_IO; package body MyString is function To_String(M : MyString) return String is Result : String(1..M.Length); begin Result := String(M.Str(M.Str'First..M.Length)) ; return Result; end To_String; function From_String(S : String) return MyString is M : MyString := (Length => 0, Str => (others => ' ')); J : Integer := M.Str'First; begin if S'Length > Max_MyString_Length then raise Constraint_Error; end if; M.Length := S'Length; for I in S'Range loop pragma Loop_Invariant (J = I - S'First + 1); M.Str(J) := S(I); J := J + 1; end loop; return M; end From_String; function Less(M1 : MyString; M2 : MyString) return Boolean is I : Integer := M1.Str'First; begin If M1.Length < M2.Length then return True; elsif M1.Length > M2.Length then return False; else while (I <= M1.Str'Last) loop pragma Loop_Invariant (I >= M1.Str'First); if M1.Str(I) < M2.Str(I) then return True; elsif M1.Str(I) > M2.Str(I) then return False; else I := I + 1; end if; end loop; -- end of string and both equal return False; end if; end Less; function Equal(M1 : MyString; M2 : MyString) return Boolean is I : Integer := M1.Str'First; begin If M1.Length /= M2.Length then return False; else while (I <= M1.Str'Last) loop pragma Loop_Invariant (I >= M1.Str'First and (for all J in 1..I-1 => M1.Str(J) = M2.Str(J))); if M1.Str(I) /= M2.Str(I) then return False; else I := I + 1; end if; end loop; return True; end if; end Equal; function Substring(M : MyString; From : Positive; To : Positive) return MyString is R : MyString := (Length => To - From + 1, Str => (others => ' ')); J : Positive := R.Str'First; begin for I in From..To loop pragma Loop_Invariant (J = I - From + 1); R.Str(J) := M.Str(I); J := J + 1; end loop; return R; end Substring; procedure Get_Line(M : out MyString) is begin Ada.Text_IO.Get_Line(Item => String(M.Str), Last => M.Length); end Get_Line; end MyString;
with Arduino_Nano_33_Ble_Sense.IOs; package Distance_Sensor_Controller is task Measure with Priority => 2; type Distance_Sensor is record TrigPin : Arduino_Nano_33_Ble_Sense.IOs.Pin_Id; EchoPin : Arduino_Nano_33_Ble_Sense.IOs.Pin_Id; Value : Float; end record; Front : Distance_Sensor := (TrigPin => 47, EchoPin => 45, Value => 100.0); Back : Distance_Sensor := (TrigPin => 43, EchoPin => 44, Value => 100.0); end Distance_Sensor_Controller;
with ACO.SDO_Sessions; private with Ada.Synchronous_Task_Control; private with ACO.Protocols.Network_Management.Masters; private with ACO.Protocols.Error_Control.Slaves; private with ACO.Protocols.Service_Data.Clients; package ACO.Nodes.Remotes is type Remote (Id : ACO.Messages.Node_Nr; Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new Node_Base with private; overriding procedure Set_State (This : in out Remote; State : in ACO.States.State); overriding function Get_State (This : Remote) return ACO.States.State; overriding procedure Start (This : in out Remote); type SDO_Request (Node : not null access Remote) is abstract tagged private; subtype SDO_Status is ACO.SDO_Sessions.SDO_Status; subtype SDO_Result is ACO.SDO_Sessions.SDO_Result; function Is_Complete (This : SDO_Request) return Boolean; procedure Suspend_Until_Result (This : in out SDO_Request; Result : out SDO_Result); function Status (This : SDO_Request) return SDO_Status; type SDO_Read_Request (Node : not null access Remote; To_Entry : not null access ACO.OD_Types.Entry_Base'Class) is new SDO_Request with private; procedure Suspend_Until_Result (This : in out SDO_Read_Request; Result : out SDO_Result); procedure Get_Entry (This : in out SDO_Read_Request) with Pre => This.Is_Complete; type SDO_Write_Request (Node : not null access Remote) is new SDO_Request with private; overriding procedure Write (This : in out Remote; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; An_Entry : in ACO.OD_Types.Entry_Base'Class) with Pre => This.Od.Entry_Exist (Index, Subindex) and then This.Od.Is_Entry_Compatible (An_Entry, Index, Subindex); procedure Write (This : in out Remote; Request : in out SDO_Write_Request'Class; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; An_Entry : in ACO.OD_Types.Entry_Base'Class); overriding procedure Read (This : in out Remote; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; To_Entry : out ACO.OD_Types.Entry_Base'Class) with Pre => This.Od.Entry_Exist (Index, Subindex) and then This.Od.Is_Entry_Compatible (To_Entry, Index, Subindex); procedure Read (This : in out Remote; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex; Result : out ACO.Nodes.Remotes.SDO_Result; To_Entry : out ACO.OD_Types.Entry_Base'Class) with Pre => This.Od.Entry_Exist (Index, Subindex) and then This.Od.Is_Entry_Compatible (To_Entry, Index, Subindex); procedure Read (This : in out Remote; Request : in out SDO_Read_Request'Class; Index : in ACO.OD_Types.Object_Index; Subindex : in ACO.OD_Types.Object_Subindex); generic type Entry_T is new ACO.OD_Types.Entry_Base with private; function Generic_Read (This : in out Remote; Index : ACO.OD_Types.Object_Index; Subindex : ACO.OD_Types.Object_Subindex) return Entry_T; -- with Pre => This.Od.Entry_Exist (Index, Subindex); -- Above precondition causes compiler error during instantiation. Bug? procedure Set_Heartbeat_Timeout (This : in out Remote; Timeout : in Natural); Failed_To_Read_Entry_Of_Node : exception; private type Request_Type is (Write, Read); type SDO_Request (Node : not null access Remote) is abstract tagged record Id : ACO.SDO_Sessions.Endpoint_Nr := ACO.SDO_Sessions.No_Endpoint_Id; end record; type SDO_Read_Request (Node : not null access Remote; To_Entry : not null access ACO.OD_Types.Entry_Base'Class) is new SDO_Request (Node) with null record; type SDO_Write_Request (Node : not null access Remote) is new SDO_Request (Node) with null record; type Request_Data is record Suspension : Ada.Synchronous_Task_Control.Suspension_Object; Status : ACO.SDO_Sessions.SDO_Status := ACO.SDO_Sessions.Pending; Operation : Request_Type; end record; type SDO_Request_Array is array (ACO.SDO_Sessions.Valid_Endpoint_Nr) of Request_Data; procedure On_Message_Dispatch (This : in out Remote; Msg : in ACO.Messages.Message); procedure Periodic_Actions (This : in out Remote; T_Now : in Ada.Real_Time.Time); type Remote_Client (Id : ACO.Messages.Node_Nr; Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new ACO.Protocols.Service_Data.Clients.Client (Handler, Od) with record Requests : SDO_Request_Array; end record; overriding procedure Result_Callback (This : in out Remote_Client; Session : in ACO.SDO_Sessions.SDO_Session; Result : in ACO.SDO_Sessions.SDO_Result); overriding function Tx_CAN_Id (This : Remote_Client; Parameter : ACO.SDO_Sessions.SDO_Parameters) return ACO.Messages.Id_Type; overriding function Rx_CAN_Id (This : Remote_Client; Parameter : ACO.SDO_Sessions.SDO_Parameters) return ACO.Messages.Id_Type; overriding function Get_Endpoint (This : Remote_Client; Rx_CAN_Id : ACO.Messages.Id_Type) return ACO.SDO_Sessions.Endpoint_Type; overriding function Get_Endpoint (This : Remote_Client; Server_Node : ACO.Messages.Node_Nr) return ACO.SDO_Sessions.Endpoint_Type; type Remote (Id : ACO.Messages.Node_Nr; Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new Node_Base (Id, Handler, Od) with record NMT : ACO.Protocols.Network_Management.Masters.Master (Id, Handler, Od); EC : ACO.Protocols.Error_Control.Slaves.Slave (Id, Od); SDO : Remote_Client (Id, Handler, Od); end record; end ACO.Nodes.Remotes;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Coroutines.Timeouts; with CR_Test_Proc; procedure CR_Test is begin Coroutines.Initialize; Coroutines.Timeouts.Initialize; Coroutines.Start (CR_Test_Proc'Access, 40_000); end CR_Test;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- F M A P -- -- -- -- B o d y -- -- -- -- Copyright (C) 2001-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Opt; use Opt; with Osint; use Osint; with Output; use Output; with Table; with Types; use Types; pragma Warnings (Off); -- This package is used also by gnatcoll with System.OS_Lib; use System.OS_Lib; pragma Warnings (On); with Unchecked_Conversion; with GNAT.HTable; package body Fmap is No_Mapping_File : Boolean := False; -- Set to True when the specified mapping file cannot be read in -- procedure Initialize, so that no attempt is made to open the mapping -- file in procedure Update_Mapping_File. function To_Big_String_Ptr is new Unchecked_Conversion (Source_Buffer_Ptr, Big_String_Ptr); Max_Buffer : constant := 1_500; Buffer : String (1 .. Max_Buffer); -- Used to bufferize output when writing to a new mapping file Buffer_Last : Natural := 0; -- Index of last valid character in Buffer type Mapping is record Uname : Unit_Name_Type; Fname : File_Name_Type; end record; package File_Mapping is new Table.Table ( Table_Component_Type => Mapping, Table_Index_Type => Int, Table_Low_Bound => 0, Table_Initial => 1_000, Table_Increment => 1_000, Table_Name => "Fmap.File_Mapping"); -- Mapping table to map unit names to file names package Path_Mapping is new Table.Table ( Table_Component_Type => Mapping, Table_Index_Type => Int, Table_Low_Bound => 0, Table_Initial => 1_000, Table_Increment => 1_000, Table_Name => "Fmap.Path_Mapping"); -- Mapping table to map file names to path names type Header_Num is range 0 .. 1_000; function Hash (F : Unit_Name_Type) return Header_Num; -- Function used to compute hash of unit name No_Entry : constant Int := -1; -- Signals no entry in following table package Unit_Hash_Table is new GNAT.HTable.Simple_HTable ( Header_Num => Header_Num, Element => Int, No_Element => No_Entry, Key => Unit_Name_Type, Hash => Hash, Equal => "="); -- Hash table to map unit names to file names. Used in conjunction with -- table File_Mapping above. function Hash (F : File_Name_Type) return Header_Num; -- Function used to compute hash of file name package File_Hash_Table is new GNAT.HTable.Simple_HTable ( Header_Num => Header_Num, Element => Int, No_Element => No_Entry, Key => File_Name_Type, Hash => Hash, Equal => "="); -- Hash table to map file names to path names. Used in conjunction with -- table Path_Mapping above. Last_In_Table : Int := 0; package Forbidden_Names is new GNAT.HTable.Simple_HTable ( Header_Num => Header_Num, Element => Boolean, No_Element => False, Key => File_Name_Type, Hash => Hash, Equal => "="); ----------------------------- -- Add_Forbidden_File_Name -- ----------------------------- procedure Add_Forbidden_File_Name (Name : File_Name_Type) is begin Forbidden_Names.Set (Name, True); end Add_Forbidden_File_Name; --------------------- -- Add_To_File_Map -- --------------------- procedure Add_To_File_Map (Unit_Name : Unit_Name_Type; File_Name : File_Name_Type; Path_Name : File_Name_Type) is Unit_Entry : constant Int := Unit_Hash_Table.Get (Unit_Name); File_Entry : constant Int := File_Hash_Table.Get (File_Name); begin if Unit_Entry = No_Entry or else File_Mapping.Table (Unit_Entry).Fname /= File_Name then File_Mapping.Increment_Last; Unit_Hash_Table.Set (Unit_Name, File_Mapping.Last); File_Mapping.Table (File_Mapping.Last) := (Uname => Unit_Name, Fname => File_Name); end if; if File_Entry = No_Entry or else Path_Mapping.Table (File_Entry).Fname /= Path_Name then Path_Mapping.Increment_Last; File_Hash_Table.Set (File_Name, Path_Mapping.Last); Path_Mapping.Table (Path_Mapping.Last) := (Uname => Unit_Name, Fname => Path_Name); end if; end Add_To_File_Map; ---------- -- Hash -- ---------- function Hash (F : File_Name_Type) return Header_Num is begin return Header_Num (Int (F) rem Header_Num'Range_Length); end Hash; function Hash (F : Unit_Name_Type) return Header_Num is begin return Header_Num (Int (F) rem Header_Num'Range_Length); end Hash; ---------------- -- Initialize -- ---------------- procedure Initialize (File_Name : String) is Src : Source_Buffer_Ptr; Hi : Source_Ptr; BS : Big_String_Ptr; SP : String_Ptr; First : Positive := 1; Last : Natural := 0; Uname : Unit_Name_Type; Fname : File_Name_Type; Pname : File_Name_Type; procedure Empty_Tables; -- Remove all entries in case of incorrect mapping file function Find_File_Name return File_Name_Type; -- Return Error_File_Name if the name buffer contains "/", otherwise -- call Name_Find. "/" is the path name in the mapping file to indicate -- that a source has been suppressed, and thus should not be found by -- the compiler. function Find_Unit_Name return Unit_Name_Type; -- Return the unit name in the name buffer. Return Error_Unit_Name if -- the name buffer contains "/". procedure Get_Line; -- Get a line from the mapping file, where a line is SP (First .. Last) procedure Report_Truncated; -- Report a warning when the mapping file is truncated -- (number of lines is not a multiple of 3). ------------------ -- Empty_Tables -- ------------------ procedure Empty_Tables is begin Unit_Hash_Table.Reset; File_Hash_Table.Reset; Path_Mapping.Set_Last (0); File_Mapping.Set_Last (0); Last_In_Table := 0; end Empty_Tables; -------------------- -- Find_File_Name -- -------------------- function Find_File_Name return File_Name_Type is begin if Name_Buffer (1 .. Name_Len) = "/" then -- A path name of "/" is the indication that the source has been -- "suppressed". Return Error_File_Name so that the compiler does -- not find the source, even if it is in the include path. return Error_File_Name; else return Name_Find; end if; end Find_File_Name; -------------------- -- Find_Unit_Name -- -------------------- function Find_Unit_Name return Unit_Name_Type is begin return Unit_Name_Type (Find_File_Name); end Find_Unit_Name; -------------- -- Get_Line -- -------------- procedure Get_Line is use ASCII; begin First := Last + 1; -- If not at the end of file, skip the end of line while First < SP'Last and then (SP (First) = CR or else SP (First) = LF or else SP (First) = EOF) loop First := First + 1; end loop; -- If not at the end of file, find the end of this new line if First < SP'Last and then SP (First) /= EOF then Last := First; while Last < SP'Last and then SP (Last + 1) /= CR and then SP (Last + 1) /= LF and then SP (Last + 1) /= EOF loop Last := Last + 1; end loop; end if; end Get_Line; ---------------------- -- Report_Truncated -- ---------------------- procedure Report_Truncated is begin Write_Str ("warning: mapping file """); Write_Str (File_Name); Write_Line (""" is truncated"); end Report_Truncated; -- Start of processing for Initialize begin Empty_Tables; Name_Len := File_Name'Length; Name_Buffer (1 .. Name_Len) := File_Name; Read_Source_File (Name_Enter, 0, Hi, Src, Config); if Src = null then Write_Str ("warning: could not read mapping file """); Write_Str (File_Name); Write_Line (""""); No_Mapping_File := True; else BS := To_Big_String_Ptr (Src); SP := BS (1 .. Natural (Hi))'Unrestricted_Access; loop -- Get the unit name Get_Line; -- Exit if end of file has been reached exit when First > Last; if (Last < First + 2) or else (SP (Last - 1) /= '%') or else (SP (Last) /= 's' and then SP (Last) /= 'b') then Write_Line ("warning: mapping file """ & File_Name & """ is incorrectly formatted"); Write_Line ("Line = """ & SP (First .. Last) & '"'); Empty_Tables; return; end if; Name_Len := Last - First + 1; Name_Buffer (1 .. Name_Len) := SP (First .. Last); Uname := Find_Unit_Name; -- Get the file name Get_Line; -- If end of line has been reached, file is truncated if First > Last then Report_Truncated; Empty_Tables; return; end if; Name_Len := Last - First + 1; Name_Buffer (1 .. Name_Len) := SP (First .. Last); Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len)); Fname := Find_File_Name; -- Get the path name Get_Line; -- If end of line has been reached, file is truncated if First > Last then Report_Truncated; Empty_Tables; return; end if; Name_Len := Last - First + 1; Name_Buffer (1 .. Name_Len) := SP (First .. Last); Pname := Find_File_Name; -- Add the mappings for this unit name Add_To_File_Map (Uname, Fname, Pname); end loop; end if; -- Record the length of the two mapping tables Last_In_Table := File_Mapping.Last; end Initialize; ---------------------- -- Mapped_File_Name -- ---------------------- function Mapped_File_Name (Unit : Unit_Name_Type) return File_Name_Type is The_Index : constant Int := Unit_Hash_Table.Get (Unit); begin if The_Index = No_Entry then return No_File; else return File_Mapping.Table (The_Index).Fname; end if; end Mapped_File_Name; ---------------------- -- Mapped_Path_Name -- ---------------------- function Mapped_Path_Name (File : File_Name_Type) return File_Name_Type is Index : Int := No_Entry; begin if Forbidden_Names.Get (File) then return Error_File_Name; end if; Index := File_Hash_Table.Get (File); if Index = No_Entry then return No_File; else return Path_Mapping.Table (Index).Fname; end if; end Mapped_Path_Name; ------------------ -- Reset_Tables -- ------------------ procedure Reset_Tables is begin File_Mapping.Init; Path_Mapping.Init; Unit_Hash_Table.Reset; File_Hash_Table.Reset; Forbidden_Names.Reset; Last_In_Table := 0; end Reset_Tables; ------------------------- -- Update_Mapping_File -- ------------------------- procedure Update_Mapping_File (File_Name : String) is File : File_Descriptor; N_Bytes : Integer; File_Entry : Int; Status : Boolean; -- For the call to Close procedure Put_Line (Name : Name_Id); -- Put Name as a line in the Mapping File -------------- -- Put_Line -- -------------- procedure Put_Line (Name : Name_Id) is begin Get_Name_String (Name); -- If the Buffer is full, write it to the file if Buffer_Last + Name_Len + 1 > Buffer'Last then N_Bytes := Write (File, Buffer (1)'Address, Buffer_Last); if N_Bytes < Buffer_Last then Fail ("disk full"); end if; Buffer_Last := 0; end if; -- Add the line to the Buffer Buffer (Buffer_Last + 1 .. Buffer_Last + Name_Len) := Name_Buffer (1 .. Name_Len); Buffer_Last := Buffer_Last + Name_Len + 1; Buffer (Buffer_Last) := ASCII.LF; end Put_Line; -- Start of Update_Mapping_File begin -- If the mapping file could not be read, then it will not be possible -- to update it. if No_Mapping_File then return; end if; -- Only Update if there are new entries in the mappings if Last_In_Table < File_Mapping.Last then File := Open_Read_Write (Name => File_Name, Fmode => Binary); if File /= Invalid_FD then if Last_In_Table > 0 then Lseek (File, 0, Seek_End); end if; for Unit in Last_In_Table + 1 .. File_Mapping.Last loop Put_Line (Name_Id (File_Mapping.Table (Unit).Uname)); Put_Line (Name_Id (File_Mapping.Table (Unit).Fname)); File_Entry := File_Hash_Table.Get (File_Mapping.Table (Unit).Fname); Put_Line (Name_Id (Path_Mapping.Table (File_Entry).Fname)); end loop; -- Before closing the file, write the buffer to the file. It is -- guaranteed that the Buffer is not empty, because Put_Line has -- been called at least 3 times, and after a call to Put_Line, the -- Buffer is not empty. N_Bytes := Write (File, Buffer (1)'Address, Buffer_Last); if N_Bytes < Buffer_Last then Fail ("disk full"); end if; Close (File, Status); if not Status then Fail ("disk full"); end if; elsif not Quiet_Output then Write_Str ("warning: could not open mapping file """); Write_Str (File_Name); Write_Line (""" for update"); end if; end if; end Update_Mapping_File; end Fmap;
with Ada.Integer_Text_IO; -- Copyright 2021 Melwyn Francis Carlo procedure A039 is use Ada.Integer_Text_IO; P_Max_Solutions : Integer := 0; N_Max_Solutions : Integer := 0; B, N : Integer; A, B2, P2 : Float; begin for P in reverse 500 .. 1000 loop B := 1; N := 0; loop if B = Integer (Float (P) / 2.0) then exit; end if; P2 := Float (P); B2 := Float (B); A := ((P2 * P2) - (2.0 * P2 * B2)) / ((2.0 * P2) - (2.0 * B2)); if Float'Floor (A) = A then N := N + 1; end if; B := B + 1; end loop; if N > N_Max_Solutions then N_Max_Solutions := N; P_Max_Solutions := P; end if; end loop; Put (P_Max_Solutions, Width => 0); end A039;
with Ada.Command_Line; with Ada.Directories; with Ada.Strings.Unbounded; with Ada.Text_IO; use Ada.Text_IO; package body Helpers is Program_Abspath : constant Pathname := Native.Filesystem.Join (Ada.Directories.Current_Directory, Ada.Command_Line.Command_Name, False); Test_Dir : constant Pathname := Ada.Directories.Containing_Directory (Ada.Directories.Containing_Directory (Program_Abspath)); Material_Dir : constant Pathname := Ada.Directories.Compose (Test_Dir, "material"); ---------- -- Test -- ---------- procedure Test (Status : Status_Kind) is begin if Status /= Status_Ok then raise Program_Error; end if; end Test; ------------ -- Create -- ------------ function Create (Root_Dir : Pathname; Create_If_Missing : Boolean := False) return Native.Filesystem.Native_FS_Driver_Ref is use Native.Filesystem; Abs_Root_Dir : constant Pathname := Ada.Directories.Compose (Material_Dir, Root_Dir); Result : constant Native_FS_Driver_Ref := new Native_FS_Driver; begin if Create_If_Missing and then not Ada.Directories.Exists (Abs_Root_Dir) then Ada.Directories.Create_Directory (Abs_Root_Dir); end if; Test (Create (Result.all, Abs_Root_Dir)); return Result; end Create; --------------- -- Read_File -- --------------- function Read_File (File : in out File_Handle'Class) return UInt8_Array is type UInt8_Array_Access is access UInt8_Array; procedure Destroy is new Ada.Unchecked_Deallocation (UInt8_Array, UInt8_Array_Access); Buffer : UInt8_Array_Access := new UInt8_Array (1 .. 1024); Last : Natural := 0; begin loop -- If the buffer is full, reallocate it twice bigger if Last >= Buffer'Last then declare New_Buffer : constant UInt8_Array_Access := new UInt8_Array (1 .. 2 * Buffer'Length); begin New_Buffer (1 .. Buffer'Length) := Buffer.all; Destroy (Buffer); Buffer := New_Buffer; end; end if; -- As File_Handle.Read does not tell us how many bytes it could read -- when it cannot fill the buffer, read byte by byte... case File.Read (Buffer (Last + 1 .. Last + 1)) is when Status_Ok => null; when Input_Output_Error => exit; when others => raise Program_Error; end case; Last := Last + 1; end loop; declare Result : constant UInt8_Array := Buffer (1 .. Last); begin Destroy (Buffer); return Result; end; end Read_File; ----------------- -- Quote_Bytes -- ----------------- function Quote_Bytes (Bytes : UInt8_Array) return String is use Ada.Strings.Unbounded; Result : Unbounded_String; Hex_Digits : constant array (UInt8 range 0 .. 15) of Character := "0123456789abcdef"; begin for B of Bytes loop declare C : constant Character := Character'Val (B); begin if C = '\' then Append (Result, "\\"); elsif C in ' ' .. '~' then Append (Result, C); else Append (Result, "\x" & Hex_Digits (B / 16) & Hex_Digits (B mod 16)); end if; end; end loop; return To_String (Result); end Quote_Bytes; ---------- -- Dump -- ---------- procedure Dump (FS : in out FS_Driver'Class; Dir : Pathname) is DH : Any_Directory_Handle; DE : Directory_Entry; I : Positive := 1; Status : Status_Kind; begin Put_Line ("Entering " & Dir); Test (FS.Open_Directory (Dir, DH)); loop Status := DH.Read_Entry (I, DE); exit when Status = No_Such_File_Or_Directory; Test (Status); declare Name : constant Pathname := Native.Filesystem.Join (Dir, DH.Entry_Name (I), True); begin case DE.Entry_Type is when Regular_File => Put_Line (" File: " & Name); declare File : Any_File_Handle; begin Test (FS.Open (Name, Read_Only, File)); declare Content : constant UInt8_Array := Read_File (File.all); begin Put_Line (" Contents: " & Quote_Bytes (Content)); end; Test (File.Close); end; when Directory => Dump (FS, Name); end case; end; I := I + 1; end loop; Put_Line ("Leaving " & Dir); Test (DH.Close); end Dump; end Helpers;
-- CE3601A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT GET (FOR STRINGS AND CHARACTERS), PUT (FOR STRINGS AND -- CHARACTERS), GET_LINE, AND PUT_LINE RAISE STATUS_ERROR WHEN -- CALLED WITH AN UNOPEN FILE PARAMETER. ALSO CHECK NAMES OF FORMAL -- PARAMETERS. -- HISTORY: -- SPS 08/27/82 -- VKG 02/15/83 -- JBG 03/30/83 -- JLH 09/04/87 ADDED CASE WHICH ATTEMPTS TO CREATE FILE AND THEN -- RETESTED OBJECTIVE. WITH REPORT; USE REPORT; WITH TEXT_IO; USE TEXT_IO; PROCEDURE CE3601A IS BEGIN TEST ("CE3601A", "STATUS_ERROR RAISED BY GET, PUT, GET_LINE, " & "PUT_LINE WHEN FILE IS NOT OPEN"); DECLARE FILE1, FILE2 : FILE_TYPE; CH: CHARACTER := '%'; LST: NATURAL; ST: STRING (1 .. 10); LN : STRING (1 .. 80); BEGIN BEGIN GET (FILE => FILE1, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - GET CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET CHARACTER"); END; BEGIN GET (FILE => FILE1, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - GET STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET STRING"); END; BEGIN GET_LINE (FILE => FILE1, ITEM => LN, LAST => LST); FAILED ("STATUS_ERROR NOT RAISED - GET_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET_LINE"); END; BEGIN PUT (FILE => FILE1, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - PUT CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT CHARACTER"); END; BEGIN PUT (FILE => FILE1, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - PUT STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT STRING"); END; BEGIN PUT_LINE (FILE => FILE1, ITEM => LN); FAILED ("STATUS_ERROR NOT RAISED - PUT_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT_LINE"); END; BEGIN CREATE (FILE2, OUT_FILE); -- THIS IS ONLY AN ATTEMPT TO CLOSE (FILE2); -- CREATE A FILE. OK, WHETHER EXCEPTION -- SUCCESSFUL OR NOT. WHEN USE_ERROR => NULL; END; BEGIN GET (FILE => FILE2, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - GET CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET CHARACTER"); END; BEGIN GET (FILE => FILE2, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - GET STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET STRING"); END; BEGIN GET_LINE (FILE => FILE2, ITEM => LN, LAST => LST); FAILED ("STATUS_ERROR NOT RAISED - GET_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - GET_LINE"); END; BEGIN PUT (FILE => FILE2, ITEM => CH); FAILED ("STATUS_ERROR NOT RAISED - PUT CHARACTER"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT CHARACTER"); END; BEGIN PUT (FILE => FILE2, ITEM => ST); FAILED ("STATUS_ERROR NOT RAISED - PUT STRING"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT STRING"); END; BEGIN PUT_LINE (FILE => FILE2, ITEM => LN); FAILED ("STATUS_ERROR NOT RAISED - PUT_LINE"); EXCEPTION WHEN STATUS_ERROR => NULL; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - PUT_LINE"); END; END; RESULT; END CE3601A;
with Ada.Text_IO; use Ada.Text_IO; procedure Test_Age_Madness is subtype Age_Type is Natural range 0 .. 140; subtype Age_Distance is Integer; -- the following subtype is better --subtype Age_Distance is Integer range -Age_Type'Last .. Age_Type'Last; Adult_Age : constant Age_Type := 18; -- Q: "How many years ago have you kissed?" -- A: "Well, let me think, it must be fiftysix years ago or so" function Get_Dist_From_First_Kiss return Age_Distance is (56); -- Age guessed by the AI analyzing the subject function Guess_Age return Age_Type is (19); -- Q: "Have you ever kissed?" -- A: "Sure, I did!" function Have_You_Ever_Kissed return Boolean is (True); -- We have the number of years passed since subject's first kiss, -- and subject's age. Let's compute the age she had her first kiss. function Age_Of_Kiss (Current_Age : Age_Type) return Age_Type is Dist_Of_First_Kiss : constant Age_Distance := Get_Dist_From_First_Kiss; begin return Current_Age - Dist_Of_First_Kiss; end Age_Of_Kiss; First_Kiss_Age : Age_Type; begin if Have_You_Ever_Kissed then First_Kiss_Age := Age_Of_Kiss (Guess_Age); if First_Kiss_Age < Adult_Age then Put_Line ("you weren't adult!"); else Put_Line ("so, you waiting for so long..."); end if; end if; end Test_Age_Madness;
with Ada.Wide_Wide_Text_IO; with League.Application; with League.Strings; procedure Main is begin for J in 1 .. League.Application.Arguments.Length loop Ada.Wide_Wide_Text_IO.Put_Line (League.Application.Arguments.Element (J).To_Wide_Wide_String); end loop; end Main;
-- Euler1 in Ada with Ada.Text_IO; with Ada.Integer_Text_IO; procedure Euler1_1 is function Euler(size : in Integer) return Integer is result: Integer; begin result := 0; for i in 1..size-1 loop if i mod 3 = 0 or i mod 5 = 0 then result := result + i; end if; end loop; return result; end Euler; begin Ada.Text_IO.Put ("Euler1 = "); Ada.Integer_Text_IO.Put (Integer( Euler(1000) ), 6); end Euler1_1;
pragma License (Unrestricted); with Ada.Containers; with Ada.Strings.Wide_Wide_Hash; function Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash (Key : Wide_Wide_String) return Containers.Hash_Type renames Strings.Wide_Wide_Hash; pragma Pure (Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash);
-- Generated at 2014-06-02 19:12:04 +0000 by Natools.Static_Hash_Maps -- from ../src/natools-s_expressions-printers-pretty-config-commands.sx private package Natools.S_Expressions.Printers.Pretty.Config.Commands is pragma Preelaborate; type Main_Command is (Set_Char_Encoding, Set_Fallback, Set_Hex_Casing, Set_Indentation, Set_Newline, Set_Newline_Encoding, Set_Quoted, Set_Quoted_String, Set_Space_At, Set_Tab_Stop, Set_Token, Set_Width); type Newline_Command is (Set_Newline_Command_Encoding, Set_Newline_Separator); type Quoted_String_Command is (Set_Quoted_Option, Set_Quoted_Escape); type Separator_Command is (All_Separators, No_Separators, Invert_Separators, Open_Open, Open_Atom, Open_Close, Atom_Open, Atom_Atom, Atom_Close, Close_Open, Close_Atom, Close_Close); function Main (Key : String) return Main_Command; function Newline (Key : String) return Newline_Command; function Quoted_String (Key : String) return Quoted_String_Command; function Separator (Key : String) return Separator_Command; function To_Atom_Encoding (Key : String) return Atom_Encoding; function To_Character_Encoding (Key : String) return Character_Encoding; function To_Hex_Casing (Key : String) return Encodings.Hex_Casing; function To_Newline_Encoding (Key : String) return Newline_Encoding; function To_Quoted_Escape (Key : String) return Quoted_Escape_Type; function To_Quoted_Option (Key : String) return Quoted_Option; function To_Token_Option (Key : String) return Token_Option; private Map_1_Key_0 : aliased constant String := "ascii"; Map_1_Key_1 : aliased constant String := "ASCII"; Map_1_Key_2 : aliased constant String := "latin-1"; Map_1_Key_3 : aliased constant String := "latin"; Map_1_Key_4 : aliased constant String := "iso-8859-1"; Map_1_Key_5 : aliased constant String := "ISO-8859-1"; Map_1_Key_6 : aliased constant String := "utf-8"; Map_1_Key_7 : aliased constant String := "UTF-8"; Map_1_Key_8 : aliased constant String := "utf8"; Map_1_Key_9 : aliased constant String := "UTF8"; Map_1_Key_10 : aliased constant String := "base64"; Map_1_Key_11 : aliased constant String := "base-64"; Map_1_Key_12 : aliased constant String := "lower-hex"; Map_1_Key_13 : aliased constant String := "lower-hexa"; Map_1_Key_14 : aliased constant String := "hex"; Map_1_Key_15 : aliased constant String := "hexa"; Map_1_Key_16 : aliased constant String := "hexadecimal"; Map_1_Key_17 : aliased constant String := "upper-hex"; Map_1_Key_18 : aliased constant String := "upper-hexa"; Map_1_Key_19 : aliased constant String := "verbatim"; Map_1_Key_20 : aliased constant String := "lower"; Map_1_Key_21 : aliased constant String := "lower-case"; Map_1_Key_22 : aliased constant String := "upper"; Map_1_Key_23 : aliased constant String := "upper-case"; Map_1_Key_24 : aliased constant String := "indent"; Map_1_Key_25 : aliased constant String := "indentation"; Map_1_Key_26 : aliased constant String := "no-indent"; Map_1_Key_27 : aliased constant String := "no-indentation"; Map_1_Key_28 : aliased constant String := "newline"; Map_1_Key_29 : aliased constant String := "cr"; Map_1_Key_30 : aliased constant String := "CR"; Map_1_Key_31 : aliased constant String := "lf"; Map_1_Key_32 : aliased constant String := "LF"; Map_1_Key_33 : aliased constant String := "CRLF"; Map_1_Key_34 : aliased constant String := "CR-LF"; Map_1_Key_35 : aliased constant String := "crlf"; Map_1_Key_36 : aliased constant String := "cr-lf"; Map_1_Key_37 : aliased constant String := "lf-cr"; Map_1_Key_38 : aliased constant String := "lfcr"; Map_1_Key_39 : aliased constant String := "LF-CR"; Map_1_Key_40 : aliased constant String := "LFCR"; Map_1_Key_41 : aliased constant String := "no-quoted"; Map_1_Key_42 : aliased constant String := "no-quoted-string"; Map_1_Key_43 : aliased constant String := "quoted-when-shorter"; Map_1_Key_44 : aliased constant String := "quoted-string-when-shorter"; Map_1_Key_45 : aliased constant String := "single-line-quoted"; Map_1_Key_46 : aliased constant String := "single-line-quoted-string"; Map_1_Key_47 : aliased constant String := "escape"; Map_1_Key_48 : aliased constant String := "quoted"; Map_1_Key_49 : aliased constant String := "space"; Map_1_Key_50 : aliased constant String := "tab-stop"; Map_1_Key_51 : aliased constant String := "extended-token"; Map_1_Key_52 : aliased constant String := "no-token"; Map_1_Key_53 : aliased constant String := "standard-token"; Map_1_Key_54 : aliased constant String := "token"; Map_1_Key_55 : aliased constant String := "width"; Map_1_Key_56 : aliased constant String := "no-width"; Map_1_Keys : constant array (0 .. 56) of access constant String := (Map_1_Key_0'Access, Map_1_Key_1'Access, Map_1_Key_2'Access, Map_1_Key_3'Access, Map_1_Key_4'Access, Map_1_Key_5'Access, Map_1_Key_6'Access, Map_1_Key_7'Access, Map_1_Key_8'Access, Map_1_Key_9'Access, Map_1_Key_10'Access, Map_1_Key_11'Access, Map_1_Key_12'Access, Map_1_Key_13'Access, Map_1_Key_14'Access, Map_1_Key_15'Access, Map_1_Key_16'Access, Map_1_Key_17'Access, Map_1_Key_18'Access, Map_1_Key_19'Access, Map_1_Key_20'Access, Map_1_Key_21'Access, Map_1_Key_22'Access, Map_1_Key_23'Access, Map_1_Key_24'Access, Map_1_Key_25'Access, Map_1_Key_26'Access, Map_1_Key_27'Access, Map_1_Key_28'Access, Map_1_Key_29'Access, Map_1_Key_30'Access, Map_1_Key_31'Access, Map_1_Key_32'Access, Map_1_Key_33'Access, Map_1_Key_34'Access, Map_1_Key_35'Access, Map_1_Key_36'Access, Map_1_Key_37'Access, Map_1_Key_38'Access, Map_1_Key_39'Access, Map_1_Key_40'Access, Map_1_Key_41'Access, Map_1_Key_42'Access, Map_1_Key_43'Access, Map_1_Key_44'Access, Map_1_Key_45'Access, Map_1_Key_46'Access, Map_1_Key_47'Access, Map_1_Key_48'Access, Map_1_Key_49'Access, Map_1_Key_50'Access, Map_1_Key_51'Access, Map_1_Key_52'Access, Map_1_Key_53'Access, Map_1_Key_54'Access, Map_1_Key_55'Access, Map_1_Key_56'Access); Map_1_Elements : constant array (0 .. 56) of Main_Command := (Set_Char_Encoding, Set_Char_Encoding, Set_Char_Encoding, Set_Char_Encoding, Set_Char_Encoding, Set_Char_Encoding, Set_Char_Encoding, Set_Char_Encoding, Set_Char_Encoding, Set_Char_Encoding, Set_Fallback, Set_Fallback, Set_Fallback, Set_Fallback, Set_Fallback, Set_Fallback, Set_Fallback, Set_Fallback, Set_Fallback, Set_Fallback, Set_Hex_Casing, Set_Hex_Casing, Set_Hex_Casing, Set_Hex_Casing, Set_Indentation, Set_Indentation, Set_Indentation, Set_Indentation, Set_Newline, Set_Newline_Encoding, Set_Newline_Encoding, Set_Newline_Encoding, Set_Newline_Encoding, Set_Newline_Encoding, Set_Newline_Encoding, Set_Newline_Encoding, Set_Newline_Encoding, Set_Newline_Encoding, Set_Newline_Encoding, Set_Newline_Encoding, Set_Newline_Encoding, Set_Quoted, Set_Quoted, Set_Quoted, Set_Quoted, Set_Quoted, Set_Quoted, Set_Quoted_String, Set_Quoted_String, Set_Space_At, Set_Tab_Stop, Set_Token, Set_Token, Set_Token, Set_Token, Set_Width, Set_Width); Map_2_Key_0 : aliased constant String := "cr"; Map_2_Key_1 : aliased constant String := "CR"; Map_2_Key_2 : aliased constant String := "lf"; Map_2_Key_3 : aliased constant String := "LF"; Map_2_Key_4 : aliased constant String := "CRLF"; Map_2_Key_5 : aliased constant String := "CR-LF"; Map_2_Key_6 : aliased constant String := "crlf"; Map_2_Key_7 : aliased constant String := "cr-lf"; Map_2_Key_8 : aliased constant String := "lf-cr"; Map_2_Key_9 : aliased constant String := "lfcr"; Map_2_Key_10 : aliased constant String := "LF-CR"; Map_2_Key_11 : aliased constant String := "LFCR"; Map_2_Key_12 : aliased constant String := "all"; Map_2_Key_13 : aliased constant String := "none"; Map_2_Key_14 : aliased constant String := "not"; Map_2_Key_15 : aliased constant String := "open-open"; Map_2_Key_16 : aliased constant String := "open-atom"; Map_2_Key_17 : aliased constant String := "open-close"; Map_2_Key_18 : aliased constant String := "atom-open"; Map_2_Key_19 : aliased constant String := "atom-atom"; Map_2_Key_20 : aliased constant String := "atom-close"; Map_2_Key_21 : aliased constant String := "close-open"; Map_2_Key_22 : aliased constant String := "close-atom"; Map_2_Key_23 : aliased constant String := "close-close"; Map_2_Keys : constant array (0 .. 23) of access constant String := (Map_2_Key_0'Access, Map_2_Key_1'Access, Map_2_Key_2'Access, Map_2_Key_3'Access, Map_2_Key_4'Access, Map_2_Key_5'Access, Map_2_Key_6'Access, Map_2_Key_7'Access, Map_2_Key_8'Access, Map_2_Key_9'Access, Map_2_Key_10'Access, Map_2_Key_11'Access, Map_2_Key_12'Access, Map_2_Key_13'Access, Map_2_Key_14'Access, Map_2_Key_15'Access, Map_2_Key_16'Access, Map_2_Key_17'Access, Map_2_Key_18'Access, Map_2_Key_19'Access, Map_2_Key_20'Access, Map_2_Key_21'Access, Map_2_Key_22'Access, Map_2_Key_23'Access); Map_2_Elements : constant array (0 .. 23) of Newline_Command := (Set_Newline_Command_Encoding, Set_Newline_Command_Encoding, Set_Newline_Command_Encoding, Set_Newline_Command_Encoding, Set_Newline_Command_Encoding, Set_Newline_Command_Encoding, Set_Newline_Command_Encoding, Set_Newline_Command_Encoding, Set_Newline_Command_Encoding, Set_Newline_Command_Encoding, Set_Newline_Command_Encoding, Set_Newline_Command_Encoding, Set_Newline_Separator, Set_Newline_Separator, Set_Newline_Separator, Set_Newline_Separator, Set_Newline_Separator, Set_Newline_Separator, Set_Newline_Separator, Set_Newline_Separator, Set_Newline_Separator, Set_Newline_Separator, Set_Newline_Separator, Set_Newline_Separator); Map_3_Key_0 : aliased constant String := "never"; Map_3_Key_1 : aliased constant String := "single-line"; Map_3_Key_2 : aliased constant String := "when-shorter"; Map_3_Key_3 : aliased constant String := "octal"; Map_3_Key_4 : aliased constant String := "hex"; Map_3_Key_5 : aliased constant String := "hexa"; Map_3_Key_6 : aliased constant String := "hexadecimal"; Map_3_Key_7 : aliased constant String := "lower-hex"; Map_3_Key_8 : aliased constant String := "lower-hexa"; Map_3_Key_9 : aliased constant String := "upper-hex"; Map_3_Key_10 : aliased constant String := "upper-hexa"; Map_3_Keys : constant array (0 .. 10) of access constant String := (Map_3_Key_0'Access, Map_3_Key_1'Access, Map_3_Key_2'Access, Map_3_Key_3'Access, Map_3_Key_4'Access, Map_3_Key_5'Access, Map_3_Key_6'Access, Map_3_Key_7'Access, Map_3_Key_8'Access, Map_3_Key_9'Access, Map_3_Key_10'Access); Map_3_Elements : constant array (0 .. 10) of Quoted_String_Command := (Set_Quoted_Option, Set_Quoted_Option, Set_Quoted_Option, Set_Quoted_Escape, Set_Quoted_Escape, Set_Quoted_Escape, Set_Quoted_Escape, Set_Quoted_Escape, Set_Quoted_Escape, Set_Quoted_Escape, Set_Quoted_Escape); Map_4_Key_0 : aliased constant String := "all"; Map_4_Key_1 : aliased constant String := "none"; Map_4_Key_2 : aliased constant String := "not"; Map_4_Key_3 : aliased constant String := "open-open"; Map_4_Key_4 : aliased constant String := "open-atom"; Map_4_Key_5 : aliased constant String := "open-close"; Map_4_Key_6 : aliased constant String := "atom-open"; Map_4_Key_7 : aliased constant String := "atom-atom"; Map_4_Key_8 : aliased constant String := "atom-close"; Map_4_Key_9 : aliased constant String := "close-open"; Map_4_Key_10 : aliased constant String := "close-atom"; Map_4_Key_11 : aliased constant String := "close-close"; Map_4_Keys : constant array (0 .. 11) of access constant String := (Map_4_Key_0'Access, Map_4_Key_1'Access, Map_4_Key_2'Access, Map_4_Key_3'Access, Map_4_Key_4'Access, Map_4_Key_5'Access, Map_4_Key_6'Access, Map_4_Key_7'Access, Map_4_Key_8'Access, Map_4_Key_9'Access, Map_4_Key_10'Access, Map_4_Key_11'Access); Map_4_Elements : constant array (0 .. 11) of Separator_Command := (All_Separators, No_Separators, Invert_Separators, Open_Open, Open_Atom, Open_Close, Atom_Open, Atom_Atom, Atom_Close, Close_Open, Close_Atom, Close_Close); Map_5_Key_0 : aliased constant String := "base64"; Map_5_Key_1 : aliased constant String := "base-64"; Map_5_Key_2 : aliased constant String := "lower-hex"; Map_5_Key_3 : aliased constant String := "lower-hexa"; Map_5_Key_4 : aliased constant String := "hex"; Map_5_Key_5 : aliased constant String := "hexa"; Map_5_Key_6 : aliased constant String := "hexadecimal"; Map_5_Key_7 : aliased constant String := "upper-hex"; Map_5_Key_8 : aliased constant String := "upper-hexa"; Map_5_Key_9 : aliased constant String := "verbatim"; Map_5_Keys : constant array (0 .. 9) of access constant String := (Map_5_Key_0'Access, Map_5_Key_1'Access, Map_5_Key_2'Access, Map_5_Key_3'Access, Map_5_Key_4'Access, Map_5_Key_5'Access, Map_5_Key_6'Access, Map_5_Key_7'Access, Map_5_Key_8'Access, Map_5_Key_9'Access); Map_5_Elements : constant array (0 .. 9) of Atom_Encoding := (Base64, Base64, Hexadecimal, Hexadecimal, Hexadecimal, Hexadecimal, Hexadecimal, Hexadecimal, Hexadecimal, Verbatim); Map_6_Key_0 : aliased constant String := "ascii"; Map_6_Key_1 : aliased constant String := "ASCII"; Map_6_Key_2 : aliased constant String := "latin-1"; Map_6_Key_3 : aliased constant String := "latin"; Map_6_Key_4 : aliased constant String := "iso-8859-1"; Map_6_Key_5 : aliased constant String := "ISO-8859-1"; Map_6_Key_6 : aliased constant String := "utf-8"; Map_6_Key_7 : aliased constant String := "UTF-8"; Map_6_Key_8 : aliased constant String := "utf8"; Map_6_Key_9 : aliased constant String := "UTF8"; Map_6_Keys : constant array (0 .. 9) of access constant String := (Map_6_Key_0'Access, Map_6_Key_1'Access, Map_6_Key_2'Access, Map_6_Key_3'Access, Map_6_Key_4'Access, Map_6_Key_5'Access, Map_6_Key_6'Access, Map_6_Key_7'Access, Map_6_Key_8'Access, Map_6_Key_9'Access); Map_6_Elements : constant array (0 .. 9) of Character_Encoding := (ASCII, ASCII, Latin, Latin, Latin, Latin, UTF_8, UTF_8, UTF_8, UTF_8); Map_7_Key_0 : aliased constant String := "lower"; Map_7_Key_1 : aliased constant String := "lower-case"; Map_7_Key_2 : aliased constant String := "upper"; Map_7_Key_3 : aliased constant String := "upper-case"; Map_7_Keys : constant array (0 .. 3) of access constant String := (Map_7_Key_0'Access, Map_7_Key_1'Access, Map_7_Key_2'Access, Map_7_Key_3'Access); Map_7_Elements : constant array (0 .. 3) of Encodings.Hex_Casing := (Encodings.Lower, Encodings.Lower, Encodings.Upper, Encodings.Upper); Map_8_Key_0 : aliased constant String := "CR"; Map_8_Key_1 : aliased constant String := "cr"; Map_8_Key_2 : aliased constant String := "LF"; Map_8_Key_3 : aliased constant String := "lf"; Map_8_Key_4 : aliased constant String := "CRLF"; Map_8_Key_5 : aliased constant String := "CR-LF"; Map_8_Key_6 : aliased constant String := "crlf"; Map_8_Key_7 : aliased constant String := "cr-lf"; Map_8_Key_8 : aliased constant String := "LFCR"; Map_8_Key_9 : aliased constant String := "LF-CR"; Map_8_Key_10 : aliased constant String := "lfcr"; Map_8_Key_11 : aliased constant String := "lf-cr"; Map_8_Keys : constant array (0 .. 11) of access constant String := (Map_8_Key_0'Access, Map_8_Key_1'Access, Map_8_Key_2'Access, Map_8_Key_3'Access, Map_8_Key_4'Access, Map_8_Key_5'Access, Map_8_Key_6'Access, Map_8_Key_7'Access, Map_8_Key_8'Access, Map_8_Key_9'Access, Map_8_Key_10'Access, Map_8_Key_11'Access); Map_8_Elements : constant array (0 .. 11) of Newline_Encoding := (CR, CR, LF, LF, CR_LF, CR_LF, CR_LF, CR_LF, LF_CR, LF_CR, LF_CR, LF_CR); Map_9_Key_0 : aliased constant String := "octal"; Map_9_Key_1 : aliased constant String := "hex"; Map_9_Key_2 : aliased constant String := "hexa"; Map_9_Key_3 : aliased constant String := "hexadecimal"; Map_9_Key_4 : aliased constant String := "lower-hex"; Map_9_Key_5 : aliased constant String := "lower-hexa"; Map_9_Key_6 : aliased constant String := "upper-hex"; Map_9_Key_7 : aliased constant String := "upper-hexa"; Map_9_Keys : constant array (0 .. 7) of access constant String := (Map_9_Key_0'Access, Map_9_Key_1'Access, Map_9_Key_2'Access, Map_9_Key_3'Access, Map_9_Key_4'Access, Map_9_Key_5'Access, Map_9_Key_6'Access, Map_9_Key_7'Access); Map_9_Elements : constant array (0 .. 7) of Quoted_Escape_Type := (Octal_Escape, Hex_Escape, Hex_Escape, Hex_Escape, Hex_Escape, Hex_Escape, Hex_Escape, Hex_Escape); Map_10_Key_0 : aliased constant String := "when-shorter"; Map_10_Key_1 : aliased constant String := "quoted-when-shorter"; Map_10_Key_2 : aliased constant String := "quoted-string-when-shorter"; Map_10_Key_3 : aliased constant String := "single-line"; Map_10_Key_4 : aliased constant String := "single-line-quoted"; Map_10_Key_5 : aliased constant String := "single-line-quoted-string"; Map_10_Key_6 : aliased constant String := "never"; Map_10_Key_7 : aliased constant String := "no-quoted"; Map_10_Key_8 : aliased constant String := "no-quoted-string"; Map_10_Keys : constant array (0 .. 8) of access constant String := (Map_10_Key_0'Access, Map_10_Key_1'Access, Map_10_Key_2'Access, Map_10_Key_3'Access, Map_10_Key_4'Access, Map_10_Key_5'Access, Map_10_Key_6'Access, Map_10_Key_7'Access, Map_10_Key_8'Access); Map_10_Elements : constant array (0 .. 8) of Quoted_Option := (When_Shorter, When_Shorter, When_Shorter, Single_Line, Single_Line, Single_Line, No_Quoted, No_Quoted, No_Quoted); Map_11_Key_0 : aliased constant String := "extended-token"; Map_11_Key_1 : aliased constant String := "extended"; Map_11_Key_2 : aliased constant String := "standard-token"; Map_11_Key_3 : aliased constant String := "token"; Map_11_Key_4 : aliased constant String := "standard"; Map_11_Key_5 : aliased constant String := "no-token"; Map_11_Key_6 : aliased constant String := "no"; Map_11_Key_7 : aliased constant String := "none"; Map_11_Key_8 : aliased constant String := "never"; Map_11_Keys : constant array (0 .. 8) of access constant String := (Map_11_Key_0'Access, Map_11_Key_1'Access, Map_11_Key_2'Access, Map_11_Key_3'Access, Map_11_Key_4'Access, Map_11_Key_5'Access, Map_11_Key_6'Access, Map_11_Key_7'Access, Map_11_Key_8'Access); Map_11_Elements : constant array (0 .. 8) of Token_Option := (Extended_Token, Extended_Token, Standard_Token, Standard_Token, Standard_Token, No_Token, No_Token, No_Token, No_Token); end Natools.S_Expressions.Printers.Pretty.Config.Commands;
------------------------------------------------------------------------------ -- Copyright (c) 2015-2019, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Ada.Characters.Handling; with Ada.Strings.Fixed; package body Natools.S_Expressions.Enumeration_IO is function To_Atom (Enumeration_Image : in String) return Atom is Result : Atom := S_Expressions.To_Atom (Ada.Strings.Fixed.Translate (Enumeration_Image, Ada.Characters.Handling.To_Lower'Access)); begin for I in Result'Range loop if Result (I) = Character'Pos ('_') then Result (I) := Character'Pos ('-'); end if; end loop; return Result; end To_Atom; function To_Image (Data : in Atom) return String is Result : String := Ada.Strings.Fixed.Translate (To_String (Data), Ada.Characters.Handling.To_Upper'Access); begin for I in Result'Range loop if Result (I) = '-' then Result (I) := '_'; end if; end loop; return Result; end To_Image; package body Typed_IO is function Image (T : Enum) return Atom is begin return To_Atom (Enum'Image (T)); end Image; function Value (Data : Atom) return Enum is begin return Enum'Value (To_Image (Data)); end Value; function Value (Data : Atom; Fallback : Enum) return Enum is Img : constant String := To_Image (Data); begin return Enum'Value (Img); exception when Constraint_Error => return Fallback; end Value; end Typed_IO; end Natools.S_Expressions.Enumeration_IO;
----------------------------------------------------------------------- -- util-dates-formats-tests - Test for date formats -- Copyright (C) 2011, 2013, 2014 Stephane Carrez -- Written by Stephane Carrez (Stephane.Carrez@gmail.com) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Calendar.Formatting; with Util.Test_Caller; with Util.Assertions; with Util.Properties.Bundles; with Util.Log.Loggers; package body Util.Dates.Formats.Tests is use Util.Tests; use Ada.Strings.Unbounded; -- The logger Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Util.Dates.Formats.Tests"); package Caller is new Util.Test_Caller (Test, "Dates"); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Util.Dates.Split", Test_Split'Access); Caller.Add_Test (Suite, "Test Util.Dates.Formats.Format", Test_Format'Access); Caller.Add_Test (Suite, "Test Util.Dates.Get_Day_Start", Test_Get_Day_Start'Access); Caller.Add_Test (Suite, "Test Util.Dates.Get_Week_Start", Test_Get_Week_Start'Access); Caller.Add_Test (Suite, "Test Util.Dates.Get_Month_Start", Test_Get_Month_Start'Access); Caller.Add_Test (Suite, "Test Util.Dates.Get_Day_End", Test_Get_Day_End'Access); Caller.Add_Test (Suite, "Test Util.Dates.Get_Week_End", Test_Get_Week_End'Access); Caller.Add_Test (Suite, "Test Util.Dates.Get_Month_End", Test_Get_Month_End'Access); end Add_Tests; procedure Test_Format (T : in out Test) is Bundle : Util.Properties.Bundles.Manager; procedure Check (Pattern : in String; Date : in Ada.Calendar.Time; Expect : in String); procedure Check (Pattern : in String; Date : in Ada.Calendar.Time; Expect : in String) is Result : Ada.Strings.Unbounded.Unbounded_String; begin Util.Dates.Formats.Format (Pattern => Pattern, Date => Date, Bundle => Bundle, Into => Result); Util.Tests.Assert_Equals (T, Expect, To_String (Result), "Invalid result for: " & Pattern); end Check; T1 : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (1980, 1, 2, 10, 30, 23); T2 : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (2011, 11, 19, 0, 0, 0); T3 : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (2011, 11, 19, 23, 0, 0); begin Check ("%H", T1, "10"); Check ("%H", T2, "00"); Check ("%I", T3, "11"); Check ("%k", T2, " 0"); Check ("%k", T3, "23"); Check ("%l", T2, " 0"); Check ("%l", T3, "11"); Check ("%r", T3, "11:00:00 PM"); Check ("%r", T2, "00:00:00 AM"); Check ("%R:%S", T3, "23:00:00"); Check ("%y-%Y %m/%d %T", T1, "80-1980 01/02 10:30:23"); Check ("%C %d %D", T1, "19 02 01/02/80"); Check ("%e", T1, " 1"); Check ("%F", T1, "1980-01-02"); Check ("%G", T1, "1980W01"); Check ("%g", T1, "80W01"); end Test_Format; procedure Check (T : in out Test'Class; Year : in Ada.Calendar.Year_Number; Month : in Ada.Calendar.Month_Number; Day : in Ada.Calendar.Day_Number; Expect_Day : in Ada.Calendar.Day_Number; Message : in String; Is_End : in Boolean; Operation : access function (D : in Ada.Calendar.Time) return Ada.Calendar.Time) is use type Ada.Calendar.Time; Date : Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (Year, Month, Day, 0, 0, 0); begin for I in 1 .. 47 loop declare R : constant Ada.Calendar.Time := Operation (Date); D : Date_Record; begin Split (D, R); Log.Info ("{0} ({1}) => {2}", Ada.Calendar.Formatting.Image (Date), Message, Ada.Calendar.Formatting.Image (R)); Util.Tests.Assert_Equals (T, Natural (Year), Natural (D.Year), "Invalid year " & Message); Util.Tests.Assert_Equals (T, Natural (Month), Natural (D.Month), "Invalid month " & Message); Util.Tests.Assert_Equals (T, Natural (Expect_Day), Natural (D.Month_Day), "Invalid day " & Message); if Is_End then Util.Tests.Assert_Equals (T, 23, Natural (D.Hour), "Invalid hour " & Message); Util.Tests.Assert_Equals (T, 59, Natural (D.Minute), "Invalid minute " & Message); Util.Tests.Assert_Equals (T, 59, Natural (D.Second), "Invalid second " & Message); else Util.Tests.Assert_Equals (T, 0, Natural (D.Hour), "Invalid hour " & Message); Util.Tests.Assert_Equals (T, 0, Natural (D.Minute), "Invalid minute " & Message); Util.Tests.Assert_Equals (T, 0, Natural (D.Second), "Invalid second " & Message); end if; end; Date := Date + 1800.0; end loop; end Check; -- ------------------------------ -- Test the Get_Day_Start operation. -- ------------------------------ procedure Test_Get_Day_Start (T : in out Test) is begin Check (T, 2013, 6, 04, 04, "Get_Day_Start", False, Get_Day_Start'Access); Check (T, 2010, 2, 14, 14, "Get_Day_Start", False, Get_Day_Start'Access); end Test_Get_Day_Start; -- ------------------------------ -- Test the Get_Week_Start operation. -- ------------------------------ procedure Test_Get_Week_Start (T : in out Test) is begin Check (T, 2013, 6, 04, 03, "Get_Week_Start", False, Get_Week_Start'Access); Check (T, 2013, 6, 03, 03, "Get_Week_Start", False, Get_Week_Start'Access); Check (T, 2013, 6, 05, 03, "Get_Week_Start", False, Get_Week_Start'Access); Check (T, 2013, 6, 08, 03, "Get_Week_Start", False, Get_Week_Start'Access); Check (T, 2010, 2, 14, 08, "Get_Week_Start", False, Get_Week_Start'Access); Check (T, 2010, 2, 13, 08, "Get_Week_Start", False, Get_Week_Start'Access); Check (T, 2010, 2, 10, 08, "Get_Week_Start", False, Get_Week_Start'Access); Check (T, 2010, 2, 15, 15, "Get_Week_Start", False, Get_Week_Start'Access); end Test_Get_Week_Start; -- ------------------------------ -- Test the Get_Month_Start operation. -- ------------------------------ procedure Test_Get_Month_Start (T : in out Test) is begin Check (T, 2013, 6, 04, 01, "Get_Month_Start", False, Get_Month_Start'Access); Check (T, 2010, 2, 14, 01, "Get_Month_Start", False, Get_Month_Start'Access); end Test_Get_Month_Start; -- ------------------------------ -- Test the Get_Day_End operation. -- ------------------------------ procedure Test_Get_Day_End (T : in out Test) is begin Check (T, 2013, 6, 04, 04, "Get_Day_Start", True, Get_Day_End'Access); Check (T, 2010, 2, 14, 14, "Get_Day_Start", True, Get_Day_End'Access); end Test_Get_Day_End; -- ------------------------------ -- Test the Get_Week_End operation. -- ------------------------------ procedure Test_Get_Week_End (T : in out Test) is begin Check (T, 2013, 6, 04, 09, "Get_Week_End", True, Get_Week_End'Access); Check (T, 2013, 6, 03, 09, "Get_Week_End", True, Get_Week_End'Access); Check (T, 2013, 6, 05, 09, "Get_Week_End", True, Get_Week_End'Access); Check (T, 2013, 6, 08, 09, "Get_Week_End", True, Get_Week_End'Access); Check (T, 2010, 2, 14, 14, "Get_Week_End", True, Get_Week_End'Access); Check (T, 2010, 2, 13, 14, "Get_Week_End", True, Get_Week_End'Access); Check (T, 2010, 2, 10, 14, "Get_Week_End", True, Get_Week_End'Access); Check (T, 2010, 2, 15, 21, "Get_Week_End", True, Get_Week_End'Access); end Test_Get_Week_End; -- ------------------------------ -- Test the Get_Month_End operation. -- ------------------------------ procedure Test_Get_Month_End (T : in out Test) is begin Check (T, 2013, 6, 04, 30, "Get_Month_End", True, Get_Month_End'Access); Check (T, 2010, 2, 14, 28, "Get_Month_End", True, Get_Month_End'Access); Check (T, 2000, 2, 14, 29, "Get_Month_End", True, Get_Month_End'Access); end Test_Get_Month_End; -- ------------------------------ -- Test the Split operation. -- ------------------------------ procedure Test_Split (T : in out Test) is procedure Assert_Equals is new Util.Assertions.Assert_Equals_T (Ada.Calendar.Formatting.Day_Name); Date : constant Ada.Calendar.Time := Ada.Calendar.Formatting.Time_Of (2014, 11, 12, 23, 30, 0); D : Date_Record; begin Split (D, Date); Util.Tests.Assert_Equals (T, 2014, Natural (D.Year), "Invalid year "); Util.Tests.Assert_Equals (T, 11, Natural (D.Month), "Invalid month "); Util.Tests.Assert_Equals (T, 12, Natural (D.Month_Day), "Invalid day "); Util.Tests.Assert_Equals (T, 23, Natural (D.Hour), "Invalid hour "); Util.Tests.Assert_Equals (T, 30, Natural (D.Minute), "Invalid minute "); Assert_Equals (T, Ada.Calendar.Formatting.Wednesday, D.Day, "Invalid day "); end Test_Split; end Util.Dates.Formats.Tests;
package body Pack10_Pkg is procedure Proc is begin null; end; end Pack10_Pkg;
-- WORDS, a Latin dictionary, by Colonel William Whitaker (USAF, Retired) -- -- Copyright William A. Whitaker (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. package Latin_Utils.Latin_File_Names is -- In order to port the program LATIN to another system, the file names -- must be made consistent with that system. -- This package is withed into all units that declare external file names -- and its modification should take care of the system dependence of names -- Then one needs to copy the ASCII data files on the disk to files named -- in accordance with the modified package. -- Note that there are some files that take extensions in DOS, and there -- is a function that takes those extensions and makes a legal file name. -- In other systems this will have to be handled to Create a legal file name -- This package can be presented as the first to be compiled, however -- the actual need for file mames does not come until deep in the system -- Conventionally, the naming is Put off until the file is actually -- used, and the name is passed as a parameter from there to the -- earlier procedures which call them -- The following files are used in the DOS LATIN program and are -- DOS legal, names no longer than 8 Characters, with '.' and extension -- Single files, that is, that need only the one FULL name, no variations -- These files are Input files and may have any name legal in your system -- and contain the ASCII information copied from the porting system Inflections_Full_Name : constant String := "INFLECTS.LAT"; Inflections_Sections_Name : constant String := "INFLECTS.SEC"; Uniques_Full_Name : constant String := "UNIQUES.LAT"; Addons_Full_Name : constant String := "ADDONS.LAT"; -- These files may be Created and used by the program Mode_Full_Name : constant String := "WORD.MOD"; Output_Full_Name : constant String := "WORD.OUT"; Unknowns_Full_Name : constant String := "WORD.UNK"; Parse_Full_Name : constant String := "WORD.PRS"; -- These file names are used with extensions (e.g., GEN, SPE, LOC) -- for the various dictionaries -- The function ADD_FILE_NAME_EXTENSION below is used to Create -- a full file name -- Note that for DOS they are not complete names (no '.') -- but DOS is forgiving and will give it a pass Dictionary_File_Name : constant String := "DICT"; Dict_File_Name : constant String := "DICTFILE"; Dict_Line_Name : constant String := "DICTLINE"; Stem_List_Name : constant String := "STEMLIST"; Stem_File_Name : constant String := "STEMFILE"; Indx_File_Name : constant String := "INDXFILE"; function Add_File_Name_Extension (Name, Extension : String) return String; -- This is the function that Creates a file name legal for your system -- with a FILE_NAME defined above and a program specified extension end Latin_Utils.Latin_File_Names;
------------------------------------------------------------------------------ -- Copyright (C) 2020 by Heisenbug Ltd. (gh+spat@heisenbug.eu) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. ------------------------------------------------------------------------------ pragma License (Unrestricted); ------------------------------------------------------------------------------ -- -- SPARK Proof Analysis Tool -- -- S.P.A.T. - Utility generic package to instantiate type safe string lists. -- ------------------------------------------------------------------------------ with Ada.Containers.Bounded_Vectors; with Ada.Text_IO; generic type Element_Type is private; with function "=" (Left : in Element_Type; Right : in Element_Type) return Boolean is <>; with function Length (Source : in Element_Type) return Natural is <>; package SPAT.String_Vectors is package Base_Vectors is new Ada.Containers.Bounded_Vectors (Index_Type => Positive, Element_Type => Element_Type, "=" => "="); type List is new Base_Vectors.Vector with private; --------------------------------------------------------------------- -- Max_Length -- -- Returns the length of the longest string in the list. --------------------------------------------------------------------- not overriding function Max_Length (Source : in List) return Ada.Text_IO.Count; private type List is new Base_Vectors.Vector with null record; end SPAT.String_Vectors;
-- MIT License -- Copyright (c) 2021 Stephen Merrony -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. with Ada.Command_Line; with Ada.Containers; with Ada.Containers.Ordered_Sets; with Ada.Exceptions; with Ada.IO_Exceptions; with Ada.Real_Time; use Ada.Real_Time; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Streams.Stream_IO; with Ada.Text_IO; with GNAT.Ctrl_C; with GNAT.OS_Lib; with GNAT.Sockets; with GNAT.String_Split; use GNAT.String_Split; with Interfaces; use Interfaces; with Decoder; with Debug_Logs; use Debug_Logs; with Devices; with Devices.Bus; with Devices.Console; use Devices.Console; with Devices.Disk6061; with Devices.Magtape6026; with DG_Types; use DG_Types; with Processor; with Memory; use Memory; with Memory_Channels; use Memory_Channels; with Simh_Tapes; with Status_Monitor; procedure MVEmuA is Sem_Ver : constant String := "v0.0.0"; Debug_Logging : Boolean := TRUE; Log_Dir : constant String := "logs/"; Console_Port : constant GNAT.Sockets.Port_Type := 10_000; Monitor_Port : constant GNAT.Sockets.Port_Type := 10_001; Receiver : GNAT.Sockets.Socket_Type; Connection : GNAT.Sockets.Socket_Type; Client : GNAT.Sockets.Sock_Addr_Type; Command_Line : Unbounded_String; Command : Unbounded_String; Arg_Num : Positive := 1; Do_Script_Arg : Natural := 0; CPU : Processor.CPU_T; Breakpoints : Processor.BP_Sets.Set; Console_Radix : Number_Base_T := Octal; -- default console I/O number base procedure Do_Command (Cmd : in Unbounded_String); procedure Show_Help is begin Devices.Console.TTOut.Put_String (Dasher_Erase_Page & " " & Dasher_Underline &"SCP-CLI Commands" & Dasher_Normal & " " & Dasher_Dim_On & "MV/Emulator" & Dasher_Dim_Off & Dasher_NL & " . - Display state of CPU" & Dasher_NL & " B # - Boot from device #" & Dasher_NL & " CO - COntinue CPU Processing" & Dasher_NL & " E A <#> | M [addr] | P - Examine/Modify Acc/Memory/PC" & Dasher_NL & " HE - HElp (show this)" & Dasher_NL & " RE - REset the system" & Dasher_NL & " SS - Single Step one instruction" & Dasher_NL & " ST <addr> - STart processing at specified address" & Dasher_NL); Devices.Console.TTOut.Put_String (" " & Dasher_Underline & "Emulator Commands" &Dasher_Normal & Dasher_NL & " ATT <dev> <file> [RW] - ATTach the image file to named device (RO)" & Dasher_NL & " BREAK/NOBREAK <addr> - Set or clear a BREAKpoint" & Dasher_NL & " CHECK <file> - CHECK validity of unattached TAPE image" & Dasher_NL & " CREATE DPF|DSKP <file> - CREATE an empty/unformatted disk image" & Dasher_NL & " DET <dev> - DETach any image file from the device" & Dasher_NL & " DIS <from> <to>|+<#> - DISassemble physical memory range or # from PC" & Dasher_NL & " DO <file> - DO (i.e. run) emulator commands from script <file>" & Dasher_NL & " EXIT - EXIT the emulator" & Dasher_NL & " LOAD <file> - Load ASCII octal file directly into memory" & Dasher_NL & " SET LOGGING ON|OFF - Turn on or off debug logging (logs dumped end of run)" & Dasher_NL & " SHOW BREAK/DEV/LOGGING - SHOW list of BREAKpoints/DEVices configured" & Dasher_NL); end Show_Help; procedure Attach (Command : in Slice_Set) is begin if Slice_Count (Command) < 3 then TTOut.Put_String (Dasher_NL & " *** ATT command requires arguments: <dev> and <image> ***"); return; end if; declare Dev : String := Slice (Command, 2); Image_Name : String := Slice (Command, 3); OK : Boolean; begin if Debug_Logging then Loggers.Debug_Print (Debug_Log, "INFO: Attach called with parms " & Dev & " " & Image_Name); end if; if Dev = "MTB" then Devices.Magtape6026.Drives.Attach (0, Image_Name, OK); if OK then TTOut.Put_String (Dasher_NL & " *** Tape Image Attached ***"); else TTOut.Put_String (Dasher_NL & " *** Could not attach Tape Image ***"); end if; elsif Dev = "DPF" then Devices.Disk6061.Drives.Attach (0, Image_Name, OK); if OK then TTOut.Put_String (Dasher_NL & " *** Disk Image Attached ***"); else TTOut.Put_String (Dasher_NL & " *** Could not attach Disk Image ***"); end if; else TTOut.Put_String (Dasher_NL & " *** Unknown or unimplemented Device for ATT command ***"); end if; end; end Attach; procedure Boot (Command : in Slice_Set) is Dev : Dev_Num_T; begin if Slice_Count (Command) < 2 then TTOut.Put_String (Dasher_NL & " *** B command requires argument: <devicenumber> ***"); return; end if; Dev := Dev_Num_T(String_To_Integer(Slice (Command, 2), Console_Radix)); if not Devices.Bus.Actions.Is_Attached(Dev) then TTOut.Put_String (Dasher_NL & " *** Devices is not ATTached ***"); return; end if; if not Devices.Bus.Actions.Is_Bootable(Dev) then TTOut.Put_String (Dasher_NL & " *** Devices is not Bootable ***"); return; end if; RAM.Init (Debug_Logging); case Dev is when Devices.MTB => Devices.Magtape6026.Drives.Load_TBOOT; Processor.Boot (CPU, Devices.MTB, 10); when Devices.DPF => Devices.Disk6061.Drives.Load_DKBT; Processor.Boot (CPU, Devices.DPF, 10); when others => TTOut.Put_String (Dasher_NL & " *** Booting from that device is not yet implemented ***"); end case; exception when Constraint_Error => TTOut.Put_String (Dasher_NL & " *** Invalid Device Number ***"); end Boot; procedure Break_Clear (Command : in Slice_Set) is BP_Addr : Phys_Addr_T; begin if Slice_Count (Command) < 2 then TTOut.Put_String (Dasher_NL & " *** NOBREAK command requires an address argument ***"); return; end if; BP_Addr := Phys_Addr_T(String_To_Dword (Slice (Command, 2), Console_Radix)); Breakpoints.Exclude (BP_Addr); TTOut.Put_String (Dasher_NL & " *** BREAKpoint cleared ***"); end Break_Clear; procedure Break_Set (Command : in Slice_Set) is BP_Addr : Phys_Addr_T; begin if Slice_Count (Command) < 2 then TTOut.Put_String (Dasher_NL & " *** BREAK command requires an address argument ***"); return; end if; BP_Addr := Phys_Addr_T(String_To_Dword (Slice (Command, 2), Console_Radix)); Breakpoints.Include (BP_Addr); TTOut.Put_String (Dasher_NL & " *** BREAKpoint set ***"); end Break_Set; procedure Check (Command : in Slice_Set) is begin if Slice_Count (Command) < 2 then TTOut.Put_String (Dasher_NL & " *** CHECK command requires argument: <tape_image> ***"); return; end if; TTOut.Put_String (Simh_Tapes.Scan_Image (Slice (Command, 2))); end Check; procedure Dump_Memory_Readable ( Filename : in String) is use Ada.Streams.Stream_IO; Write_File : File_Type; Writer : Stream_Access; Addr : Phys_Addr_T := 0; begin Create (Write_File, Out_File, Filename); Writer := Stream(Write_File); while Addr < Phys_Addr_T(Mem_Size_Words) loop String'Write (Writer, Dword_To_String(Dword_T(Addr), Octal, 12, false) & " " & Dword_To_String(Dword_T(RAM.Read_Word(Addr)), Hex, 4, true) & Dasher_NL); Addr := Addr + 1; end loop; end; procedure Clean_Exit is begin TTOut.Put_String (Dasher_NL & " *** MV/Emulator stopping at user request ***" ); Debug_Logs.Loggers.Debug_Logs_Dump (Log_Dir); Dump_Memory_Readable ("mvemua.dmp"); GNAT.OS_Lib.OS_Exit (0); end Clean_Exit; procedure Create_Blank (Command : in Slice_Set) is OK : Boolean; begin if Slice_Count (Command) < 3 then TTOut.Put_String (Dasher_NL & " *** CREATE command requires arguments: DPF and <filename> ***"); return; end if; if Slice (Command, 2) = "DPF" then TTOut.Put_String (Dasher_NL & "Attempting to CREATE new empty DPF-type disk image, please wait..."); Devices.Disk6061.Create_Blank(Slice(Command,3), OK); if OK then TTOut.Put_String (Dasher_NL & "Empty MV/Em DPF-type disk image created"); else TTOut.Put_String (Dasher_NL & " *** Error: could not create empty disk image ***"); end if; end if; end Create_Blank; procedure Disassemble (Command : in Slice_Set) is Low_Addr, High_Addr : Phys_Addr_T; begin if Slice_Count (Command) < 3 then TTOut.Put_String (Dasher_NL & " *** DIS command requires two address arguments ***"); return; end if; Low_Addr := Phys_Addr_T(String_To_Dword (Slice (Command, 2), Console_Radix)); High_Addr := Phys_Addr_T(String_To_Dword (Slice (Command, 3), Console_Radix)); TTOut.Put_String (Processor.Disassemble_Range(Low_Addr, High_Addr, Console_Radix)); end Disassemble; procedure Do_Script (Command : in Slice_Set) is use Ada.Text_IO; Do_File : File_Type; Script_Line : Unbounded_String; begin if Slice_Count (Command) < 2 then TTOut.Put_String (Dasher_NL & " *** DO command requires argument: <script_file> ***"); return; end if; Open (Do_File, In_File, Slice (Command, 2)); while not End_Of_File (Do_File) loop Script_Line := To_Unbounded_String (Get_Line (Do_File)); if Ada.Strings.Unbounded.Element(Script_Line, 1) /= '#' then TTOut.Put_String (Dasher_NL & To_String (Script_Line)); Do_Command (Script_Line); end if; end loop; Close (Do_File); exception when Name_Error => TTOut.Put_String (Dasher_NL & " *** DO command script cannot be opened ***"); end Do_Script; procedure Run is I_Counts : Processor.Instr_Count_T; I_Count : Unsigned_64; Start_Time : Time; Elapsed : Time_Span; begin Processor.Prepare_For_Running (CPU); SCP_Handler.Set_SCP_IO(false); Start_Time := Clock; Processor.Run (CPU, Debug_Logging, Console_Radix, Breakpoints, I_Counts); Elapsed := Clock - Start_Time; I_Count := Processor.Get_Instruction_Count (CPU); SCP_Handler.Set_SCP_IO(true); TTOut.Put_String (Dasher_NL & " *** MV/Emua executed " & Unsigned_64'Image(I_Count) & " instructions in" & Duration'Image(To_Duration(Elapsed)) & " seconds ***"); Ada.Text_IO.Put_Line ("Instruction Execution Count by Mnemonic"); for I in I_Counts'Range loop if I_Counts(I) > 0 then Ada.Text_IO.Put(I'Image & ASCII.HT & I_Counts(I)'Image & Dasher_NL); end if; end loop; exception when others => Elapsed := Clock - Start_Time; I_Count := Processor.Get_Instruction_Count (CPU); SCP_Handler.Set_SCP_IO(true); TTOut.Put_String (Dasher_NL & " *** MV/Emua executed " & Unsigned_64'Image(I_Count) & " instructions in" & Duration'Image(To_Duration(Elapsed)) & " seconds ***"); Ada.Text_IO.Put_Line ("Instruction Execution Count by Mnemonic"); for I in I_Counts'Range loop if I_Counts(I) > 0 then Ada.Text_IO.Put(I'Image & ASCII.HT & I_Counts(I)'Image & Dasher_NL); end if; end loop; raise; end run; procedure Set (Command : in Slice_Set) is begin if Slice_Count (Command) < 2 then TTOut.Put_String (Dasher_NL & " *** SET command requires 2 arguments ***"); return; end if; declare use Ada.Containers; What : String := Slice (Command, 2); Set_To : String := Slice (Command, 3); begin if What = "LOGGING" then if Set_To = "ON" then Debug_Logging := true; TTOut.Put_String (Dasher_NL & " *** Logging turned on, CPU will run slow ***"); elsif Set_To = "OFF" then Debug_Logging := false; TTOut.Put_String (Dasher_NL & " *** Logging turned off ***"); else TTOut.Put_String (Dasher_NL & " *** Value must be 'ON' or 'OFF' ***"); end if; -- TODO Add calls here when new devices are added... Processor.Set_Debug_Logging(CPU, Debug_Logging); BMC_DCH.Set_Logging(Debug_Logging); Devices.Disk6061.Drives.Set_Logging (Debug_Logging); else TTOut.Put_String (Dasher_NL & " *** Unknown or Unimplemented SET command"); end if; end; end Set; procedure Show (Command : in Slice_Set) is begin if Slice_Count (Command) < 2 then TTOut.Put_String (Dasher_NL & " *** SHOW command requires argument: BREAK|DEV|LOGGING ***"); return; end if; declare use Ada.Containers; What : String := Slice (Command, 2); begin if What = "DEV" then TTOut.Put_String (Dasher_NL & Devices.Bus.Actions.Get_Printable_Device_List); elsif What = "BREAK" then if Breakpoints.Length = 0 then TTOut.Put_String (Dasher_NL & " *** No Breakpoints are set ***"); else TTOut.Put_String (Dasher_NL & " *** Breakpoints: "); for BP of Breakpoints loop TTOut.Put_String (Dword_To_String(Dword_T(BP), Console_Radix, 12, false)); end loop; end if; elsif What = "LOGGING" then TTOut.Put_String (Dasher_NL & " *** Logging is turned "); if Debug_Logging then TTOut.Put_String ("ON ***"); else TTOut.Put_String ("OFF ***"); end if; else TTOut.Put_String (Dasher_NL & " *** Unknown or Unimplemented SHOW command"); end if; end; end Show; procedure Single_Step is Disass : Unbounded_String; begin TTOut.Put_String (Dasher_NL & Processor.Get_Compact_Status(CPU, Console_Radix)); Processor.Single_Step(CPU, Console_Radix, Disass); TTOut.Put_String (Dasher_NL & To_String(Disass)); TTOut.Put_String (Dasher_NL & Processor.Get_Compact_Status(CPU, Console_Radix)); exception when Error: others => TTOut.Put_String (Dasher_NL & Ada.Exceptions.Exception_Message(Error)); end Single_Step; procedure Do_Command (Cmd : in Unbounded_String) is Words : Slice_Set; begin Create (Words, To_String(Cmd), " ", Multiple); Command := To_Unbounded_String(Slice (Words, 1)); -- SCP-like commands... if Command = "." then TTOut.Put_String (Dasher_NL & Processor.Get_Compact_Status(CPU, Console_Radix)); elsif Command = "B" then Boot (Words); elsif Command = "CO" then Run; elsif Command = "HE" then Show_Help; elsif Command = "SS" then Single_Step; -- enulator commands elsif Command = "ATT" then Attach (Words); elsif Command = "BREAK" then Break_Set (Words); elsif Command = "CHECK" then Check (Words); elsif Command = "CREATE" then Create_Blank (Words); elsif Command = "DIS" then Disassemble (Words); elsif Command = "DO" then Do_Script (Words); elsif Command = "exit" or Command = "EXIT" or command = "quit" or command = "QUIT" then Clean_Exit; elsif Command = "NOBREAK" then Break_Clear (Words); elsif Command = "SET" then Set (Words); elsif Command = "SHOW" or Command = "SHO" or Command = "SH" then Show (Words); else Devices.Console.TTOut.Put_String (Dasher_NL & " *** Unknown SCP-CLI Command ***"); end if; end Do_Command; ---------- -- MAIN -- ---------- begin while Arg_Num <= Ada.Command_Line.Argument_Count loop if Ada.Command_Line.Argument (Arg_num) = "-do" then Arg_Num := Arg_Num + 1; Do_Script_Arg := Arg_Num; elsif Ada.Command_Line.Argument (Arg_num) = "-version" then Ada.Text_IO.Put_Line ("MV/Emua version " & Sem_Ver); GNAT.OS_Lib.OS_Exit (0); end if; Arg_Num := Arg_Num + 1; end loop; GNAT.Ctrl_C.Install_Handler(Clean_Exit'Unrestricted_Access); Ada.Text_IO.Put_Line ("INFO: Will not start until console connects..."); GNAT.Sockets.Create_Socket (Socket => Receiver); GNAT.Sockets.Set_Socket_Option (Socket => Receiver, Level => GNAT.Sockets.Socket_Level, Option => (Name => GNAT.Sockets.Reuse_Address, Enabled => True)); GNAT.Sockets.Bind_Socket (Socket => Receiver, Address => (Family => GNAT.Sockets.Family_Inet, Addr => GNAT.Sockets.Inet_Addr ("127.0.0.1"), Port => Console_Port)); GNAT.Sockets.Listen_Socket (Socket => Receiver); Loggers.Init; loop GNAT.Sockets.Accept_Socket (Server => Receiver, Socket => Connection, Address => Client); Ada.Text_IO.Put_Line ("INFO: Console connected from " & GNAT.Sockets.Image (Client)); -- The console is connected, now we can set up our emulated machine -- Here we are defining the hardware in our virtual machine -- Initially based on a minimally configured MV/10000 Model I... -- One CPU -- Console (TTI/TTO) -- One Tape Drive -- One HDD -- A generous(!) 16MB (8MW) RAM -- NO IACs, LPT or ISC Decoder.Init; Devices.Bus.Actions.Init; CPU := Processor.Make; Status_Monitor.Monitor.Start (Monitor_Port); RAM.Init (Debug_Logging); -- Devices.Bus.Actions.Init; Devices.Bus.Actions.Connect (Devices.BMC); Devices.Bus.Actions.Set_Reset_Proc (Devices.BMC, BMC_DCH.Reset'Access); Devices.Bus.Actions.Connect (Devices.SCP); Devices.Bus.Actions.Connect (Devices.CPU); -- Devices.Bus.Actions.Set_Reset_Proc (Devices.CPU, Processor.Actions.Reset'Access); Devices.Bus.Actions.Connect (Devices.TTO); Devices.Console.TTOut.Init (Connection); Devices.Bus.Actions.Connect (Devices.TTI); Devices.Console.TTIn.Init; Console_Handler.Start (Connection); Devices.Bus.Actions.Connect (Devices.MTB); Devices.Magtape6026.Drives.Init; Devices.Bus.Actions.Connect (Devices.DPF); Devices.Disk6061.Drives.Init (Debug_Logging); -- say hello... Devices.Console.TTOut.Put_Char (ASCII.FF); Devices.Console.TTOut.Put_String (" *** Welcome to the MV/Emulator - Type HE for help ***" & ASCII.LF); -- Handle any DO script - N.B. will not pass here until start-up script is complete... if Do_Script_Arg > 0 then Do_Command (To_Unbounded_String ("DO " & Ada.Command_Line.Argument (Do_Script_Arg))); end if; Processor.Status_Sender.Start (CPU); -- the main SCP/console interaction loop SCP_Handler.Set_SCP_IO (true); loop Devices.Console.TTOut.Put_String (Dasher_NL & "SCP-CLI> "); SCP_Handler.SCP_Get_Line (Command_Line); Ada.Text_IO.Put_Line ("DEBUG: Got SCP command: " & To_String(Command_Line)); Do_Command (Command_Line); end loop; end loop; exception when Error: Processor.CPU_Halt => TTOut.Put_String (Dasher_NL & " *** MV/Emulator stopping due to CPU HALT instruction ***" ); Loggers.Debug_Print (Debug_Log," *** MV/Emulator stopping due to CPU HALT instruction ***" ); Loggers.Debug_Logs_Dump (Log_Dir); GNAT.OS_Lib.OS_Exit (0); when Error: others => Ada.Text_IO.Put_Line("ERROR: " & Ada.Exceptions.Exception_Information(Error)); TTOut.Put_String (Dasher_NL & " *** MV/Emulator stopping due to unhandled error ***" ); -- TTOut.Put_String (Dasher_NL & Ada.Exceptions.Exception_Information(Error)); Loggers.Debug_Print (Debug_Log, "ERROR: " & Ada.Exceptions.Exception_Information(Error)); Loggers.Debug_Logs_Dump (Log_Dir); GNAT.OS_Lib.OS_Exit (0); end MVEmuA;
with DDS.Request_Reply.Tests.Simple.Octets_Replier; with DDS.Request_Reply.Tests.Simple.String_Replier; with DDS.Request_Reply.Replier.Typed_Replier_Generic.Passive_Replier_Generic; package DDS.Request_Reply.Tests.Simple.Server is type Ref_Base is limited interface; package Octets_Srv is new Octets_Replier.Passive_Replier_Generic (Ref_Base); package String_Srv is new String_Replier.Passive_Replier_Generic (Octets_Srv.Listners.Ref); task type Ref2 is new String_Srv.Listners.Ref with entry Compute_And_Reply (Replier : Octets_Replier.Ref_Access; Data : DDS.Octets; Id : DDS.SampleIdentity_T); entry Compute_And_Reply (Replier : String_Replier.Ref_Access; Data : DDS.String; Id : DDS.SampleIdentity_T); end Ref2; type Ref is new String_Srv.Listners.Ref with null record; procedure Compute_And_Reply (Self : not null access Ref; Replier : Octets_Replier.Ref_Access; Data : DDS.Octets; Id : DDS.SampleIdentity_T); procedure Compute_And_Reply (Self : not null access Ref; Replier : String_Replier.Ref_Access; Data : DDS.String; Id : DDS.SampleIdentity_T); end DDS.Request_Reply.Tests.Simple.Server;
with Risi_Script.Types.Internals; Separate(Risi_Script.Types.Implementation) Function Convert( Item : Representation; To : Enumeration ) return Representation is use Risi_Script.Types.Internals, Risi_Script.Types.Implementation.Conversions; Source : Enumeration renames Get_Enumeration(Item); Generic Type To_Type is private; with Function Convert( Input : Integer_Type ) return To_Type is <>; with Function Convert( Input : Array_Type ) return To_Type is <>; with Function Convert( Input : Hash_Type ) return To_Type is <>; with Function Convert( Input : String_Type ) return To_Type is <>; with Function Convert( Input : Real_Type ) return To_Type is <>; with Function Convert( Input : Pointer_Type ) return To_Type is <>; with Function Convert( Input : Reference_Type ) return To_Type is <>; with Function Convert( Input : Fixed_Type ) return To_Type is <>; with Function Convert( Input : Boolean_Type ) return To_Type is <>; with Function Convert( Input : Func_Type ) return To_Type is <>; From_Type : in Enumeration:= Source; Function Generic_Conversion return To_Type; Function Generic_Conversion return To_Type is (case From_Type is when RT_Integer => Convert( Item.Integer_Value ), when RT_Array => Convert( Item.Array_Value ), when RT_Hash => Convert( Item.hash_Value ), when RT_String => Convert( Item.String_Value ), when RT_Real => Convert( Item.Real_Value ), when RT_Pointer => Convert( Item.Pointer_Value ), when RT_Reference => Convert( Item.Reference_Value ), when RT_Fixed => Convert( Item.Fixed_Value ), when RT_Boolean => Convert( Item.Boolean_Value ), when RT_Func => Convert( Item.Func_Value ) ); Function Conversion is new Generic_Conversion( Integer_Type ); Function Conversion is new Generic_Conversion( Array_Type ); Function Conversion is new Generic_Conversion( Hash_Type ); Function Conversion is new Generic_Conversion( String_Type ); Function Conversion is new Generic_Conversion( Real_Type ); Function Conversion is new Generic_Conversion( Pointer_Type ); Function Conversion is new Generic_Conversion( Reference_Type ); Function Conversion is new Generic_Conversion( Fixed_Type ); Function Conversion is new Generic_Conversion( Boolean_Type ); Function Conversion is new Generic_Conversion( Func_Type ); begin -- Manual static dispatching, YAY! -- Generics reduced the total length of this function from 170 lines to less than 70. return Result : Representation:= new Internal_Representation' (case To is when RT_Integer => (Internal_Type => RT_Integer, Integer_Value => Conversion), when RT_Array => (Internal_Type => RT_Array, Array_Value => Conversion), when RT_Hash => (Internal_Type => RT_Hash, Hash_Value => Conversion), when RT_String => (Internal_Type => RT_String, String_Value => Conversion), when RT_Real => (Internal_Type => RT_Real, Real_Value => Conversion), when RT_Pointer => (Internal_Type => RT_Pointer, Pointer_Value => Conversion), when RT_Reference => (Internal_Type => RT_Reference, Reference_Value => Conversion), when RT_Fixed => (Internal_Type => RT_Fixed, Fixed_Value => Conversion), when RT_Boolean => (Internal_Type => RT_Boolean, Boolean_Value => Conversion), when RT_Func => (Internal_Type => RT_Func, Func_Value => Conversion) ); End Convert;
-- //////////////////////////////////////////////////////////// -- // -- // SFML - Simple and Fast Multimedia Library -- // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com) -- // -- // This software is provided 'as-is', without any express or implied warranty. -- // In no event will the authors be held liable for any damages arising from the use of this software. -- // -- // Permission is granted to anyone to use this software for any purpose, -- // including commercial applications, and to alter it and redistribute it freely, -- // subject to the following restrictions: -- // -- // 1. The origin of this software must not be misrepresented; -- // you must not claim that you wrote the original software. -- // If you use this software in a product, an acknowledgment -- // in the product documentation would be appreciated but is not required. -- // -- // 2. Altered source versions must be plainly marked as such, -- // and must not be misrepresented as being the original software. -- // -- // 3. This notice may not be removed or altered from any source distribution. -- // -- //////////////////////////////////////////////////////////// package Sf.Window.GL is -- //////////////////////////////////////////////////////////// -- // Define portable types -- //////////////////////////////////////////////////////////// type GLuint is mod 2 ** Integer'SIZE; type GLuint_Ptr is access all GLuint; type GLenum is mod 2 ** Integer'SIZE; type GLbitfield is mod 2 ** Integer'SIZE; type GLboolean is mod 256; for GLboolean'SIZE use 8; type GLvoid is null record; type GLvoid_Ptr is access all GLvoid; type GLbyte is range -128 .. 127; for GLbyte'SIZE use 8; type GLshort is new Short_Integer; type GLint is new Integer; type GLubyte is mod 256; for GLubyte'SIZE use 8; type GLubyte_Ptr is access all GLubyte; type GLushort is mod 2 ** Short_Integer'SIZE; type GLsizei is new Integer; type GLfloat is new Float; type GLclampf is new Float; type GLdouble is new Long_Float; type GLclampd is new Long_Float; pragma Convention (C, GLuint); pragma Convention (C, GLuint_Ptr); pragma Convention (C, GLenum); pragma Convention (C, GLbitfield); pragma Convention (C, GLboolean); pragma Convention (C, GLvoid); pragma Convention (C, GLvoid_Ptr); pragma Convention (C, GLbyte); pragma Convention (C, GLshort); pragma Convention (C, GLint); pragma Convention (C, GLubyte); pragma Convention (C, GLubyte_Ptr); pragma Convention (C, GLushort); pragma Convention (C, GLsizei); pragma Convention (C, GLfloat); pragma Convention (C, GLclampf); pragma Convention (C, GLdouble); pragma Convention (C, GLclampd); -- //////////////////////////////////////////////////////////// -- // Define constants -- //////////////////////////////////////////////////////////// GL_VERSION_1_1 : constant GLenum := 1; GL_VERSION_1_2 : constant GLenum := 1; GL_VERSION_1_3 : constant GLenum := 1; GL_ARB_imaging : constant GLenum := 1; GL_FALSE : constant GLboolean := 16#0#; GL_TRUE : constant GLboolean := 16#1#; GL_BYTE : constant GLenum := 16#1400#; GL_UNSIGNED_BYTE : constant GLenum := 16#1401#; GL_SHORT : constant GLenum := 16#1402#; GL_UNSIGNED_SHORT : constant GLenum := 16#1403#; GL_INT : constant GLenum := 16#1404#; GL_UNSIGNED_INT : constant GLenum := 16#1405#; GL_FLOAT : constant GLenum := 16#1406#; GL_DOUBLE : constant GLenum := 16#140A#; GL_2_BYTES : constant GLenum := 16#1407#; GL_3_BYTES : constant GLenum := 16#1408#; GL_4_BYTES : constant GLenum := 16#1409#; GL_POINTS : constant GLenum := 16#0000#; GL_LINES : constant GLenum := 16#0001#; GL_LINE_LOOP : constant GLenum := 16#0002#; GL_LINE_STRIP : constant GLenum := 16#0003#; GL_TRIANGLES : constant GLenum := 16#0004#; GL_TRIANGLE_STRIP : constant GLenum := 16#0005#; GL_TRIANGLE_FAN : constant GLenum := 16#0006#; GL_QUADS : constant GLenum := 16#0007#; GL_QUAD_STRIP : constant GLenum := 16#0008#; GL_POLYGON : constant GLenum := 16#0009#; GL_VERTEX_ARRAY : constant GLenum := 16#8074#; GL_NORMAL_ARRAY : constant GLenum := 16#8075#; GL_COLOR_ARRAY : constant GLenum := 16#8076#; GL_INDEX_ARRAY : constant GLenum := 16#8077#; GL_TEXTURE_COORD_ARRAY : constant GLenum := 16#8078#; GL_EDGE_FLAG_ARRAY : constant GLenum := 16#8079#; GL_VERTEX_ARRAY_SIZE : constant GLenum := 16#807A#; GL_VERTEX_ARRAY_TYPE : constant GLenum := 16#807B#; GL_VERTEX_ARRAY_STRIDE : constant GLenum := 16#807C#; GL_NORMAL_ARRAY_TYPE : constant GLenum := 16#807E#; GL_NORMAL_ARRAY_STRIDE : constant GLenum := 16#807F#; GL_COLOR_ARRAY_SIZE : constant GLenum := 16#8081#; GL_COLOR_ARRAY_TYPE : constant GLenum := 16#8082#; GL_COLOR_ARRAY_STRIDE : constant GLenum := 16#8083#; GL_INDEX_ARRAY_TYPE : constant GLenum := 16#8085#; GL_INDEX_ARRAY_STRIDE : constant GLenum := 16#8086#; GL_TEXTURE_COORD_ARRAY_SIZE : constant GLenum := 16#8088#; GL_TEXTURE_COORD_ARRAY_TYPE : constant GLenum := 16#8089#; GL_TEXTURE_COORD_ARRAY_STRIDE : constant GLenum := 16#808A#; GL_EDGE_FLAG_ARRAY_STRIDE : constant GLenum := 16#808C#; GL_VERTEX_ARRAY_POINTER : constant GLenum := 16#808E#; GL_NORMAL_ARRAY_POINTER : constant GLenum := 16#808F#; GL_COLOR_ARRAY_POINTER : constant GLenum := 16#8090#; GL_INDEX_ARRAY_POINTER : constant GLenum := 16#8091#; GL_TEXTURE_COORD_ARRAY_POINTER : constant GLenum := 16#8092#; GL_EDGE_FLAG_ARRAY_POINTER : constant GLenum := 16#8093#; GL_V2F : constant GLenum := 16#2A20#; GL_V3F : constant GLenum := 16#2A21#; GL_C4UB_V2F : constant GLenum := 16#2A22#; GL_C4UB_V3F : constant GLenum := 16#2A23#; GL_C3F_V3F : constant GLenum := 16#2A24#; GL_N3F_V3F : constant GLenum := 16#2A25#; GL_C4F_N3F_V3F : constant GLenum := 16#2A26#; GL_T2F_V3F : constant GLenum := 16#2A27#; GL_T4F_V4F : constant GLenum := 16#2A28#; GL_T2F_C4UB_V3F : constant GLenum := 16#2A29#; GL_T2F_C3F_V3F : constant GLenum := 16#2A2A#; GL_T2F_N3F_V3F : constant GLenum := 16#2A2B#; GL_T2F_C4F_N3F_V3F : constant GLenum := 16#2A2C#; GL_T4F_C4F_N3F_V4F : constant GLenum := 16#2A2D#; GL_MATRIX_MODE : constant GLenum := 16#0BA0#; GL_MODELVIEW : constant GLenum := 16#1700#; GL_PROJECTION : constant GLenum := 16#1701#; GL_TEXTURE : constant GLenum := 16#1702#; GL_POINT_SMOOTH : constant GLenum := 16#0B10#; GL_POINT_SIZE : constant GLenum := 16#0B11#; GL_POINT_SIZE_GRANULARITY : constant GLenum := 16#0B13#; GL_POINT_SIZE_RANGE : constant GLenum := 16#0B12#; GL_LINE_SMOOTH : constant GLenum := 16#0B20#; GL_LINE_STIPPLE : constant GLenum := 16#0B24#; GL_LINE_STIPPLE_PATTERN : constant GLenum := 16#0B25#; GL_LINE_STIPPLE_REPEAT : constant GLenum := 16#0B26#; GL_LINE_WIDTH : constant GLenum := 16#0B21#; GL_LINE_WIDTH_GRANULARITY : constant GLenum := 16#0B23#; GL_LINE_WIDTH_RANGE : constant GLenum := 16#0B22#; GL_POINT : constant GLenum := 16#1B00#; GL_LINE : constant GLenum := 16#1B01#; GL_FILL : constant GLenum := 16#1B02#; GL_CW : constant GLenum := 16#0900#; GL_CCW : constant GLenum := 16#0901#; GL_FRONT : constant GLenum := 16#0404#; GL_BACK : constant GLenum := 16#0405#; GL_POLYGON_MODE : constant GLenum := 16#0B40#; GL_POLYGON_SMOOTH : constant GLenum := 16#0B41#; GL_POLYGON_STIPPLE : constant GLenum := 16#0B42#; GL_EDGE_FLAG : constant GLenum := 16#0B43#; GL_CULL_FACE : constant GLenum := 16#0B44#; GL_CULL_FACE_MODE : constant GLenum := 16#0B45#; GL_FRONT_FACE : constant GLenum := 16#0B46#; GL_POLYGON_OFFSET_FACTOR : constant GLenum := 16#8038#; GL_POLYGON_OFFSET_UNITS : constant GLenum := 16#2A00#; GL_POLYGON_OFFSET_POINT : constant GLenum := 16#2A01#; GL_POLYGON_OFFSET_LINE : constant GLenum := 16#2A02#; GL_POLYGON_OFFSET_FILL : constant GLenum := 16#8037#; GL_COMPILE : constant GLenum := 16#1300#; GL_COMPILE_AND_EXECUTE : constant GLenum := 16#1301#; GL_LIST_BASE : constant GLenum := 16#0B32#; GL_LIST_INDEX : constant GLenum := 16#0B33#; GL_LIST_MODE : constant GLenum := 16#0B30#; GL_NEVER : constant GLenum := 16#0200#; GL_LESS : constant GLenum := 16#0201#; GL_EQUAL : constant GLenum := 16#0202#; GL_LEQUAL : constant GLenum := 16#0203#; GL_GREATER : constant GLenum := 16#0204#; GL_NOTEQUAL : constant GLenum := 16#0205#; GL_GEQUAL : constant GLenum := 16#0206#; GL_ALWAYS : constant GLenum := 16#0207#; GL_DEPTH_TEST : constant GLenum := 16#0B71#; GL_DEPTH_BITS : constant GLenum := 16#0D56#; GL_DEPTH_CLEAR_VALUE : constant GLenum := 16#0B73#; GL_DEPTH_FUNC : constant GLenum := 16#0B74#; GL_DEPTH_RANGE : constant GLenum := 16#0B70#; GL_DEPTH_WRITEMASK : constant GLenum := 16#0B72#; GL_DEPTH_COMPONENT : constant GLenum := 16#1902#; GL_LIGHTING : constant GLenum := 16#0B50#; GL_LIGHT0 : constant GLenum := 16#4000#; GL_LIGHT1 : constant GLenum := 16#4001#; GL_LIGHT2 : constant GLenum := 16#4002#; GL_LIGHT3 : constant GLenum := 16#4003#; GL_LIGHT4 : constant GLenum := 16#4004#; GL_LIGHT5 : constant GLenum := 16#4005#; GL_LIGHT6 : constant GLenum := 16#4006#; GL_LIGHT7 : constant GLenum := 16#4007#; GL_SPOT_EXPONENT : constant GLenum := 16#1205#; GL_SPOT_CUTOFF : constant GLenum := 16#1206#; GL_CONSTANT_ATTENUATION : constant GLenum := 16#1207#; GL_LINEAR_ATTENUATION : constant GLenum := 16#1208#; GL_QUADRATIC_ATTENUATION : constant GLenum := 16#1209#; GL_AMBIENT : constant GLenum := 16#1200#; GL_DIFFUSE : constant GLenum := 16#1201#; GL_SPECULAR : constant GLenum := 16#1202#; GL_SHININESS : constant GLenum := 16#1601#; GL_EMISSION : constant GLenum := 16#1600#; GL_POSITION : constant GLenum := 16#1203#; GL_SPOT_DIRECTION : constant GLenum := 16#1204#; GL_AMBIENT_AND_DIFFUSE : constant GLenum := 16#1602#; GL_COLOR_INDEXES : constant GLenum := 16#1603#; GL_LIGHT_MODEL_TWO_SIDE : constant GLenum := 16#0B52#; GL_LIGHT_MODEL_LOCAL_VIEWER : constant GLenum := 16#0B51#; GL_LIGHT_MODEL_AMBIENT : constant GLenum := 16#0B53#; GL_FRONT_AND_BACK : constant GLenum := 16#0408#; GL_SHADE_MODEL : constant GLenum := 16#0B54#; GL_FLAT : constant GLenum := 16#1D00#; GL_SMOOTH : constant GLenum := 16#1D01#; GL_COLOR_MATERIAL : constant GLenum := 16#0B57#; GL_COLOR_MATERIAL_FACE : constant GLenum := 16#0B55#; GL_COLOR_MATERIAL_PARAMETER : constant GLenum := 16#0B56#; GL_NORMALIZE : constant GLenum := 16#0BA1#; GL_CLIP_PLANE0 : constant GLenum := 16#3000#; GL_CLIP_PLANE1 : constant GLenum := 16#3001#; GL_CLIP_PLANE2 : constant GLenum := 16#3002#; GL_CLIP_PLANE3 : constant GLenum := 16#3003#; GL_CLIP_PLANE4 : constant GLenum := 16#3004#; GL_CLIP_PLANE5 : constant GLenum := 16#3005#; GL_ACCUM_RED_BITS : constant GLenum := 16#0D58#; GL_ACCUM_GREEN_BITS : constant GLenum := 16#0D59#; GL_ACCUM_BLUE_BITS : constant GLenum := 16#0D5A#; GL_ACCUM_ALPHA_BITS : constant GLenum := 16#0D5B#; GL_ACCUM_CLEAR_VALUE : constant GLenum := 16#0B80#; GL_ACCUM : constant GLenum := 16#0100#; GL_ADD : constant GLenum := 16#0104#; GL_LOAD : constant GLenum := 16#0101#; GL_MULT : constant GLenum := 16#0103#; GL_RETURN : constant GLenum := 16#0102#; GL_ALPHA_TEST : constant GLenum := 16#0BC0#; GL_ALPHA_TEST_REF : constant GLenum := 16#0BC2#; GL_ALPHA_TEST_FUNC : constant GLenum := 16#0BC1#; GL_BLEND : constant GLenum := 16#0BE2#; GL_BLEND_SRC : constant GLenum := 16#0BE1#; GL_BLEND_DST : constant GLenum := 16#0BE0#; GL_ZERO : constant GLenum := 16#0#; GL_ONE : constant GLenum := 16#1#; GL_SRC_COLOR : constant GLenum := 16#0300#; GL_ONE_MINUS_SRC_COLOR : constant GLenum := 16#0301#; GL_SRC_ALPHA : constant GLenum := 16#0302#; GL_ONE_MINUS_SRC_ALPHA : constant GLenum := 16#0303#; GL_DST_ALPHA : constant GLenum := 16#0304#; GL_ONE_MINUS_DST_ALPHA : constant GLenum := 16#0305#; GL_DST_COLOR : constant GLenum := 16#0306#; GL_ONE_MINUS_DST_COLOR : constant GLenum := 16#0307#; GL_SRC_ALPHA_SATURATE : constant GLenum := 16#0308#; GL_CONSTANT_COLOR : constant GLenum := 16#8001#; GL_ONE_MINUS_CONSTANT_COLOR : constant GLenum := 16#8002#; GL_CONSTANT_ALPHA : constant GLenum := 16#8003#; GL_ONE_MINUS_CONSTANT_ALPHA : constant GLenum := 16#8004#; GL_FEEDBACK : constant GLenum := 16#1C01#; GL_RENDER : constant GLenum := 16#1C00#; GL_SELECT : constant GLenum := 16#1C02#; GL_2D : constant GLenum := 16#0600#; GL_3D : constant GLenum := 16#0601#; GL_3D_COLOR : constant GLenum := 16#0602#; GL_3D_COLOR_TEXTURE : constant GLenum := 16#0603#; GL_4D_COLOR_TEXTURE : constant GLenum := 16#0604#; GL_POINT_TOKEN : constant GLenum := 16#0701#; GL_LINE_TOKEN : constant GLenum := 16#0702#; GL_LINE_RESET_TOKEN : constant GLenum := 16#0707#; GL_POLYGON_TOKEN : constant GLenum := 16#0703#; GL_BITMAP_TOKEN : constant GLenum := 16#0704#; GL_DRAW_PIXEL_TOKEN : constant GLenum := 16#0705#; GL_COPY_PIXEL_TOKEN : constant GLenum := 16#0706#; GL_PASS_THROUGH_TOKEN : constant GLenum := 16#0700#; GL_FEEDBACK_BUFFER_POINTER : constant GLenum := 16#0DF0#; GL_FEEDBACK_BUFFER_SIZE : constant GLenum := 16#0DF1#; GL_FEEDBACK_BUFFER_TYPE : constant GLenum := 16#0DF2#; GL_SELECTION_BUFFER_POINTER : constant GLenum := 16#0DF3#; GL_SELECTION_BUFFER_SIZE : constant GLenum := 16#0DF4#; GL_FOG : constant GLenum := 16#0B60#; GL_FOG_MODE : constant GLenum := 16#0B65#; GL_FOG_DENSITY : constant GLenum := 16#0B62#; GL_FOG_COLOR : constant GLenum := 16#0B66#; GL_FOG_INDEX : constant GLenum := 16#0B61#; GL_FOG_START : constant GLenum := 16#0B63#; GL_FOG_END : constant GLenum := 16#0B64#; GL_LINEAR : constant GLenum := 16#2601#; GL_EXP : constant GLenum := 16#0800#; GL_EXP2 : constant GLenum := 16#0801#; GL_LOGIC_OP : constant GLenum := 16#0BF1#; GL_INDEX_LOGIC_OP : constant GLenum := 16#0BF1#; GL_COLOR_LOGIC_OP : constant GLenum := 16#0BF2#; GL_LOGIC_OP_MODE : constant GLenum := 16#0BF0#; GL_CLEAR : constant GLenum := 16#1500#; GL_SET : constant GLenum := 16#150F#; GL_COPY : constant GLenum := 16#1503#; GL_COPY_INVERTED : constant GLenum := 16#150C#; GL_NOOP : constant GLenum := 16#1505#; GL_INVERT : constant GLenum := 16#150A#; GL_AND : constant GLenum := 16#1501#; GL_NAND : constant GLenum := 16#150E#; GL_OR : constant GLenum := 16#1507#; GL_NOR : constant GLenum := 16#1508#; GL_XOR : constant GLenum := 16#1506#; GL_EQUIV : constant GLenum := 16#1509#; GL_AND_REVERSE : constant GLenum := 16#1502#; GL_AND_INVERTED : constant GLenum := 16#1504#; GL_OR_REVERSE : constant GLenum := 16#150B#; GL_OR_INVERTED : constant GLenum := 16#150D#; GL_STENCIL_TEST : constant GLenum := 16#0B90#; GL_STENCIL_WRITEMASK : constant GLenum := 16#0B98#; GL_STENCIL_BITS : constant GLenum := 16#0D57#; GL_STENCIL_FUNC : constant GLenum := 16#0B92#; GL_STENCIL_VALUE_MASK : constant GLenum := 16#0B93#; GL_STENCIL_REF : constant GLenum := 16#0B97#; GL_STENCIL_FAIL : constant GLenum := 16#0B94#; GL_STENCIL_PASS_DEPTH_PASS : constant GLenum := 16#0B96#; GL_STENCIL_PASS_DEPTH_FAIL : constant GLenum := 16#0B95#; GL_STENCIL_CLEAR_VALUE : constant GLenum := 16#0B91#; GL_STENCIL_INDEX : constant GLenum := 16#1901#; GL_KEEP : constant GLenum := 16#1E00#; GL_REPLACE : constant GLenum := 16#1E01#; GL_INCR : constant GLenum := 16#1E02#; GL_DECR : constant GLenum := 16#1E03#; GL_NONE : constant GLenum := 16#0#; GL_LEFT : constant GLenum := 16#0406#; GL_RIGHT : constant GLenum := 16#0407#; GL_FRONT_LEFT : constant GLenum := 16#0400#; GL_FRONT_RIGHT : constant GLenum := 16#0401#; GL_BACK_LEFT : constant GLenum := 16#0402#; GL_BACK_RIGHT : constant GLenum := 16#0403#; GL_AUX0 : constant GLenum := 16#0409#; GL_AUX1 : constant GLenum := 16#040A#; GL_AUX2 : constant GLenum := 16#040B#; GL_AUX3 : constant GLenum := 16#040C#; GL_COLOR_INDEX : constant GLenum := 16#1900#; GL_RED : constant GLenum := 16#1903#; GL_GREEN : constant GLenum := 16#1904#; GL_BLUE : constant GLenum := 16#1905#; GL_ALPHA : constant GLenum := 16#1906#; GL_LUMINANCE : constant GLenum := 16#1909#; GL_LUMINANCE_ALPHA : constant GLenum := 16#190A#; GL_ALPHA_BITS : constant GLenum := 16#0D55#; GL_RED_BITS : constant GLenum := 16#0D52#; GL_GREEN_BITS : constant GLenum := 16#0D53#; GL_BLUE_BITS : constant GLenum := 16#0D54#; GL_INDEX_BITS : constant GLenum := 16#0D51#; GL_SUBPIXEL_BITS : constant GLenum := 16#0D50#; GL_AUX_BUFFERS : constant GLenum := 16#0C00#; GL_READ_BUFFER : constant GLenum := 16#0C02#; GL_DRAW_BUFFER : constant GLenum := 16#0C01#; GL_DOUBLEBUFFER : constant GLenum := 16#0C32#; GL_STEREO : constant GLenum := 16#0C33#; GL_BITMAP : constant GLenum := 16#1A00#; GL_COLOR : constant GLenum := 16#1800#; GL_DEPTH : constant GLenum := 16#1801#; GL_STENCIL : constant GLenum := 16#1802#; GL_DITHER : constant GLenum := 16#0BD0#; GL_RGB : constant GLenum := 16#1907#; GL_RGBA : constant GLenum := 16#1908#; GL_MAX_LIST_NESTING : constant GLenum := 16#0B31#; GL_MAX_ATTRIB_STACK_DEPTH : constant GLenum := 16#0D35#; GL_MAX_MODELVIEW_STACK_DEPTH : constant GLenum := 16#0D36#; GL_MAX_NAME_STACK_DEPTH : constant GLenum := 16#0D37#; GL_MAX_PROJECTION_STACK_DEPTH : constant GLenum := 16#0D38#; GL_MAX_TEXTURE_STACK_DEPTH : constant GLenum := 16#0D39#; GL_MAX_EVAL_ORDER : constant GLenum := 16#0D30#; GL_MAX_LIGHTS : constant GLenum := 16#0D31#; GL_MAX_CLIP_PLANES : constant GLenum := 16#0D32#; GL_MAX_TEXTURE_SIZE : constant GLenum := 16#0D33#; GL_MAX_PIXEL_MAP_TABLE : constant GLenum := 16#0D34#; GL_MAX_VIEWPORT_DIMS : constant GLenum := 16#0D3A#; GL_MAX_CLIENT_ATTRIB_STACK_DEPTH : constant GLenum := 16#0D3B#; GL_ATTRIB_STACK_DEPTH : constant GLenum := 16#0BB0#; GL_CLIENT_ATTRIB_STACK_DEPTH : constant GLenum := 16#0BB1#; GL_COLOR_CLEAR_VALUE : constant GLenum := 16#0C22#; GL_COLOR_WRITEMASK : constant GLenum := 16#0C23#; GL_CURRENT_INDEX : constant GLenum := 16#0B01#; GL_CURRENT_COLOR : constant GLenum := 16#0B00#; GL_CURRENT_NORMAL : constant GLenum := 16#0B02#; GL_CURRENT_RASTER_COLOR : constant GLenum := 16#0B04#; GL_CURRENT_RASTER_DISTANCE : constant GLenum := 16#0B09#; GL_CURRENT_RASTER_INDEX : constant GLenum := 16#0B05#; GL_CURRENT_RASTER_POSITION : constant GLenum := 16#0B07#; GL_CURRENT_RASTER_TEXTURE_COORDS : constant GLenum := 16#0B06#; GL_CURRENT_RASTER_POSITION_VALID : constant GLenum := 16#0B08#; GL_CURRENT_TEXTURE_COORDS : constant GLenum := 16#0B03#; GL_INDEX_CLEAR_VALUE : constant GLenum := 16#0C20#; GL_INDEX_MODE : constant GLenum := 16#0C30#; GL_INDEX_WRITEMASK : constant GLenum := 16#0C21#; GL_MODELVIEW_MATRIX : constant GLenum := 16#0BA6#; GL_MODELVIEW_STACK_DEPTH : constant GLenum := 16#0BA3#; GL_NAME_STACK_DEPTH : constant GLenum := 16#0D70#; GL_PROJECTION_MATRIX : constant GLenum := 16#0BA7#; GL_PROJECTION_STACK_DEPTH : constant GLenum := 16#0BA4#; GL_RENDER_MODE : constant GLenum := 16#0C40#; GL_RGBA_MODE : constant GLenum := 16#0C31#; GL_TEXTURE_MATRIX : constant GLenum := 16#0BA8#; GL_TEXTURE_STACK_DEPTH : constant GLenum := 16#0BA5#; GL_VIEWPORT : constant GLenum := 16#0BA2#; GL_AUTO_NORMAL : constant GLenum := 16#0D80#; GL_MAP1_COLOR_4 : constant GLenum := 16#0D90#; GL_MAP1_GRID_DOMAIN : constant GLenum := 16#0DD0#; GL_MAP1_GRID_SEGMENTS : constant GLenum := 16#0DD1#; GL_MAP1_INDEX : constant GLenum := 16#0D91#; GL_MAP1_NORMAL : constant GLenum := 16#0D92#; GL_MAP1_TEXTURE_COORD_1 : constant GLenum := 16#0D93#; GL_MAP1_TEXTURE_COORD_2 : constant GLenum := 16#0D94#; GL_MAP1_TEXTURE_COORD_3 : constant GLenum := 16#0D95#; GL_MAP1_TEXTURE_COORD_4 : constant GLenum := 16#0D96#; GL_MAP1_VERTEX_3 : constant GLenum := 16#0D97#; GL_MAP1_VERTEX_4 : constant GLenum := 16#0D98#; GL_MAP2_COLOR_4 : constant GLenum := 16#0DB0#; GL_MAP2_GRID_DOMAIN : constant GLenum := 16#0DD2#; GL_MAP2_GRID_SEGMENTS : constant GLenum := 16#0DD3#; GL_MAP2_INDEX : constant GLenum := 16#0DB1#; GL_MAP2_NORMAL : constant GLenum := 16#0DB2#; GL_MAP2_TEXTURE_COORD_1 : constant GLenum := 16#0DB3#; GL_MAP2_TEXTURE_COORD_2 : constant GLenum := 16#0DB4#; GL_MAP2_TEXTURE_COORD_3 : constant GLenum := 16#0DB5#; GL_MAP2_TEXTURE_COORD_4 : constant GLenum := 16#0DB6#; GL_MAP2_VERTEX_3 : constant GLenum := 16#0DB7#; GL_MAP2_VERTEX_4 : constant GLenum := 16#0DB8#; GL_COEFF : constant GLenum := 16#0A00#; GL_DOMAIN : constant GLenum := 16#0A02#; GL_ORDER : constant GLenum := 16#0A01#; GL_FOG_HINT : constant GLenum := 16#0C54#; GL_LINE_SMOOTH_HINT : constant GLenum := 16#0C52#; GL_PERSPECTIVE_CORRECTION_HINT : constant GLenum := 16#0C50#; GL_POINT_SMOOTH_HINT : constant GLenum := 16#0C51#; GL_POLYGON_SMOOTH_HINT : constant GLenum := 16#0C53#; GL_DONT_CARE : constant GLenum := 16#1100#; GL_FASTEST : constant GLenum := 16#1101#; GL_NICEST : constant GLenum := 16#1102#; GL_SCISSOR_TEST : constant GLenum := 16#0C11#; GL_SCISSOR_BOX : constant GLenum := 16#0C10#; GL_MAP_COLOR : constant GLenum := 16#0D10#; GL_MAP_STENCIL : constant GLenum := 16#0D11#; GL_INDEX_SHIFT : constant GLenum := 16#0D12#; GL_INDEX_OFFSET : constant GLenum := 16#0D13#; GL_RED_SCALE : constant GLenum := 16#0D14#; GL_RED_BIAS : constant GLenum := 16#0D15#; GL_GREEN_SCALE : constant GLenum := 16#0D18#; GL_GREEN_BIAS : constant GLenum := 16#0D19#; GL_BLUE_SCALE : constant GLenum := 16#0D1A#; GL_BLUE_BIAS : constant GLenum := 16#0D1B#; GL_ALPHA_SCALE : constant GLenum := 16#0D1C#; GL_ALPHA_BIAS : constant GLenum := 16#0D1D#; GL_DEPTH_SCALE : constant GLenum := 16#0D1E#; GL_DEPTH_BIAS : constant GLenum := 16#0D1F#; GL_PIXEL_MAP_S_TO_S_SIZE : constant GLenum := 16#0CB1#; GL_PIXEL_MAP_I_TO_I_SIZE : constant GLenum := 16#0CB0#; GL_PIXEL_MAP_I_TO_R_SIZE : constant GLenum := 16#0CB2#; GL_PIXEL_MAP_I_TO_G_SIZE : constant GLenum := 16#0CB3#; GL_PIXEL_MAP_I_TO_B_SIZE : constant GLenum := 16#0CB4#; GL_PIXEL_MAP_I_TO_A_SIZE : constant GLenum := 16#0CB5#; GL_PIXEL_MAP_R_TO_R_SIZE : constant GLenum := 16#0CB6#; GL_PIXEL_MAP_G_TO_G_SIZE : constant GLenum := 16#0CB7#; GL_PIXEL_MAP_B_TO_B_SIZE : constant GLenum := 16#0CB8#; GL_PIXEL_MAP_A_TO_A_SIZE : constant GLenum := 16#0CB9#; GL_PIXEL_MAP_S_TO_S : constant GLenum := 16#0C71#; GL_PIXEL_MAP_I_TO_I : constant GLenum := 16#0C70#; GL_PIXEL_MAP_I_TO_R : constant GLenum := 16#0C72#; GL_PIXEL_MAP_I_TO_G : constant GLenum := 16#0C73#; GL_PIXEL_MAP_I_TO_B : constant GLenum := 16#0C74#; GL_PIXEL_MAP_I_TO_A : constant GLenum := 16#0C75#; GL_PIXEL_MAP_R_TO_R : constant GLenum := 16#0C76#; GL_PIXEL_MAP_G_TO_G : constant GLenum := 16#0C77#; GL_PIXEL_MAP_B_TO_B : constant GLenum := 16#0C78#; GL_PIXEL_MAP_A_TO_A : constant GLenum := 16#0C79#; GL_PACK_ALIGNMENT : constant GLenum := 16#0D05#; GL_PACK_LSB_FIRST : constant GLenum := 16#0D01#; GL_PACK_ROW_LENGTH : constant GLenum := 16#0D02#; GL_PACK_SKIP_PIXELS : constant GLenum := 16#0D04#; GL_PACK_SKIP_ROWS : constant GLenum := 16#0D03#; GL_PACK_SWAP_BYTES : constant GLenum := 16#0D00#; GL_UNPACK_ALIGNMENT : constant GLenum := 16#0CF5#; GL_UNPACK_LSB_FIRST : constant GLenum := 16#0CF1#; GL_UNPACK_ROW_LENGTH : constant GLenum := 16#0CF2#; GL_UNPACK_SKIP_PIXELS : constant GLenum := 16#0CF4#; GL_UNPACK_SKIP_ROWS : constant GLenum := 16#0CF3#; GL_UNPACK_SWAP_BYTES : constant GLenum := 16#0CF0#; GL_ZOOM_X : constant GLenum := 16#0D16#; GL_ZOOM_Y : constant GLenum := 16#0D17#; GL_TEXTURE_ENV : constant GLenum := 16#2300#; GL_TEXTURE_ENV_MODE : constant GLenum := 16#2200#; GL_TEXTURE_1D : constant GLenum := 16#0DE0#; GL_TEXTURE_2D : constant GLenum := 16#0DE1#; GL_TEXTURE_WRAP_S : constant GLenum := 16#2802#; GL_TEXTURE_WRAP_T : constant GLenum := 16#2803#; GL_TEXTURE_MAG_FILTER : constant GLenum := 16#2800#; GL_TEXTURE_MIN_FILTER : constant GLenum := 16#2801#; GL_TEXTURE_ENV_COLOR : constant GLenum := 16#2201#; GL_TEXTURE_GEN_S : constant GLenum := 16#0C60#; GL_TEXTURE_GEN_T : constant GLenum := 16#0C61#; GL_TEXTURE_GEN_MODE : constant GLenum := 16#2500#; GL_TEXTURE_BORDER_COLOR : constant GLenum := 16#1004#; GL_TEXTURE_WIDTH : constant GLenum := 16#1000#; GL_TEXTURE_HEIGHT : constant GLenum := 16#1001#; GL_TEXTURE_BORDER : constant GLenum := 16#1005#; GL_TEXTURE_COMPONENTS : constant GLenum := 16#1003#; GL_TEXTURE_RED_SIZE : constant GLenum := 16#805C#; GL_TEXTURE_GREEN_SIZE : constant GLenum := 16#805D#; GL_TEXTURE_BLUE_SIZE : constant GLenum := 16#805E#; GL_TEXTURE_ALPHA_SIZE : constant GLenum := 16#805F#; GL_TEXTURE_LUMINANCE_SIZE : constant GLenum := 16#8060#; GL_TEXTURE_INTENSITY_SIZE : constant GLenum := 16#8061#; GL_NEAREST_MIPMAP_NEAREST : constant GLenum := 16#2700#; GL_NEAREST_MIPMAP_LINEAR : constant GLenum := 16#2702#; GL_LINEAR_MIPMAP_NEAREST : constant GLenum := 16#2701#; GL_LINEAR_MIPMAP_LINEAR : constant GLenum := 16#2703#; GL_OBJECT_LINEAR : constant GLenum := 16#2401#; GL_OBJECT_PLANE : constant GLenum := 16#2501#; GL_EYE_LINEAR : constant GLenum := 16#2400#; GL_EYE_PLANE : constant GLenum := 16#2502#; GL_SPHERE_MAP : constant GLenum := 16#2402#; GL_DECAL : constant GLenum := 16#2101#; GL_MODULATE : constant GLenum := 16#2100#; GL_NEAREST : constant GLenum := 16#2600#; GL_REPEAT : constant GLenum := 16#2901#; GL_CLAMP : constant GLenum := 16#2900#; GL_S : constant GLenum := 16#2000#; GL_T : constant GLenum := 16#2001#; GL_R : constant GLenum := 16#2002#; GL_Q : constant GLenum := 16#2003#; GL_TEXTURE_GEN_R : constant GLenum := 16#0C62#; GL_TEXTURE_GEN_Q : constant GLenum := 16#0C63#; GL_VENDOR : constant GLenum := 16#1F00#; GL_RENDERER : constant GLenum := 16#1F01#; GL_VERSION : constant GLenum := 16#1F02#; GL_EXTENSIONS : constant GLenum := 16#1F03#; GL_NO_ERROR : constant GLenum := 16#0#; GL_INVALID_VALUE : constant GLenum := 16#0501#; GL_INVALID_ENUM : constant GLenum := 16#0500#; GL_INVALID_OPERATION : constant GLenum := 16#0502#; GL_STACK_OVERFLOW : constant GLenum := 16#0503#; GL_STACK_UNDERFLOW : constant GLenum := 16#0504#; GL_OUT_OF_MEMORY : constant GLenum := 16#0505#; GL_CURRENT_BIT : constant GLenum := 16#00000001#; GL_POINT_BIT : constant GLenum := 16#00000002#; GL_LINE_BIT : constant GLenum := 16#00000004#; GL_POLYGON_BIT : constant GLenum := 16#00000008#; GL_POLYGON_STIPPLE_BIT : constant GLenum := 16#00000010#; GL_PIXEL_MODE_BIT : constant GLenum := 16#00000020#; GL_LIGHTING_BIT : constant GLenum := 16#00000040#; GL_FOG_BIT : constant GLenum := 16#00000080#; GL_DEPTH_BUFFER_BIT : constant GLenum := 16#00000100#; GL_ACCUM_BUFFER_BIT : constant GLenum := 16#00000200#; GL_STENCIL_BUFFER_BIT : constant GLenum := 16#00000400#; GL_VIEWPORT_BIT : constant GLenum := 16#00000800#; GL_TRANSFORM_BIT : constant GLenum := 16#00001000#; GL_ENABLE_BIT : constant GLenum := 16#00002000#; GL_COLOR_BUFFER_BIT : constant GLenum := 16#00004000#; GL_HINT_BIT : constant GLenum := 16#00008000#; GL_EVAL_BIT : constant GLenum := 16#00010000#; GL_LIST_BIT : constant GLenum := 16#00020000#; GL_TEXTURE_BIT : constant GLenum := 16#00040000#; GL_SCISSOR_BIT : constant GLenum := 16#00080000#; GL_ALL_ATTRIB_BITS : constant GLenum := 16#000FFFFF#; GL_PROXY_TEXTURE_1D : constant GLenum := 16#8063#; GL_PROXY_TEXTURE_2D : constant GLenum := 16#8064#; GL_TEXTURE_PRIORITY : constant GLenum := 16#8066#; GL_TEXTURE_RESIDENT : constant GLenum := 16#8067#; GL_TEXTURE_BINDING_1D : constant GLenum := 16#8068#; GL_TEXTURE_BINDING_2D : constant GLenum := 16#8069#; GL_TEXTURE_INTERNAL_FORMAT : constant GLenum := 16#1003#; GL_ALPHA4 : constant GLenum := 16#803B#; GL_ALPHA8 : constant GLenum := 16#803C#; GL_ALPHA12 : constant GLenum := 16#803D#; GL_ALPHA16 : constant GLenum := 16#803E#; GL_LUMINANCE4 : constant GLenum := 16#803F#; GL_LUMINANCE8 : constant GLenum := 16#8040#; GL_LUMINANCE12 : constant GLenum := 16#8041#; GL_LUMINANCE16 : constant GLenum := 16#8042#; GL_LUMINANCE4_ALPHA4 : constant GLenum := 16#8043#; GL_LUMINANCE6_ALPHA2 : constant GLenum := 16#8044#; GL_LUMINANCE8_ALPHA8 : constant GLenum := 16#8045#; GL_LUMINANCE12_ALPHA4 : constant GLenum := 16#8046#; GL_LUMINANCE12_ALPHA12 : constant GLenum := 16#8047#; GL_LUMINANCE16_ALPHA16 : constant GLenum := 16#8048#; GL_INTENSITY : constant GLenum := 16#8049#; GL_INTENSITY4 : constant GLenum := 16#804A#; GL_INTENSITY8 : constant GLenum := 16#804B#; GL_INTENSITY12 : constant GLenum := 16#804C#; GL_INTENSITY16 : constant GLenum := 16#804D#; GL_R3_G3_B2 : constant GLenum := 16#2A10#; GL_RGB4 : constant GLenum := 16#804F#; GL_RGB5 : constant GLenum := 16#8050#; GL_RGB8 : constant GLenum := 16#8051#; GL_RGB10 : constant GLenum := 16#8052#; GL_RGB12 : constant GLenum := 16#8053#; GL_RGB16 : constant GLenum := 16#8054#; GL_RGBA2 : constant GLenum := 16#8055#; GL_RGBA4 : constant GLenum := 16#8056#; GL_RGB5_A1 : constant GLenum := 16#8057#; GL_RGBA8 : constant GLenum := 16#8058#; GL_RGB10_A2 : constant GLenum := 16#8059#; GL_RGBA12 : constant GLenum := 16#805A#; GL_RGBA16 : constant GLenum := 16#805B#; GL_CLIENT_PIXEL_STORE_BIT : constant GLenum := 16#00000001#; GL_CLIENT_VERTEX_ARRAY_BIT : constant GLenum := 16#00000002#; GL_ALL_CLIENT_ATTRIB_BITS : constant GLenum := 16#FFFFFFFF#; GL_CLIENT_ALL_ATTRIB_BITS : constant GLenum := 16#FFFFFFFF#; GL_RESCALE_NORMAL : constant GLenum := 16#803A#; GL_CLAMP_TO_EDGE : constant GLenum := 16#812F#; GL_MAX_ELEMENTS_VERTICES : constant GLenum := 16#80E8#; GL_MAX_ELEMENTS_INDICES : constant GLenum := 16#80E9#; GL_BGR : constant GLenum := 16#80E0#; GL_BGRA : constant GLenum := 16#80E1#; GL_UNSIGNED_BYTE_3_3_2 : constant GLenum := 16#8032#; GL_UNSIGNED_BYTE_2_3_3_REV : constant GLenum := 16#8362#; GL_UNSIGNED_SHORT_5_6_5 : constant GLenum := 16#8363#; GL_UNSIGNED_SHORT_5_6_5_REV : constant GLenum := 16#8364#; GL_UNSIGNED_SHORT_4_4_4_4 : constant GLenum := 16#8033#; GL_UNSIGNED_SHORT_4_4_4_4_REV : constant GLenum := 16#8365#; GL_UNSIGNED_SHORT_5_5_5_1 : constant GLenum := 16#8034#; GL_UNSIGNED_SHORT_1_5_5_5_REV : constant GLenum := 16#8366#; GL_UNSIGNED_INT_8_8_8_8 : constant GLenum := 16#8035#; GL_UNSIGNED_INT_8_8_8_8_REV : constant GLenum := 16#8367#; GL_UNSIGNED_INT_10_10_10_2 : constant GLenum := 16#8036#; GL_UNSIGNED_INT_2_10_10_10_REV : constant GLenum := 16#8368#; GL_LIGHT_MODEL_COLOR_CONTROL : constant GLenum := 16#81F8#; GL_SINGLE_COLOR : constant GLenum := 16#81F9#; GL_SEPARATE_SPECULAR_COLOR : constant GLenum := 16#81FA#; GL_TEXTURE_MIN_LOD : constant GLenum := 16#813A#; GL_TEXTURE_MAX_LOD : constant GLenum := 16#813B#; GL_TEXTURE_BASE_LEVEL : constant GLenum := 16#813C#; GL_TEXTURE_MAX_LEVEL : constant GLenum := 16#813D#; GL_SMOOTH_POINT_SIZE_RANGE : constant GLenum := 16#0B12#; GL_SMOOTH_POINT_SIZE_GRANULARITY : constant GLenum := 16#0B13#; GL_SMOOTH_LINE_WIDTH_RANGE : constant GLenum := 16#0B22#; GL_SMOOTH_LINE_WIDTH_GRANULARITY : constant GLenum := 16#0B23#; GL_ALIASED_POINT_SIZE_RANGE : constant GLenum := 16#846D#; GL_ALIASED_LINE_WIDTH_RANGE : constant GLenum := 16#846E#; GL_PACK_SKIP_IMAGES : constant GLenum := 16#806B#; GL_PACK_IMAGE_HEIGHT : constant GLenum := 16#806C#; GL_UNPACK_SKIP_IMAGES : constant GLenum := 16#806D#; GL_UNPACK_IMAGE_HEIGHT : constant GLenum := 16#806E#; GL_TEXTURE_3D : constant GLenum := 16#806F#; GL_PROXY_TEXTURE_3D : constant GLenum := 16#8070#; GL_TEXTURE_DEPTH : constant GLenum := 16#8071#; GL_TEXTURE_WRAP_R : constant GLenum := 16#8072#; GL_MAX_3D_TEXTURE_SIZE : constant GLenum := 16#8073#; GL_TEXTURE_BINDING_3D : constant GLenum := 16#806A#; GL_COLOR_TABLE : constant GLenum := 16#80D0#; GL_POST_CONVOLUTION_COLOR_TABLE : constant GLenum := 16#80D1#; GL_POST_COLOR_MATRIX_COLOR_TABLE : constant GLenum := 16#80D2#; GL_PROXY_COLOR_TABLE : constant GLenum := 16#80D3#; GL_PROXY_POST_CONVOLUTION_COLOR_TABLE : constant GLenum := 16#80D4#; GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE : constant GLenum := 16#80D5#; GL_COLOR_TABLE_SCALE : constant GLenum := 16#80D6#; GL_COLOR_TABLE_BIAS : constant GLenum := 16#80D7#; GL_COLOR_TABLE_FORMAT : constant GLenum := 16#80D8#; GL_COLOR_TABLE_WIDTH : constant GLenum := 16#80D9#; GL_COLOR_TABLE_RED_SIZE : constant GLenum := 16#80DA#; GL_COLOR_TABLE_GREEN_SIZE : constant GLenum := 16#80DB#; GL_COLOR_TABLE_BLUE_SIZE : constant GLenum := 16#80DC#; GL_COLOR_TABLE_ALPHA_SIZE : constant GLenum := 16#80DD#; GL_COLOR_TABLE_LUMINANCE_SIZE : constant GLenum := 16#80DE#; GL_COLOR_TABLE_INTENSITY_SIZE : constant GLenum := 16#80DF#; GL_CONVOLUTION_1D : constant GLenum := 16#8010#; GL_CONVOLUTION_2D : constant GLenum := 16#8011#; GL_SEPARABLE_2D : constant GLenum := 16#8012#; GL_CONVOLUTION_BORDER_MODE : constant GLenum := 16#8013#; GL_CONVOLUTION_FILTER_SCALE : constant GLenum := 16#8014#; GL_CONVOLUTION_FILTER_BIAS : constant GLenum := 16#8015#; GL_REDUCE : constant GLenum := 16#8016#; GL_CONVOLUTION_FORMAT : constant GLenum := 16#8017#; GL_CONVOLUTION_WIDTH : constant GLenum := 16#8018#; GL_CONVOLUTION_HEIGHT : constant GLenum := 16#8019#; GL_MAX_CONVOLUTION_WIDTH : constant GLenum := 16#801A#; GL_MAX_CONVOLUTION_HEIGHT : constant GLenum := 16#801B#; GL_POST_CONVOLUTION_RED_SCALE : constant GLenum := 16#801C#; GL_POST_CONVOLUTION_GREEN_SCALE : constant GLenum := 16#801D#; GL_POST_CONVOLUTION_BLUE_SCALE : constant GLenum := 16#801E#; GL_POST_CONVOLUTION_ALPHA_SCALE : constant GLenum := 16#801F#; GL_POST_CONVOLUTION_RED_BIAS : constant GLenum := 16#8020#; GL_POST_CONVOLUTION_GREEN_BIAS : constant GLenum := 16#8021#; GL_POST_CONVOLUTION_BLUE_BIAS : constant GLenum := 16#8022#; GL_POST_CONVOLUTION_ALPHA_BIAS : constant GLenum := 16#8023#; GL_CONSTANT_BORDER : constant GLenum := 16#8151#; GL_REPLICATE_BORDER : constant GLenum := 16#8153#; GL_CONVOLUTION_BORDER_COLOR : constant GLenum := 16#8154#; GL_COLOR_MATRIX : constant GLenum := 16#80B1#; GL_COLOR_MATRIX_STACK_DEPTH : constant GLenum := 16#80B2#; GL_MAX_COLOR_MATRIX_STACK_DEPTH : constant GLenum := 16#80B3#; GL_POST_COLOR_MATRIX_RED_SCALE : constant GLenum := 16#80B4#; GL_POST_COLOR_MATRIX_GREEN_SCALE : constant GLenum := 16#80B5#; GL_POST_COLOR_MATRIX_BLUE_SCALE : constant GLenum := 16#80B6#; GL_POST_COLOR_MATRIX_ALPHA_SCALE : constant GLenum := 16#80B7#; GL_POST_COLOR_MATRIX_RED_BIAS : constant GLenum := 16#80B8#; GL_POST_COLOR_MATRIX_GREEN_BIAS : constant GLenum := 16#80B9#; GL_POST_COLOR_MATRIX_BLUE_BIAS : constant GLenum := 16#80BA#; GL_POST_COLOR_MATRIX_ALPHA_BIAS : constant GLenum := 16#80BB#; GL_HISTOGRAM : constant GLenum := 16#8024#; GL_PROXY_HISTOGRAM : constant GLenum := 16#8025#; GL_HISTOGRAM_WIDTH : constant GLenum := 16#8026#; GL_HISTOGRAM_FORMAT : constant GLenum := 16#8027#; GL_HISTOGRAM_RED_SIZE : constant GLenum := 16#8028#; GL_HISTOGRAM_GREEN_SIZE : constant GLenum := 16#8029#; GL_HISTOGRAM_BLUE_SIZE : constant GLenum := 16#802A#; GL_HISTOGRAM_ALPHA_SIZE : constant GLenum := 16#802B#; GL_HISTOGRAM_LUMINANCE_SIZE : constant GLenum := 16#802C#; GL_HISTOGRAM_SINK : constant GLenum := 16#802D#; GL_MINMAX : constant GLenum := 16#802E#; GL_MINMAX_FORMAT : constant GLenum := 16#802F#; GL_MINMAX_SINK : constant GLenum := 16#8030#; GL_TABLE_TOO_LARGE : constant GLenum := 16#8031#; GL_BLEND_EQUATION : constant GLenum := 16#8009#; GL_MIN : constant GLenum := 16#8007#; GL_MAX : constant GLenum := 16#8008#; GL_FUNC_ADD : constant GLenum := 16#8006#; GL_FUNC_SUBTRACT : constant GLenum := 16#800A#; GL_FUNC_REVERSE_SUBTRACT : constant GLenum := 16#800B#; GL_BLEND_COLOR : constant GLenum := 16#8005#; GL_TEXTURE0 : constant GLenum := 16#84C0#; GL_TEXTURE1 : constant GLenum := 16#84C1#; GL_TEXTURE2 : constant GLenum := 16#84C2#; GL_TEXTURE3 : constant GLenum := 16#84C3#; GL_TEXTURE4 : constant GLenum := 16#84C4#; GL_TEXTURE5 : constant GLenum := 16#84C5#; GL_TEXTURE6 : constant GLenum := 16#84C6#; GL_TEXTURE7 : constant GLenum := 16#84C7#; GL_TEXTURE8 : constant GLenum := 16#84C8#; GL_TEXTURE9 : constant GLenum := 16#84C9#; GL_TEXTURE10 : constant GLenum := 16#84CA#; GL_TEXTURE11 : constant GLenum := 16#84CB#; GL_TEXTURE12 : constant GLenum := 16#84CC#; GL_TEXTURE13 : constant GLenum := 16#84CD#; GL_TEXTURE14 : constant GLenum := 16#84CE#; GL_TEXTURE15 : constant GLenum := 16#84CF#; GL_TEXTURE16 : constant GLenum := 16#84D0#; GL_TEXTURE17 : constant GLenum := 16#84D1#; GL_TEXTURE18 : constant GLenum := 16#84D2#; GL_TEXTURE19 : constant GLenum := 16#84D3#; GL_TEXTURE20 : constant GLenum := 16#84D4#; GL_TEXTURE21 : constant GLenum := 16#84D5#; GL_TEXTURE22 : constant GLenum := 16#84D6#; GL_TEXTURE23 : constant GLenum := 16#84D7#; GL_TEXTURE24 : constant GLenum := 16#84D8#; GL_TEXTURE25 : constant GLenum := 16#84D9#; GL_TEXTURE26 : constant GLenum := 16#84DA#; GL_TEXTURE27 : constant GLenum := 16#84DB#; GL_TEXTURE28 : constant GLenum := 16#84DC#; GL_TEXTURE29 : constant GLenum := 16#84DD#; GL_TEXTURE30 : constant GLenum := 16#84DE#; GL_TEXTURE31 : constant GLenum := 16#84DF#; GL_ACTIVE_TEXTURE : constant GLenum := 16#84E0#; GL_CLIENT_ACTIVE_TEXTURE : constant GLenum := 16#84E1#; GL_MAX_TEXTURE_UNITS : constant GLenum := 16#84E2#; GL_NORMAL_MAP : constant GLenum := 16#8511#; GL_REFLECTION_MAP : constant GLenum := 16#8512#; GL_TEXTURE_CUBE_MAP : constant GLenum := 16#8513#; GL_TEXTURE_BINDING_CUBE_MAP : constant GLenum := 16#8514#; GL_TEXTURE_CUBE_MAP_POSITIVE_X : constant GLenum := 16#8515#; GL_TEXTURE_CUBE_MAP_NEGATIVE_X : constant GLenum := 16#8516#; GL_TEXTURE_CUBE_MAP_POSITIVE_Y : constant GLenum := 16#8517#; GL_TEXTURE_CUBE_MAP_NEGATIVE_Y : constant GLenum := 16#8518#; GL_TEXTURE_CUBE_MAP_POSITIVE_Z : constant GLenum := 16#8519#; GL_TEXTURE_CUBE_MAP_NEGATIVE_Z : constant GLenum := 16#851A#; GL_PROXY_TEXTURE_CUBE_MAP : constant GLenum := 16#851B#; GL_MAX_CUBE_MAP_TEXTURE_SIZE : constant GLenum := 16#851C#; GL_COMPRESSED_ALPHA : constant GLenum := 16#84E9#; GL_COMPRESSED_LUMINANCE : constant GLenum := 16#84EA#; GL_COMPRESSED_LUMINANCE_ALPHA : constant GLenum := 16#84EB#; GL_COMPRESSED_INTENSITY : constant GLenum := 16#84EC#; GL_COMPRESSED_RGB : constant GLenum := 16#84ED#; GL_COMPRESSED_RGBA : constant GLenum := 16#84EE#; GL_TEXTURE_COMPRESSION_HINT : constant GLenum := 16#84EF#; GL_TEXTURE_COMPRESSED_IMAGE_SIZE : constant GLenum := 16#86A0#; GL_TEXTURE_COMPRESSED : constant GLenum := 16#86A1#; GL_NUM_COMPRESSED_TEXTURE_FORMATS : constant GLenum := 16#86A2#; GL_COMPRESSED_TEXTURE_FORMATS : constant GLenum := 16#86A3#; GL_MULTISAMPLE : constant GLenum := 16#809D#; GL_SAMPLE_ALPHA_TO_COVERAGE : constant GLenum := 16#809E#; GL_SAMPLE_ALPHA_TO_ONE : constant GLenum := 16#809F#; GL_SAMPLE_COVERAGE : constant GLenum := 16#80A0#; GL_SAMPLE_BUFFERS : constant GLenum := 16#80A8#; GL_SAMPLES : constant GLenum := 16#80A9#; GL_SAMPLE_COVERAGE_VALUE : constant GLenum := 16#80AA#; GL_SAMPLE_COVERAGE_INVERT : constant GLenum := 16#80AB#; GL_MULTISAMPLE_BIT : constant GLenum := 16#20000000#; GL_TRANSPOSE_MODELVIEW_MATRIX : constant GLenum := 16#84E3#; GL_TRANSPOSE_PROJECTION_MATRIX : constant GLenum := 16#84E4#; GL_TRANSPOSE_TEXTURE_MATRIX : constant GLenum := 16#84E5#; GL_TRANSPOSE_COLOR_MATRIX : constant GLenum := 16#84E6#; GL_COMBINE : constant GLenum := 16#8570#; GL_COMBINE_RGB : constant GLenum := 16#8571#; GL_COMBINE_ALPHA : constant GLenum := 16#8572#; GL_SOURCE0_RGB : constant GLenum := 16#8580#; GL_SOURCE1_RGB : constant GLenum := 16#8581#; GL_SOURCE2_RGB : constant GLenum := 16#8582#; GL_SOURCE0_ALPHA : constant GLenum := 16#8588#; GL_SOURCE1_ALPHA : constant GLenum := 16#8589#; GL_SOURCE2_ALPHA : constant GLenum := 16#858A#; GL_OPERAND0_RGB : constant GLenum := 16#8590#; GL_OPERAND1_RGB : constant GLenum := 16#8591#; GL_OPERAND2_RGB : constant GLenum := 16#8592#; GL_OPERAND0_ALPHA : constant GLenum := 16#8598#; GL_OPERAND1_ALPHA : constant GLenum := 16#8599#; GL_OPERAND2_ALPHA : constant GLenum := 16#859A#; GL_RGB_SCALE : constant GLenum := 16#8573#; GL_ADD_SIGNED : constant GLenum := 16#8574#; GL_INTERPOLATE : constant GLenum := 16#8575#; GL_SUBTRACT : constant GLenum := 16#84E7#; GL_CONSTANT : constant GLenum := 16#8576#; GL_PRIMARY_COLOR : constant GLenum := 16#8577#; GL_PREVIOUS : constant GLenum := 16#8578#; GL_DOT3_RGB : constant GLenum := 16#86AE#; GL_DOT3_RGBA : constant GLenum := 16#86AF#; GL_CLAMP_TO_BORDER : constant GLenum := 16#812D#; -- //////////////////////////////////////////////////////////// -- // GL functions -- //////////////////////////////////////////////////////////// procedure glClearIndex (c : GLfloat); procedure glClearColor (red : GLclampf; green : GLclampf; blue : GLclampf; alpha : GLclampf); procedure glClear (mask : GLbitfield); procedure glIndexMask (mask : GLuint); procedure glColorMask (red : GLboolean; green : GLboolean; blue : GLboolean; alpha : GLboolean); procedure glAlphaFunc (func : GLenum; ref : GLclampf); procedure glBlendFunc (sfactor : GLenum; dfactor : GLenum); procedure glLogicOp (opcode : GLenum); procedure glCullFace (mode : GLenum); procedure glFrontFace (mode : GLenum); procedure glPointSize (size : GLfloat); procedure glLineWidth (width : GLfloat); procedure glLineStipple (factor : GLint; pattern : GLushort); procedure glPolygonMode (face : GLenum; mode : GLenum); procedure glPolygonOffset (factor : GLfloat; units : GLfloat); procedure glPolygonStipple (mask : access GLubyte); procedure glGetPolygonStipple (mask : access GLubyte); procedure glEdgeFlag (flag : GLboolean); procedure glEdgeFlagv (flag : access GLboolean); procedure glScissor (x : GLint; y : GLint; width : GLsizei; height : GLsizei); procedure glClipPlane (plane : GLenum; equation : access GLdouble); procedure glGetClipPlane (plane : GLenum; equation : access GLdouble); procedure glDrawBuffer (mode : GLenum); procedure glReadBuffer (mode : GLenum); procedure glEnable (cap : GLenum); procedure glDisable (cap : GLenum); function glIsEnabled (cap : GLenum) return GLboolean; procedure glEnableClientState (cap : GLenum); procedure glDisableClientState (cap : GLenum); procedure glGetBooleanv (pname : GLenum; params : access GLboolean); procedure glGetDoublev (pname : GLenum; params : access GLdouble); procedure glGetFloatv (pname : GLenum; params : access GLfloat); procedure glGetIntegerv (pname : GLenum; params : access GLint); procedure glPushAttrib (mask : GLbitfield); procedure glPopAttrib; procedure glPushClientAttrib (mask : GLbitfield); procedure glPopClientAttrib; function glRenderMode (mode : GLenum) return GLint; function glGetError return GLenum; function glGetString (name : GLenum) return GLubyte_Ptr; procedure glFinish; procedure glFlush; procedure glHint (target : GLenum; mode : GLenum); procedure glClearDepth (depth : GLclampd); procedure glDepthFunc (func : GLenum); procedure glDepthMask (flag : GLboolean); procedure glDepthRange (near_val : GLclampd; far_val : GLclampd); procedure glClearAccum (red : GLfloat; green : GLfloat; blue : GLfloat; alpha : GLfloat); procedure glAccum (op : GLenum; value : GLfloat); procedure glMatrixMode (mode : GLenum); procedure glOrtho (left : GLdouble; right : GLdouble; bottom : GLdouble; top : GLdouble; near_val : GLdouble; far_val : GLdouble); procedure glFrustum (left : GLdouble; right : GLdouble; bottom : GLdouble; top : GLdouble; near_val : GLdouble; far_val : GLdouble); procedure glViewport (x : GLint; y : GLint; width : GLsizei; height : GLsizei); procedure glPushMatrix; procedure glPopMatrix; procedure glLoadIdentity; procedure glLoadMatrixd (m : access GLdouble); procedure glLoadMatrixf (m : access GLfloat); procedure glMultMatrixd (m : access GLdouble); procedure glMultMatrixf (m : access GLfloat); procedure glRotated (angle : GLdouble; x : GLdouble; y : GLdouble; z : GLdouble); procedure glRotatef (angle : GLfloat; x : GLfloat; y : GLfloat; z : GLfloat); procedure glScaled (x : GLdouble; y : GLdouble; z : GLdouble); procedure glScalef (x : GLfloat; y : GLfloat; z : GLfloat); procedure glTranslated (x : GLdouble; y : GLdouble; z : GLdouble); procedure glTranslatef (x : GLfloat; y : GLfloat; z : GLfloat); function glIsList (list : GLuint) return GLboolean; procedure glDeleteLists (list : GLuint; c_range : GLsizei); function glGenLists (c_range : GLsizei) return GLuint; procedure glNewList (list : GLuint; mode : GLenum); procedure glEndList; procedure glCallList (list : GLuint); procedure glCallLists (n : GLsizei; c_type : GLenum; lists : GLvoid_Ptr); procedure glListBase (base : GLuint); procedure glBegin (mode : GLenum); procedure glEnd; procedure glVertex2d (x : GLdouble; y : GLdouble); procedure glVertex2f (x : GLfloat; y : GLfloat); procedure glVertex2i (x : GLint; y : GLint); procedure glVertex2s (x : GLshort; y : GLshort); procedure glVertex3d (x : GLdouble; y : GLdouble; z : GLdouble); procedure glVertex3f (x : GLfloat; y : GLfloat; z : GLfloat); procedure glVertex3i (x : GLint; y : GLint; z : GLint); procedure glVertex3s (x : GLshort; y : GLshort; z : GLshort); procedure glVertex4d (x : GLdouble; y : GLdouble; z : GLdouble; w : GLdouble); procedure glVertex4f (x : GLfloat; y : GLfloat; z : GLfloat; w : GLfloat); procedure glVertex4i (x : GLint; y : GLint; z : GLint; w : GLint); procedure glVertex4s (x : GLshort; y : GLshort; z : GLshort; w : GLshort); procedure glVertex2dv (v : access GLdouble); procedure glVertex2fv (v : access GLfloat); procedure glVertex2iv (v : access GLint); procedure glVertex2sv (v : access GLshort); procedure glVertex3dv (v : access GLdouble); procedure glVertex3fv (v : access GLfloat); procedure glVertex3iv (v : access GLint); procedure glVertex3sv (v : access GLshort); procedure glVertex4dv (v : access GLdouble); procedure glVertex4fv (v : access GLfloat); procedure glVertex4iv (v : access GLint); procedure glVertex4sv (v : access GLshort); procedure glNormal3b (nx : GLbyte; ny : GLbyte; nz : GLbyte); procedure glNormal3d (nx : GLdouble; ny : GLdouble; nz : GLdouble); procedure glNormal3f (nx : GLfloat; ny : GLfloat; nz : GLfloat); procedure glNormal3i (nx : GLint; ny : GLint; nz : GLint); procedure glNormal3s (nx : GLshort; ny : GLshort; nz : GLshort); procedure glNormal3bv (v : access GLbyte); procedure glNormal3dv (v : access GLdouble); procedure glNormal3fv (v : access GLfloat); procedure glNormal3iv (v : access GLint); procedure glNormal3sv (v : access GLshort); procedure glIndexd (c : GLdouble); procedure glIndexf (c : GLfloat); procedure glIndexi (c : GLint); procedure glIndexs (c : GLshort); procedure glIndexub (c : GLubyte); procedure glIndexdv (c : access GLdouble); procedure glIndexfv (c : access GLfloat); procedure glIndexiv (c : access GLint); procedure glIndexsv (c : access GLshort); procedure glIndexubv (c : access GLubyte); procedure glColor3b (red : GLbyte; green : GLbyte; blue : GLbyte); procedure glColor3d (red : GLdouble; green : GLdouble; blue : GLdouble); procedure glColor3f (red : GLfloat; green : GLfloat; blue : GLfloat); procedure glColor3i (red : GLint; green : GLint; blue : GLint); procedure glColor3s (red : GLshort; green : GLshort; blue : GLshort); procedure glColor3ub (red : GLubyte; green : GLubyte; blue : GLubyte); procedure glColor3ui (red : GLuint; green : GLuint; blue : GLuint); procedure glColor3us (red : GLushort; green : GLushort; blue : GLushort); procedure glColor4b (red : GLbyte; green : GLbyte; blue : GLbyte; alpha : GLbyte); procedure glColor4d (red : GLdouble; green : GLdouble; blue : GLdouble; alpha : GLdouble); procedure glColor4f (red : GLfloat; green : GLfloat; blue : GLfloat; alpha : GLfloat); procedure glColor4i (red : GLint; green : GLint; blue : GLint; alpha : GLint); procedure glColor4s (red : GLshort; green : GLshort; blue : GLshort; alpha : GLshort); procedure glColor4ub (red : GLubyte; green : GLubyte; blue : GLubyte; alpha : GLubyte); procedure glColor4ui (red : GLuint; green : GLuint; blue : GLuint; alpha : GLuint); procedure glColor4us (red : GLushort; green : GLushort; blue : GLushort; alpha : GLushort); procedure glColor3bv (v : access GLbyte); procedure glColor3dv (v : access GLdouble); procedure glColor3fv (v : access GLfloat); procedure glColor3iv (v : access GLint); procedure glColor3sv (v : access GLshort); procedure glColor3ubv (v : access GLubyte); procedure glColor3uiv (v : access GLuint); procedure glColor3usv (v : access GLushort); procedure glColor4bv (v : access GLbyte); procedure glColor4dv (v : access GLdouble); procedure glColor4fv (v : access GLfloat); procedure glColor4iv (v : access GLint); procedure glColor4sv (v : access GLshort); procedure glColor4ubv (v : access GLubyte); procedure glColor4uiv (v : access GLuint); procedure glColor4usv (v : access GLushort); procedure glTexCoord1d (s : GLdouble); procedure glTexCoord1f (s : GLfloat); procedure glTexCoord1i (s : GLint); procedure glTexCoord1s (s : GLshort); procedure glTexCoord2d (s : GLdouble; t : GLdouble); procedure glTexCoord2f (s : GLfloat; t : GLfloat); procedure glTexCoord2i (s : GLint; t : GLint); procedure glTexCoord2s (s : GLshort; t : GLshort); procedure glTexCoord3d (s : GLdouble; t : GLdouble; r : GLdouble); procedure glTexCoord3f (s : GLfloat; t : GLfloat; r : GLfloat); procedure glTexCoord3i (s : GLint; t : GLint; r : GLint); procedure glTexCoord3s (s : GLshort; t : GLshort; r : GLshort); procedure glTexCoord4d (s : GLdouble; t : GLdouble; r : GLdouble; q : GLdouble); procedure glTexCoord4f (s : GLfloat; t : GLfloat; r : GLfloat; q : GLfloat); procedure glTexCoord4i (s : GLint; t : GLint; r : GLint; q : GLint); procedure glTexCoord4s (s : GLshort; t : GLshort; r : GLshort; q : GLshort); procedure glTexCoord1dv (v : access GLdouble); procedure glTexCoord1fv (v : access GLfloat); procedure glTexCoord1iv (v : access GLint); procedure glTexCoord1sv (v : access GLshort); procedure glTexCoord2dv (v : access GLdouble); procedure glTexCoord2fv (v : access GLfloat); procedure glTexCoord2iv (v : access GLint); procedure glTexCoord2sv (v : access GLshort); procedure glTexCoord3dv (v : access GLdouble); procedure glTexCoord3fv (v : access GLfloat); procedure glTexCoord3iv (v : access GLint); procedure glTexCoord3sv (v : access GLshort); procedure glTexCoord4dv (v : access GLdouble); procedure glTexCoord4fv (v : access GLfloat); procedure glTexCoord4iv (v : access GLint); procedure glTexCoord4sv (v : access GLshort); procedure glRasterPos2d (x : GLdouble; y : GLdouble); procedure glRasterPos2f (x : GLfloat; y : GLfloat); procedure glRasterPos2i (x : GLint; y : GLint); procedure glRasterPos2s (x : GLshort; y : GLshort); procedure glRasterPos3d (x : GLdouble; y : GLdouble; z : GLdouble); procedure glRasterPos3f (x : GLfloat; y : GLfloat; z : GLfloat); procedure glRasterPos3i (x : GLint; y : GLint; z : GLint); procedure glRasterPos3s (x : GLshort; y : GLshort; z : GLshort); procedure glRasterPos4d (x : GLdouble; y : GLdouble; z : GLdouble; w : GLdouble); procedure glRasterPos4f (x : GLfloat; y : GLfloat; z : GLfloat; w : GLfloat); procedure glRasterPos4i (x : GLint; y : GLint; z : GLint; w : GLint); procedure glRasterPos4s (x : GLshort; y : GLshort; z : GLshort; w : GLshort); procedure glRasterPos2dv (v : access GLdouble); procedure glRasterPos2fv (v : access GLfloat); procedure glRasterPos2iv (v : access GLint); procedure glRasterPos2sv (v : access GLshort); procedure glRasterPos3dv (v : access GLdouble); procedure glRasterPos3fv (v : access GLfloat); procedure glRasterPos3iv (v : access GLint); procedure glRasterPos3sv (v : access GLshort); procedure glRasterPos4dv (v : access GLdouble); procedure glRasterPos4fv (v : access GLfloat); procedure glRasterPos4iv (v : access GLint); procedure glRasterPos4sv (v : access GLshort); procedure glRectd (x1 : GLdouble; y1 : GLdouble; x2 : GLdouble; y2 : GLdouble); procedure glRectf (x1 : GLfloat; y1 : GLfloat; x2 : GLfloat; y2 : GLfloat); procedure glRecti (x1 : GLint; y1 : GLint; x2 : GLint; y2 : GLint); procedure glRects (x1 : GLshort; y1 : GLshort; x2 : GLshort; y2 : GLshort); procedure glRectdv (v1 : access GLdouble; v2 : access GLdouble); procedure glRectfv (v1 : access GLfloat; v2 : access GLfloat); procedure glRectiv (v1 : access GLint; v2 : access GLint); procedure glRectsv (v1 : access GLshort; v2 : access GLshort); procedure glShadeModel (mode : GLenum); procedure glLightf (light : GLenum; pname : GLenum; param : GLfloat); procedure glLighti (light : GLenum; pname : GLenum; param : GLint); procedure glLightfv (light : GLenum; pname : GLenum; params : access GLfloat); procedure glLightiv (light : GLenum; pname : GLenum; params : access GLint); procedure glGetLightfv (light : GLenum; pname : GLenum; params : access GLfloat); procedure glGetLightiv (light : GLenum; pname : GLenum; params : access GLint); procedure glLightModelf (pname : GLenum; param : GLfloat); procedure glLightModeli (pname : GLenum; param : GLint); procedure glLightModelfv (pname : GLenum; params : access GLfloat); procedure glLightModeliv (pname : GLenum; params : access GLint); procedure glMaterialf (face : GLenum; pname : GLenum; param : GLfloat); procedure glMateriali (face : GLenum; pname : GLenum; param : GLint); procedure glMaterialfv (face : GLenum; pname : GLenum; params : access GLfloat); procedure glMaterialiv (face : GLenum; pname : GLenum; params : access GLint); procedure glGetMaterialfv (face : GLenum; pname : GLenum; params : access GLfloat); procedure glGetMaterialiv (face : GLenum; pname : GLenum; params : access GLint); procedure glColorMaterial (face : GLenum; mode : GLenum); procedure glPixelZoom (xfactor : GLfloat; yfactor : GLfloat); procedure glPixelStoref (pname : GLenum; param : GLfloat); procedure glPixelStorei (pname : GLenum; param : GLint); procedure glPixelTransferf (pname : GLenum; param : GLfloat); procedure glPixelTransferi (pname : GLenum; param : GLint); procedure glPixelMapfv (map : GLenum; mapsize : GLint; values : access GLfloat); procedure glPixelMapuiv (map : GLenum; mapsize : GLint; values : access GLuint); procedure glPixelMapusv (map : GLenum; mapsize : GLint; values : access GLushort); procedure glGetPixelMapfv (map : GLenum; values : access GLfloat); procedure glGetPixelMapuiv (map : GLenum; values : access GLuint); procedure glGetPixelMapusv (map : GLenum; values : access GLushort); procedure glBitmap (width : GLsizei; height : GLsizei; xorig : GLfloat; yorig : GLfloat; xmove : GLfloat; ymove : GLfloat; bitmap : access GLubyte); procedure glReadPixels (x : GLint; y : GLint; width : GLsizei; height : GLsizei; format : GLenum; c_type : GLenum; pixels : GLvoid_Ptr); procedure glDrawPixels (width : GLsizei; height : GLsizei; format : GLenum; c_type : GLenum; pixels : GLvoid_Ptr); procedure glCopyPixels (x : GLint; y : GLint; width : GLsizei; height : GLsizei; c_type : GLenum); procedure glStencilFunc (func : GLenum; ref : GLint; mask : GLuint); procedure glStencilMask (mask : GLuint); procedure glStencilOp (fail : GLenum; zfail : GLenum; zpass : GLenum); procedure glClearStencil (s : GLint); procedure glTexGend (coord : GLenum; pname : GLenum; param : GLdouble); procedure glTexGenf (coord : GLenum; pname : GLenum; param : GLfloat); procedure glTexGeni (coord : GLenum; pname : GLenum; param : GLint); procedure glTexGendv (coord : GLenum; pname : GLenum; params : access GLdouble); procedure glTexGenfv (coord : GLenum; pname : GLenum; params : access GLfloat); procedure glTexGeniv (coord : GLenum; pname : GLenum; params : access GLint); procedure glGetTexGendv (coord : GLenum; pname : GLenum; params : access GLdouble); procedure glGetTexGenfv (coord : GLenum; pname : GLenum; params : access GLfloat); procedure glGetTexGeniv (coord : GLenum; pname : GLenum; params : access GLint); procedure glTexEnvf (target : GLenum; pname : GLenum; param : GLfloat); procedure glTexEnvi (target : GLenum; pname : GLenum; param : GLint); procedure glTexEnvfv (target : GLenum; pname : GLenum; params : access GLfloat); procedure glTexEnviv (target : GLenum; pname : GLenum; params : access GLint); procedure glGetTexEnvfv (target : GLenum; pname : GLenum; params : access GLfloat); procedure glGetTexEnviv (target : GLenum; pname : GLenum; params : access GLint); procedure glTexParameterf (target : GLenum; pname : GLenum; param : GLfloat); procedure glTexParameteri (target : GLenum; pname : GLenum; param : GLint); procedure glTexParameterfv (target : GLenum; pname : GLenum; params : access GLfloat); procedure glTexParameteriv (target : GLenum; pname : GLenum; params : access GLint); procedure glGetTexParameterfv (target : GLenum; pname : GLenum; params : access GLfloat); procedure glGetTexParameteriv (target : GLenum; pname : GLenum; params : access GLint); procedure glGetTexLevelParameterfv (target : GLenum; level : GLint; pname : GLenum; params : access GLfloat); procedure glGetTexLevelParameteriv (target : GLenum; level : GLint; pname : GLenum; params : access GLint); procedure glTexImage1D (target : GLenum; level : GLint; internalFormat : GLint; width : GLsizei; border : GLint; format : GLenum; c_type : GLenum; pixels : GLvoid_Ptr); procedure glTexImage2D (target : GLenum; level : GLint; internalFormat : GLint; width : GLsizei; height : GLsizei; border : GLint; format : GLenum; c_type : GLenum; pixels : GLvoid_Ptr); procedure glGetTexImage (target : GLenum; level : GLint; format : GLenum; c_type : GLenum; pixels : GLvoid_Ptr); procedure glMap1d (target : GLenum; u1 : GLdouble; u2 : GLdouble; stride : GLint; order : GLint; points : access GLdouble); procedure glMap1f (target : GLenum; u1 : GLfloat; u2 : GLfloat; stride : GLint; order : GLint; points : access GLfloat); procedure glMap2d (target : GLenum; u1 : GLdouble; u2 : GLdouble; ustride : GLint; uorder : GLint; v1 : GLdouble; v2 : GLdouble; vstride : GLint; vorder : GLint; points : access GLdouble); procedure glMap2f (target : GLenum; u1 : GLfloat; u2 : GLfloat; ustride : GLint; uorder : GLint; v1 : GLfloat; v2 : GLfloat; vstride : GLint; vorder : GLint; points : access GLfloat); procedure glGetMapdv (target : GLenum; query : GLenum; v : access GLdouble); procedure glGetMapfv (target : GLenum; query : GLenum; v : access GLfloat); procedure glGetMapiv (target : GLenum; query : GLenum; v : access GLint); procedure glEvalCoord1d (u : GLdouble); procedure glEvalCoord1f (u : GLfloat); procedure glEvalCoord1dv (u : access GLdouble); procedure glEvalCoord1fv (u : access GLfloat); procedure glEvalCoord2d (u : GLdouble; v : GLdouble); procedure glEvalCoord2f (u : GLfloat; v : GLfloat); procedure glEvalCoord2dv (u : access GLdouble); procedure glEvalCoord2fv (u : access GLfloat); procedure glMapGrid1d (un : GLint; u1 : GLdouble; u2 : GLdouble); procedure glMapGrid1f (un : GLint; u1 : GLfloat; u2 : GLfloat); procedure glMapGrid2d (un : GLint; u1 : GLdouble; u2 : GLdouble; vn : GLint; v1 : GLdouble; v2 : GLdouble); procedure glMapGrid2f (un : GLint; u1 : GLfloat; u2 : GLfloat; vn : GLint; v1 : GLfloat; v2 : GLfloat); procedure glEvalPoint1 (i : GLint); procedure glEvalPoint2 (i : GLint; j : GLint); procedure glEvalMesh1 (mode : GLenum; i1 : GLint; i2 : GLint); procedure glEvalMesh2 (mode : GLenum; i1 : GLint; i2 : GLint; j1 : GLint; j2 : GLint); procedure glFogf (pname : GLenum; param : GLfloat); procedure glFogi (pname : GLenum; param : GLint); procedure glFogfv (pname : GLenum; params : access GLfloat); procedure glFogiv (pname : GLenum; params : access GLint); procedure glFeedbackBuffer (size : GLsizei; c_type : GLenum; buffer : access GLfloat); procedure glPassThrough (token : GLfloat); procedure glSelectBuffer (size : GLsizei; buffer : access GLuint); procedure glInitNames; procedure glLoadName (name : GLuint); procedure glPushName (name : GLuint); procedure glPopName; procedure glGenTextures (n : GLsizei; textures : access GLuint); procedure glDeleteTextures (n : GLsizei; textures : access GLuint); procedure glBindTexture (target : GLenum; texture : GLuint); procedure glPrioritizeTextures (n : GLsizei; textures : access GLuint; priorities : access GLclampf); function glAreTexturesResident (n : GLsizei; textures : access GLuint; residences : access GLboolean) return GLboolean; function glIsTexture (texture : GLuint) return GLboolean; procedure glTexSubImage1D (target : GLenum; level : GLint; xoffset : GLint; width : GLsizei; format : GLenum; c_type : GLenum; pixels : GLvoid_Ptr); procedure glTexSubImage2D (target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; width : GLsizei; height : GLsizei; format : GLenum; c_type : GLenum; pixels : GLvoid_Ptr); procedure glCopyTexImage1D (target : GLenum; level : GLint; internalformat : GLenum; x : GLint; y : GLint; width : GLsizei; border : GLint); procedure glCopyTexImage2D (target : GLenum; level : GLint; internalformat : GLenum; x : GLint; y : GLint; width : GLsizei; height : GLsizei; border : GLint); procedure glCopyTexSubImage1D (target : GLenum; level : GLint; xoffset : GLint; x : GLint; y : GLint; width : GLsizei); procedure glCopyTexSubImage2D (target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; x : GLint; y : GLint; width : GLsizei; height : GLsizei); procedure glVertexPointer (size : GLint; c_type : GLenum; stride : GLsizei; ptr : GLvoid_Ptr); procedure glNormalPointer (c_type : GLenum; stride : GLsizei; ptr : GLvoid_Ptr); procedure glColorPointer (size : GLint; c_type : GLenum; stride : GLsizei; ptr : GLvoid_Ptr); procedure glIndexPointer (c_type : GLenum; stride : GLsizei; ptr : GLvoid_Ptr); procedure glTexCoordPointer (size : GLint; c_type : GLenum; stride : GLsizei; ptr : GLvoid_Ptr); procedure glEdgeFlagPointer (stride : GLsizei; ptr : GLvoid_Ptr); procedure glGetPointerv (pname : GLenum; params : GLvoid_Ptr); procedure glArrayElement (i : GLint); procedure glDrawArrays (mode : GLenum; first : GLint; count : GLsizei); procedure glDrawElements (mode : GLenum; count : GLsizei; c_type : GLenum; indices : GLvoid_Ptr); procedure glInterleavedArrays (format : GLenum; stride : GLsizei; pointer : GLvoid_Ptr); procedure glDrawRangeElements (mode : GLenum; start : GLuint; c_end : GLuint; count : GLsizei; c_type : GLenum; indices : GLvoid_Ptr); procedure glTexImage3D (target : GLenum; level : GLint; internalFormat : GLenum; width : GLsizei; height : GLsizei; depth : GLsizei; border : GLint; format : GLenum; c_type : GLenum; pixels : GLvoid_Ptr); procedure glTexSubImage3D (target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; zoffset : GLint; width : GLsizei; height : GLsizei; depth : GLsizei; format : GLenum; c_type : GLenum; pixels : GLvoid_Ptr); procedure glCopyTexSubImage3D (target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; zoffset : GLint; x : GLint; y : GLint; width : GLsizei; height : GLsizei); procedure glColorTable (target : GLenum; internalformat : GLenum; width : GLsizei; format : GLenum; c_type : GLenum; table : GLvoid_Ptr); procedure glColorSubTable (target : GLenum; start : GLsizei; count : GLsizei; format : GLenum; c_type : GLenum; data : GLvoid_Ptr); procedure glColorTableParameteriv (target : GLenum; pname : GLenum; params : access GLint); procedure glColorTableParameterfv (target : GLenum; pname : GLenum; params : access GLfloat); procedure glCopyColorSubTable (target : GLenum; start : GLsizei; x : GLint; y : GLint; width : GLsizei); procedure glCopyColorTable (target : GLenum; internalformat : GLenum; x : GLint; y : GLint; width : GLsizei); procedure glGetColorTable (target : GLenum; format : GLenum; c_type : GLenum; table : GLvoid_Ptr); procedure glGetColorTableParameterfv (target : GLenum; pname : GLenum; params : access GLfloat); procedure glGetColorTableParameteriv (target : GLenum; pname : GLenum; params : access GLint); procedure glBlendEquation (mode : GLenum); procedure glBlendColor (red : GLclampf; green : GLclampf; blue : GLclampf; alpha : GLclampf); procedure glHistogram (target : GLenum; width : GLsizei; internalformat : GLenum; sink : GLboolean); procedure glResetHistogram (target : GLenum); procedure glGetHistogram (target : GLenum; reset : GLboolean; format : GLenum; c_type : GLenum; values : GLvoid_Ptr); procedure glGetHistogramParameterfv (target : GLenum; pname : GLenum; params : access GLfloat); procedure glGetHistogramParameteriv (target : GLenum; pname : GLenum; params : access GLint); procedure glMinmax (target : GLenum; internalformat : GLenum; sink : GLboolean); procedure glResetMinmax (target : GLenum); procedure glGetMinmax (target : GLenum; reset : GLboolean; format : GLenum; types : GLenum; values : GLvoid_Ptr); procedure glGetMinmaxParameterfv (target : GLenum; pname : GLenum; params : access GLfloat); procedure glGetMinmaxParameteriv (target : GLenum; pname : GLenum; params : access GLint); procedure glConvolutionFilter1D (target : GLenum; internalformat : GLenum; width : GLsizei; format : GLenum; c_type : GLenum; image : GLvoid_Ptr); procedure glConvolutionFilter2D (target : GLenum; internalformat : GLenum; width : GLsizei; height : GLsizei; format : GLenum; c_type : GLenum; image : GLvoid_Ptr); procedure glConvolutionParameterf (target : GLenum; pname : GLenum; params : GLfloat); procedure glConvolutionParameterfv (target : GLenum; pname : GLenum; params : access GLfloat); procedure glConvolutionParameteri (target : GLenum; pname : GLenum; params : GLint); procedure glConvolutionParameteriv (target : GLenum; pname : GLenum; params : access GLint); procedure glCopyConvolutionFilter1D (target : GLenum; internalformat : GLenum; x : GLint; y : GLint; width : GLsizei); procedure glCopyConvolutionFilter2D (target : GLenum; internalformat : GLenum; x : GLint; y : GLint; width : GLsizei; height : GLsizei); procedure glGetConvolutionFilter (target : GLenum; format : GLenum; c_type : GLenum; image : GLvoid_Ptr); procedure glGetConvolutionParameterfv (target : GLenum; pname : GLenum; params : access GLfloat); procedure glGetConvolutionParameteriv (target : GLenum; pname : GLenum; params : access GLint); procedure glSeparableFilter2D (target : GLenum; internalformat : GLenum; width : GLsizei; height : GLsizei; format : GLenum; c_type : GLenum; row : GLvoid_Ptr; column : GLvoid_Ptr); procedure glGetSeparableFilter (target : GLenum; format : GLenum; c_type : GLenum; row : GLvoid_Ptr; column : GLvoid_Ptr; span : GLvoid_Ptr); procedure glActiveTexture (texture : GLenum); procedure glClientActiveTexture (texture : GLenum); procedure glCompressedTexImage1D (target : GLenum; level : GLint; internalformat : GLenum; width : GLsizei; border : GLint; imageSize : GLsizei; data : GLvoid_Ptr); procedure glCompressedTexImage2D (target : GLenum; level : GLint; internalformat : GLenum; width : GLsizei; height : GLsizei; border : GLint; imageSize : GLsizei; data : GLvoid_Ptr); procedure glCompressedTexImage3D (target : GLenum; level : GLint; internalformat : GLenum; width : GLsizei; height : GLsizei; depth : GLsizei; border : GLint; imageSize : GLsizei; data : GLvoid_Ptr); procedure glCompressedTexSubImage1D (target : GLenum; level : GLint; xoffset : GLint; width : GLsizei; format : GLenum; imageSize : GLsizei; data : GLvoid_Ptr); procedure glCompressedTexSubImage2D (target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; width : GLsizei; height : GLsizei; format : GLenum; imageSize : GLsizei; data : GLvoid_Ptr); procedure glCompressedTexSubImage3D (target : GLenum; level : GLint; xoffset : GLint; yoffset : GLint; zoffset : GLint; width : GLsizei; height : GLsizei; depth : GLsizei; format : GLenum; imageSize : GLsizei; data : GLvoid_Ptr); procedure glGetCompressedTexImage (target : GLenum; lod : GLint; img : GLvoid_Ptr); procedure glMultiTexCoord1d (target : GLenum; s : GLdouble); procedure glMultiTexCoord1dv (target : GLenum; v : access GLdouble); procedure glMultiTexCoord1f (target : GLenum; s : GLfloat); procedure glMultiTexCoord1fv (target : GLenum; v : access GLfloat); procedure glMultiTexCoord1i (target : GLenum; s : GLint); procedure glMultiTexCoord1iv (target : GLenum; v : access GLint); procedure glMultiTexCoord1s (target : GLenum; s : GLshort); procedure glMultiTexCoord1sv (target : GLenum; v : access GLshort); procedure glMultiTexCoord2d (target : GLenum; s : GLdouble; t : GLdouble); procedure glMultiTexCoord2dv (target : GLenum; v : access GLdouble); procedure glMultiTexCoord2f (target : GLenum; s : GLfloat; t : GLfloat); procedure glMultiTexCoord2fv (target : GLenum; v : access GLfloat); procedure glMultiTexCoord2i (target : GLenum; s : GLint; t : GLint); procedure glMultiTexCoord2iv (target : GLenum; v : access GLint); procedure glMultiTexCoord2s (target : GLenum; s : GLshort; t : GLshort); procedure glMultiTexCoord2sv (target : GLenum; v : access GLshort); procedure glMultiTexCoord3d (target : GLenum; s : GLdouble; t : GLdouble; r : GLdouble); procedure glMultiTexCoord3dv (target : GLenum; v : access GLdouble); procedure glMultiTexCoord3f (target : GLenum; s : GLfloat; t : GLfloat; r : GLfloat); procedure glMultiTexCoord3fv (target : GLenum; v : access GLfloat); procedure glMultiTexCoord3i (target : GLenum; s : GLint; t : GLint; r : GLint); procedure glMultiTexCoord3iv (target : GLenum; v : access GLint); procedure glMultiTexCoord3s (target : GLenum; s : GLshort; t : GLshort; r : GLshort); procedure glMultiTexCoord3sv (target : GLenum; v : access GLshort); procedure glMultiTexCoord4d (target : GLenum; s : GLdouble; t : GLdouble; r : GLdouble; q : GLdouble); procedure glMultiTexCoord4dv (target : GLenum; v : access GLdouble); procedure glMultiTexCoord4f (target : GLenum; s : GLfloat; t : GLfloat; r : GLfloat; q : GLfloat); procedure glMultiTexCoord4fv (target : GLenum; v : access GLfloat); procedure glMultiTexCoord4i (target : GLenum; s : GLint; t : GLint; r : GLint; q : GLint); procedure glMultiTexCoord4iv (target : GLenum; v : access GLint); procedure glMultiTexCoord4s (target : GLenum; s : GLshort; t : GLshort; r : GLshort; q : GLshort); procedure glMultiTexCoord4sv (target : GLenum; v : access GLshort); procedure glLoadTransposeMatrixd (m : access GLdouble); procedure glLoadTransposeMatrixf (m : access GLfloat); procedure glMultTransposeMatrixd (m : access GLdouble); procedure glMultTransposeMatrixf (m : access GLfloat); procedure glSampleCoverage (value : GLclampf; invert : GLboolean); procedure glSamplePass (pass : GLenum); private pragma Import (Stdcall, glClearIndex, "glClearIndex"); pragma Import (Stdcall, glClearColor, "glClearColor"); pragma Import (Stdcall, glClear, "glClear"); pragma Import (Stdcall, glIndexMask, "glIndexMask"); pragma Import (Stdcall, glColorMask, "glColorMask"); pragma Import (Stdcall, glAlphaFunc, "glAlphaFunc"); pragma Import (Stdcall, glBlendFunc, "glBlendFunc"); pragma Import (Stdcall, glLogicOp, "glLogicOp"); pragma Import (Stdcall, glCullFace, "glCullFace"); pragma Import (Stdcall, glFrontFace, "glFrontFace"); pragma Import (Stdcall, glPointSize, "glPointSize"); pragma Import (Stdcall, glLineWidth, "glLineWidth"); pragma Import (Stdcall, glLineStipple, "glLineStipple"); pragma Import (Stdcall, glPolygonMode, "glPolygonMode"); pragma Import (Stdcall, glPolygonOffset, "glPolygonOffset"); pragma Import (Stdcall, glPolygonStipple, "glPolygonStipple"); pragma Import (Stdcall, glGetPolygonStipple, "glGetPolygonStipple"); pragma Import (Stdcall, glEdgeFlag, "glEdgeFlag"); pragma Import (Stdcall, glEdgeFlagv, "glEdgeFlagv"); pragma Import (Stdcall, glScissor, "glScissor"); pragma Import (Stdcall, glClipPlane, "glClipPlane"); pragma Import (Stdcall, glGetClipPlane, "glGetClipPlane"); pragma Import (Stdcall, glDrawBuffer, "glDrawBuffer"); pragma Import (Stdcall, glReadBuffer, "glReadBuffer"); pragma Import (Stdcall, glEnable, "glEnable"); pragma Import (Stdcall, glDisable, "glDisable"); pragma Import (Stdcall, glIsEnabled, "glIsEnabled"); pragma Import (Stdcall, glEnableClientState, "glEnableClientState"); pragma Import (Stdcall, glDisableClientState, "glDisableClientState"); pragma Import (Stdcall, glGetBooleanv, "glGetBooleanv"); pragma Import (Stdcall, glGetDoublev, "glGetDoublev"); pragma Import (Stdcall, glGetFloatv, "glGetFloatv"); pragma Import (Stdcall, glGetIntegerv, "glGetIntegerv"); pragma Import (Stdcall, glPushAttrib, "glPushAttrib"); pragma Import (Stdcall, glPopAttrib, "glPopAttrib"); pragma Import (Stdcall, glPushClientAttrib, "glPushClientAttrib"); pragma Import (Stdcall, glPopClientAttrib, "glPopClientAttrib"); pragma Import (Stdcall, glRenderMode, "glRenderMode"); pragma Import (Stdcall, glGetError, "glGetError"); pragma Import (Stdcall, glGetString, "glGetString"); pragma Import (Stdcall, glFinish, "glFinish"); pragma Import (Stdcall, glFlush, "glFlush"); pragma Import (Stdcall, glHint, "glHint"); pragma Import (Stdcall, glClearDepth, "glClearDepth"); pragma Import (Stdcall, glDepthFunc, "glDepthFunc"); pragma Import (Stdcall, glDepthMask, "glDepthMask"); pragma Import (Stdcall, glDepthRange, "glDepthRange"); pragma Import (Stdcall, glClearAccum, "glClearAccum"); pragma Import (Stdcall, glAccum, "glAccum"); pragma Import (Stdcall, glMatrixMode, "glMatrixMode"); pragma Import (Stdcall, glOrtho, "glOrtho"); pragma Import (Stdcall, glFrustum, "glFrustum"); pragma Import (Stdcall, glViewport, "glViewport"); pragma Import (Stdcall, glPushMatrix, "glPushMatrix"); pragma Import (Stdcall, glPopMatrix, "glPopMatrix"); pragma Import (Stdcall, glLoadIdentity, "glLoadIdentity"); pragma Import (Stdcall, glLoadMatrixd, "glLoadMatrixd"); pragma Import (Stdcall, glLoadMatrixf, "glLoadMatrixf"); pragma Import (Stdcall, glMultMatrixd, "glMultMatrixd"); pragma Import (Stdcall, glMultMatrixf, "glMultMatrixf"); pragma Import (Stdcall, glRotated, "glRotated"); pragma Import (Stdcall, glRotatef, "glRotatef"); pragma Import (Stdcall, glScaled, "glScaled"); pragma Import (Stdcall, glScalef, "glScalef"); pragma Import (Stdcall, glTranslated, "glTranslated"); pragma Import (Stdcall, glTranslatef, "glTranslatef"); pragma Import (Stdcall, glIsList, "glIsList"); pragma Import (Stdcall, glDeleteLists, "glDeleteLists"); pragma Import (Stdcall, glGenLists, "glGenLists"); pragma Import (Stdcall, glNewList, "glNewList"); pragma Import (Stdcall, glEndList, "glEndList"); pragma Import (Stdcall, glCallList, "glCallList"); pragma Import (Stdcall, glCallLists, "glCallLists"); pragma Import (Stdcall, glListBase, "glListBase"); pragma Import (Stdcall, glBegin, "glBegin"); pragma Import (Stdcall, glEnd, "glEnd"); pragma Import (Stdcall, glVertex2d, "glVertex2d"); pragma Import (Stdcall, glVertex2f, "glVertex2f"); pragma Import (Stdcall, glVertex2i, "glVertex2i"); pragma Import (Stdcall, glVertex2s, "glVertex2s"); pragma Import (Stdcall, glVertex3d, "glVertex3d"); pragma Import (Stdcall, glVertex3f, "glVertex3f"); pragma Import (Stdcall, glVertex3i, "glVertex3i"); pragma Import (Stdcall, glVertex3s, "glVertex3s"); pragma Import (Stdcall, glVertex4d, "glVertex4d"); pragma Import (Stdcall, glVertex4f, "glVertex4f"); pragma Import (Stdcall, glVertex4i, "glVertex4i"); pragma Import (Stdcall, glVertex4s, "glVertex4s"); pragma Import (Stdcall, glVertex2dv, "glVertex2dv"); pragma Import (Stdcall, glVertex2fv, "glVertex2fv"); pragma Import (Stdcall, glVertex2iv, "glVertex2iv"); pragma Import (Stdcall, glVertex2sv, "glVertex2sv"); pragma Import (Stdcall, glVertex3dv, "glVertex3dv"); pragma Import (Stdcall, glVertex3fv, "glVertex3fv"); pragma Import (Stdcall, glVertex3iv, "glVertex3iv"); pragma Import (Stdcall, glVertex3sv, "glVertex3sv"); pragma Import (Stdcall, glVertex4dv, "glVertex4dv"); pragma Import (Stdcall, glVertex4fv, "glVertex4fv"); pragma Import (Stdcall, glVertex4iv, "glVertex4iv"); pragma Import (Stdcall, glVertex4sv, "glVertex4sv"); pragma Import (Stdcall, glNormal3b, "glNormal3b"); pragma Import (Stdcall, glNormal3d, "glNormal3d"); pragma Import (Stdcall, glNormal3f, "glNormal3f"); pragma Import (Stdcall, glNormal3i, "glNormal3i"); pragma Import (Stdcall, glNormal3s, "glNormal3s"); pragma Import (Stdcall, glNormal3bv, "glNormal3bv"); pragma Import (Stdcall, glNormal3dv, "glNormal3dv"); pragma Import (Stdcall, glNormal3fv, "glNormal3fv"); pragma Import (Stdcall, glNormal3iv, "glNormal3iv"); pragma Import (Stdcall, glNormal3sv, "glNormal3sv"); pragma Import (Stdcall, glIndexd, "glIndexd"); pragma Import (Stdcall, glIndexf, "glIndexf"); pragma Import (Stdcall, glIndexi, "glIndexi"); pragma Import (Stdcall, glIndexs, "glIndexs"); pragma Import (Stdcall, glIndexub, "glIndexub"); pragma Import (Stdcall, glIndexdv, "glIndexdv"); pragma Import (Stdcall, glIndexfv, "glIndexfv"); pragma Import (Stdcall, glIndexiv, "glIndexiv"); pragma Import (Stdcall, glIndexsv, "glIndexsv"); pragma Import (Stdcall, glIndexubv, "glIndexubv"); pragma Import (Stdcall, glColor3b, "glColor3b"); pragma Import (Stdcall, glColor3d, "glColor3d"); pragma Import (Stdcall, glColor3f, "glColor3f"); pragma Import (Stdcall, glColor3i, "glColor3i"); pragma Import (Stdcall, glColor3s, "glColor3s"); pragma Import (Stdcall, glColor3ub, "glColor3ub"); pragma Import (Stdcall, glColor3ui, "glColor3ui"); pragma Import (Stdcall, glColor3us, "glColor3us"); pragma Import (Stdcall, glColor4b, "glColor4b"); pragma Import (Stdcall, glColor4d, "glColor4d"); pragma Import (Stdcall, glColor4f, "glColor4f"); pragma Import (Stdcall, glColor4i, "glColor4i"); pragma Import (Stdcall, glColor4s, "glColor4s"); pragma Import (Stdcall, glColor4ub, "glColor4ub"); pragma Import (Stdcall, glColor4ui, "glColor4ui"); pragma Import (Stdcall, glColor4us, "glColor4us"); pragma Import (Stdcall, glColor3bv, "glColor3bv"); pragma Import (Stdcall, glColor3dv, "glColor3dv"); pragma Import (Stdcall, glColor3fv, "glColor3fv"); pragma Import (Stdcall, glColor3iv, "glColor3iv"); pragma Import (Stdcall, glColor3sv, "glColor3sv"); pragma Import (Stdcall, glColor3ubv, "glColor3ubv"); pragma Import (Stdcall, glColor3uiv, "glColor3uiv"); pragma Import (Stdcall, glColor3usv, "glColor3usv"); pragma Import (Stdcall, glColor4bv, "glColor4bv"); pragma Import (Stdcall, glColor4dv, "glColor4dv"); pragma Import (Stdcall, glColor4fv, "glColor4fv"); pragma Import (Stdcall, glColor4iv, "glColor4iv"); pragma Import (Stdcall, glColor4sv, "glColor4sv"); pragma Import (Stdcall, glColor4ubv, "glColor4ubv"); pragma Import (Stdcall, glColor4uiv, "glColor4uiv"); pragma Import (Stdcall, glColor4usv, "glColor4usv"); pragma Import (Stdcall, glTexCoord1d, "glTexCoord1d"); pragma Import (Stdcall, glTexCoord1f, "glTexCoord1f"); pragma Import (Stdcall, glTexCoord1i, "glTexCoord1i"); pragma Import (Stdcall, glTexCoord1s, "glTexCoord1s"); pragma Import (Stdcall, glTexCoord2d, "glTexCoord2d"); pragma Import (Stdcall, glTexCoord2f, "glTexCoord2f"); pragma Import (Stdcall, glTexCoord2i, "glTexCoord2i"); pragma Import (Stdcall, glTexCoord2s, "glTexCoord2s"); pragma Import (Stdcall, glTexCoord3d, "glTexCoord3d"); pragma Import (Stdcall, glTexCoord3f, "glTexCoord3f"); pragma Import (Stdcall, glTexCoord3i, "glTexCoord3i"); pragma Import (Stdcall, glTexCoord3s, "glTexCoord3s"); pragma Import (Stdcall, glTexCoord4d, "glTexCoord4d"); pragma Import (Stdcall, glTexCoord4f, "glTexCoord4f"); pragma Import (Stdcall, glTexCoord4i, "glTexCoord4i"); pragma Import (Stdcall, glTexCoord4s, "glTexCoord4s"); pragma Import (Stdcall, glTexCoord1dv, "glTexCoord1dv"); pragma Import (Stdcall, glTexCoord1fv, "glTexCoord1fv"); pragma Import (Stdcall, glTexCoord1iv, "glTexCoord1iv"); pragma Import (Stdcall, glTexCoord1sv, "glTexCoord1sv"); pragma Import (Stdcall, glTexCoord2dv, "glTexCoord2dv"); pragma Import (Stdcall, glTexCoord2fv, "glTexCoord2fv"); pragma Import (Stdcall, glTexCoord2iv, "glTexCoord2iv"); pragma Import (Stdcall, glTexCoord2sv, "glTexCoord2sv"); pragma Import (Stdcall, glTexCoord3dv, "glTexCoord3dv"); pragma Import (Stdcall, glTexCoord3fv, "glTexCoord3fv"); pragma Import (Stdcall, glTexCoord3iv, "glTexCoord3iv"); pragma Import (Stdcall, glTexCoord3sv, "glTexCoord3sv"); pragma Import (Stdcall, glTexCoord4dv, "glTexCoord4dv"); pragma Import (Stdcall, glTexCoord4fv, "glTexCoord4fv"); pragma Import (Stdcall, glTexCoord4iv, "glTexCoord4iv"); pragma Import (Stdcall, glTexCoord4sv, "glTexCoord4sv"); pragma Import (Stdcall, glRasterPos2d, "glRasterPos2d"); pragma Import (Stdcall, glRasterPos2f, "glRasterPos2f"); pragma Import (Stdcall, glRasterPos2i, "glRasterPos2i"); pragma Import (Stdcall, glRasterPos2s, "glRasterPos2s"); pragma Import (Stdcall, glRasterPos3d, "glRasterPos3d"); pragma Import (Stdcall, glRasterPos3f, "glRasterPos3f"); pragma Import (Stdcall, glRasterPos3i, "glRasterPos3i"); pragma Import (Stdcall, glRasterPos3s, "glRasterPos3s"); pragma Import (Stdcall, glRasterPos4d, "glRasterPos4d"); pragma Import (Stdcall, glRasterPos4f, "glRasterPos4f"); pragma Import (Stdcall, glRasterPos4i, "glRasterPos4i"); pragma Import (Stdcall, glRasterPos4s, "glRasterPos4s"); pragma Import (Stdcall, glRasterPos2dv, "glRasterPos2dv"); pragma Import (Stdcall, glRasterPos2fv, "glRasterPos2fv"); pragma Import (Stdcall, glRasterPos2iv, "glRasterPos2iv"); pragma Import (Stdcall, glRasterPos2sv, "glRasterPos2sv"); pragma Import (Stdcall, glRasterPos3dv, "glRasterPos3dv"); pragma Import (Stdcall, glRasterPos3fv, "glRasterPos3fv"); pragma Import (Stdcall, glRasterPos3iv, "glRasterPos3iv"); pragma Import (Stdcall, glRasterPos3sv, "glRasterPos3sv"); pragma Import (Stdcall, glRasterPos4dv, "glRasterPos4dv"); pragma Import (Stdcall, glRasterPos4fv, "glRasterPos4fv"); pragma Import (Stdcall, glRasterPos4iv, "glRasterPos4iv"); pragma Import (Stdcall, glRasterPos4sv, "glRasterPos4sv"); pragma Import (Stdcall, glRectd, "glRectd"); pragma Import (Stdcall, glRectf, "glRectf"); pragma Import (Stdcall, glRecti, "glRecti"); pragma Import (Stdcall, glRects, "glRects"); pragma Import (Stdcall, glRectdv, "glRectdv"); pragma Import (Stdcall, glRectfv, "glRectfv"); pragma Import (Stdcall, glRectiv, "glRectiv"); pragma Import (Stdcall, glRectsv, "glRectsv"); pragma Import (Stdcall, glShadeModel, "glShadeModel"); pragma Import (Stdcall, glLightf, "glLightf"); pragma Import (Stdcall, glLighti, "glLighti"); pragma Import (Stdcall, glLightfv, "glLightfv"); pragma Import (Stdcall, glLightiv, "glLightiv"); pragma Import (Stdcall, glGetLightfv, "glGetLightfv"); pragma Import (Stdcall, glGetLightiv, "glGetLightiv"); pragma Import (Stdcall, glLightModelf, "glLightModelf"); pragma Import (Stdcall, glLightModeli, "glLightModeli"); pragma Import (Stdcall, glLightModelfv, "glLightModelfv"); pragma Import (Stdcall, glLightModeliv, "glLightModeliv"); pragma Import (Stdcall, glMaterialf, "glMaterialf"); pragma Import (Stdcall, glMateriali, "glMateriali"); pragma Import (Stdcall, glMaterialfv, "glMaterialfv"); pragma Import (Stdcall, glMaterialiv, "glMaterialiv"); pragma Import (Stdcall, glGetMaterialfv, "glGetMaterialfv"); pragma Import (Stdcall, glGetMaterialiv, "glGetMaterialiv"); pragma Import (Stdcall, glColorMaterial, "glColorMaterial"); pragma Import (Stdcall, glPixelZoom, "glPixelZoom"); pragma Import (Stdcall, glPixelStoref, "glPixelStoref"); pragma Import (Stdcall, glPixelStorei, "glPixelStorei"); pragma Import (Stdcall, glPixelTransferf, "glPixelTransferf"); pragma Import (Stdcall, glPixelTransferi, "glPixelTransferi"); pragma Import (Stdcall, glPixelMapfv, "glPixelMapfv"); pragma Import (Stdcall, glPixelMapuiv, "glPixelMapuiv"); pragma Import (Stdcall, glPixelMapusv, "glPixelMapusv"); pragma Import (Stdcall, glGetPixelMapfv, "glGetPixelMapfv"); pragma Import (Stdcall, glGetPixelMapuiv, "glGetPixelMapuiv"); pragma Import (Stdcall, glGetPixelMapusv, "glGetPixelMapusv"); pragma Import (Stdcall, glBitmap, "glBitmap"); pragma Import (Stdcall, glReadPixels, "glReadPixels"); pragma Import (Stdcall, glDrawPixels, "glDrawPixels"); pragma Import (Stdcall, glCopyPixels, "glCopyPixels"); pragma Import (Stdcall, glStencilFunc, "glStencilFunc"); pragma Import (Stdcall, glStencilMask, "glStencilMask"); pragma Import (Stdcall, glStencilOp, "glStencilOp"); pragma Import (Stdcall, glClearStencil, "glClearStencil"); pragma Import (Stdcall, glTexGend, "glTexGend"); pragma Import (Stdcall, glTexGenf, "glTexGenf"); pragma Import (Stdcall, glTexGeni, "glTexGeni"); pragma Import (Stdcall, glTexGendv, "glTexGendv"); pragma Import (Stdcall, glTexGenfv, "glTexGenfv"); pragma Import (Stdcall, glTexGeniv, "glTexGeniv"); pragma Import (Stdcall, glGetTexGendv, "glGetTexGendv"); pragma Import (Stdcall, glGetTexGenfv, "glGetTexGenfv"); pragma Import (Stdcall, glGetTexGeniv, "glGetTexGeniv"); pragma Import (Stdcall, glTexEnvf, "glTexEnvf"); pragma Import (Stdcall, glTexEnvi, "glTexEnvi"); pragma Import (Stdcall, glTexEnvfv, "glTexEnvfv"); pragma Import (Stdcall, glTexEnviv, "glTexEnviv"); pragma Import (Stdcall, glGetTexEnvfv, "glGetTexEnvfv"); pragma Import (Stdcall, glGetTexEnviv, "glGetTexEnviv"); pragma Import (Stdcall, glTexParameterf, "glTexParameterf"); pragma Import (Stdcall, glTexParameteri, "glTexParameteri"); pragma Import (Stdcall, glTexParameterfv, "glTexParameterfv"); pragma Import (Stdcall, glTexParameteriv, "glTexParameteriv"); pragma Import (Stdcall, glGetTexParameterfv, "glGetTexParameterfv"); pragma Import (Stdcall, glGetTexParameteriv, "glGetTexParameteriv"); pragma Import (Stdcall, glGetTexLevelParameterfv, "glGetTexLevelParameterfv"); pragma Import (Stdcall, glGetTexLevelParameteriv, "glGetTexLevelParameteriv"); pragma Import (Stdcall, glTexImage1D, "glTexImage1D"); pragma Import (Stdcall, glTexImage2D, "glTexImage2D"); pragma Import (Stdcall, glGetTexImage, "glGetTexImage"); pragma Import (Stdcall, glMap1d, "glMap1d"); pragma Import (Stdcall, glMap1f, "glMap1f"); pragma Import (Stdcall, glMap2d, "glMap2d"); pragma Import (Stdcall, glMap2f, "glMap2f"); pragma Import (Stdcall, glGetMapdv, "glGetMapdv"); pragma Import (Stdcall, glGetMapfv, "glGetMapfv"); pragma Import (Stdcall, glGetMapiv, "glGetMapiv"); pragma Import (Stdcall, glEvalCoord1d, "glEvalCoord1d"); pragma Import (Stdcall, glEvalCoord1f, "glEvalCoord1f"); pragma Import (Stdcall, glEvalCoord1dv, "glEvalCoord1dv"); pragma Import (Stdcall, glEvalCoord1fv, "glEvalCoord1fv"); pragma Import (Stdcall, glEvalCoord2d, "glEvalCoord2d"); pragma Import (Stdcall, glEvalCoord2f, "glEvalCoord2f"); pragma Import (Stdcall, glEvalCoord2dv, "glEvalCoord2dv"); pragma Import (Stdcall, glEvalCoord2fv, "glEvalCoord2fv"); pragma Import (Stdcall, glMapGrid1d, "glMapGrid1d"); pragma Import (Stdcall, glMapGrid1f, "glMapGrid1f"); pragma Import (Stdcall, glMapGrid2d, "glMapGrid2d"); pragma Import (Stdcall, glMapGrid2f, "glMapGrid2f"); pragma Import (Stdcall, glEvalPoint1, "glEvalPoint1"); pragma Import (Stdcall, glEvalPoint2, "glEvalPoint2"); pragma Import (Stdcall, glEvalMesh1, "glEvalMesh1"); pragma Import (Stdcall, glEvalMesh2, "glEvalMesh2"); pragma Import (Stdcall, glFogf, "glFogf"); pragma Import (Stdcall, glFogi, "glFogi"); pragma Import (Stdcall, glFogfv, "glFogfv"); pragma Import (Stdcall, glFogiv, "glFogiv"); pragma Import (Stdcall, glFeedbackBuffer, "glFeedbackBuffer"); pragma Import (Stdcall, glPassThrough, "glPassThrough"); pragma Import (Stdcall, glSelectBuffer, "glSelectBuffer"); pragma Import (Stdcall, glInitNames, "glInitNames"); pragma Import (Stdcall, glLoadName, "glLoadName"); pragma Import (Stdcall, glPushName, "glPushName"); pragma Import (Stdcall, glPopName, "glPopName"); pragma Import (Stdcall, glGenTextures, "glGenTextures"); pragma Import (Stdcall, glDeleteTextures, "glDeleteTextures"); pragma Import (Stdcall, glBindTexture, "glBindTexture"); pragma Import (Stdcall, glPrioritizeTextures, "glPrioritizeTextures"); pragma Import (Stdcall, glAreTexturesResident, "glAreTexturesResident"); pragma Import (Stdcall, glIsTexture, "glIsTexture"); pragma Import (Stdcall, glTexSubImage1D, "glTexSubImage1D"); pragma Import (Stdcall, glTexSubImage2D, "glTexSubImage2D"); pragma Import (Stdcall, glCopyTexImage1D, "glCopyTexImage1D"); pragma Import (Stdcall, glCopyTexImage2D, "glCopyTexImage2D"); pragma Import (Stdcall, glCopyTexSubImage1D, "glCopyTexSubImage1D"); pragma Import (Stdcall, glCopyTexSubImage2D, "glCopyTexSubImage2D"); pragma Import (Stdcall, glVertexPointer, "glVertexPointer"); pragma Import (Stdcall, glNormalPointer, "glNormalPointer"); pragma Import (Stdcall, glColorPointer, "glColorPointer"); pragma Import (Stdcall, glIndexPointer, "glIndexPointer"); pragma Import (Stdcall, glTexCoordPointer, "glTexCoordPointer"); pragma Import (Stdcall, glEdgeFlagPointer, "glEdgeFlagPointer"); pragma Import (Stdcall, glGetPointerv, "glGetPointerv"); pragma Import (Stdcall, glArrayElement, "glArrayElement"); pragma Import (Stdcall, glDrawArrays, "glDrawArrays"); pragma Import (Stdcall, glDrawElements, "glDrawElements"); pragma Import (Stdcall, glInterleavedArrays, "glInterleavedArrays"); pragma Import (Stdcall, glDrawRangeElements, "glDrawRangeElements"); pragma Import (Stdcall, glTexImage3D, "glTexImage3D"); pragma Import (Stdcall, glTexSubImage3D, "glTexSubImage3D"); pragma Import (Stdcall, glCopyTexSubImage3D, "glCopyTexSubImage3D"); pragma Import (Stdcall, glColorTable, "glColorTable"); pragma Import (Stdcall, glColorSubTable, "glColorSubTable"); pragma Import (Stdcall, glColorTableParameteriv, "glColorTableParameteriv"); pragma Import (Stdcall, glColorTableParameterfv, "glColorTableParameterfv"); pragma Import (Stdcall, glCopyColorSubTable, "glCopyColorSubTable"); pragma Import (Stdcall, glCopyColorTable, "glCopyColorTable"); pragma Import (Stdcall, glGetColorTable, "glGetColorTable"); pragma Import (Stdcall, glGetColorTableParameterfv, "glGetColorTableParameterfv"); pragma Import (Stdcall, glGetColorTableParameteriv, "glGetColorTableParameteriv"); pragma Import (Stdcall, glBlendEquation, "glBlendEquation"); pragma Import (Stdcall, glBlendColor, "glBlendColor"); pragma Import (Stdcall, glHistogram, "glHistogram"); pragma Import (Stdcall, glResetHistogram, "glResetHistogram"); pragma Import (Stdcall, glGetHistogram, "glGetHistogram"); pragma Import (Stdcall, glGetHistogramParameterfv, "glGetHistogramParameterfv"); pragma Import (Stdcall, glGetHistogramParameteriv, "glGetHistogramParameteriv"); pragma Import (Stdcall, glMinmax, "glMinmax"); pragma Import (Stdcall, glResetMinmax, "glResetMinmax"); pragma Import (Stdcall, glGetMinmax, "glGetMinmax"); pragma Import (Stdcall, glGetMinmaxParameterfv, "glGetMinmaxParameterfv"); pragma Import (Stdcall, glGetMinmaxParameteriv, "glGetMinmaxParameteriv"); pragma Import (Stdcall, glConvolutionFilter1D, "glConvolutionFilter1D"); pragma Import (Stdcall, glConvolutionFilter2D, "glConvolutionFilter2D"); pragma Import (Stdcall, glConvolutionParameterf, "glConvolutionParameterf"); pragma Import (Stdcall, glConvolutionParameterfv, "glConvolutionParameterfv"); pragma Import (Stdcall, glConvolutionParameteri, "glConvolutionParameteri"); pragma Import (Stdcall, glConvolutionParameteriv, "glConvolutionParameteriv"); pragma Import (Stdcall, glCopyConvolutionFilter1D, "glCopyConvolutionFilter1D"); pragma Import (Stdcall, glCopyConvolutionFilter2D, "glCopyConvolutionFilter2D"); pragma Import (Stdcall, glGetConvolutionFilter, "glGetConvolutionFilter"); pragma Import (Stdcall, glGetConvolutionParameterfv, "glGetConvolutionParameterfv"); pragma Import (Stdcall, glGetConvolutionParameteriv, "glGetConvolutionParameteriv"); pragma Import (Stdcall, glSeparableFilter2D, "glSeparableFilter2D"); pragma Import (Stdcall, glGetSeparableFilter, "glGetSeparableFilter"); pragma Import (Stdcall, glActiveTexture, "glActiveTexture"); pragma Import (Stdcall, glClientActiveTexture, "glClientActiveTexture"); pragma Import (Stdcall, glCompressedTexImage1D, "glCompressedTexImage1D"); pragma Import (Stdcall, glCompressedTexImage2D, "glCompressedTexImage2D"); pragma Import (Stdcall, glCompressedTexImage3D, "glCompressedTexImage3D"); pragma Import (Stdcall, glCompressedTexSubImage1D, "glCompressedTexSubImage1D"); pragma Import (Stdcall, glCompressedTexSubImage2D, "glCompressedTexSubImage2D"); pragma Import (Stdcall, glCompressedTexSubImage3D, "glCompressedTexSubImage3D"); pragma Import (Stdcall, glGetCompressedTexImage, "glGetCompressedTexImage"); pragma Import (Stdcall, glMultiTexCoord1d, "glMultiTexCoord1d"); pragma Import (Stdcall, glMultiTexCoord1dv, "glMultiTexCoord1dv"); pragma Import (Stdcall, glMultiTexCoord1f, "glMultiTexCoord1f"); pragma Import (Stdcall, glMultiTexCoord1fv, "glMultiTexCoord1fv"); pragma Import (Stdcall, glMultiTexCoord1i, "glMultiTexCoord1i"); pragma Import (Stdcall, glMultiTexCoord1iv, "glMultiTexCoord1iv"); pragma Import (Stdcall, glMultiTexCoord1s, "glMultiTexCoord1s"); pragma Import (Stdcall, glMultiTexCoord1sv, "glMultiTexCoord1sv"); pragma Import (Stdcall, glMultiTexCoord2d, "glMultiTexCoord2d"); pragma Import (Stdcall, glMultiTexCoord2dv, "glMultiTexCoord2dv"); pragma Import (Stdcall, glMultiTexCoord2f, "glMultiTexCoord2f"); pragma Import (Stdcall, glMultiTexCoord2fv, "glMultiTexCoord2fv"); pragma Import (Stdcall, glMultiTexCoord2i, "glMultiTexCoord2i"); pragma Import (Stdcall, glMultiTexCoord2iv, "glMultiTexCoord2iv"); pragma Import (Stdcall, glMultiTexCoord2s, "glMultiTexCoord2s"); pragma Import (Stdcall, glMultiTexCoord2sv, "glMultiTexCoord2sv"); pragma Import (Stdcall, glMultiTexCoord3d, "glMultiTexCoord3d"); pragma Import (Stdcall, glMultiTexCoord3dv, "glMultiTexCoord3dv"); pragma Import (Stdcall, glMultiTexCoord3f, "glMultiTexCoord3f"); pragma Import (Stdcall, glMultiTexCoord3fv, "glMultiTexCoord3fv"); pragma Import (Stdcall, glMultiTexCoord3i, "glMultiTexCoord3i"); pragma Import (Stdcall, glMultiTexCoord3iv, "glMultiTexCoord3iv"); pragma Import (Stdcall, glMultiTexCoord3s, "glMultiTexCoord3s"); pragma Import (Stdcall, glMultiTexCoord3sv, "glMultiTexCoord3sv"); pragma Import (Stdcall, glMultiTexCoord4d, "glMultiTexCoord4d"); pragma Import (Stdcall, glMultiTexCoord4dv, "glMultiTexCoord4dv"); pragma Import (Stdcall, glMultiTexCoord4f, "glMultiTexCoord4f"); pragma Import (Stdcall, glMultiTexCoord4fv, "glMultiTexCoord4fv"); pragma Import (Stdcall, glMultiTexCoord4i, "glMultiTexCoord4i"); pragma Import (Stdcall, glMultiTexCoord4iv, "glMultiTexCoord4iv"); pragma Import (Stdcall, glMultiTexCoord4s, "glMultiTexCoord4s"); pragma Import (Stdcall, glMultiTexCoord4sv, "glMultiTexCoord4sv"); pragma Import (Stdcall, glLoadTransposeMatrixd, "glLoadTransposeMatrixd"); pragma Import (Stdcall, glLoadTransposeMatrixf, "glLoadTransposeMatrixf"); pragma Import (Stdcall, glMultTransposeMatrixd, "glMultTransposeMatrixd"); pragma Import (Stdcall, glMultTransposeMatrixf, "glMultTransposeMatrixf"); pragma Import (Stdcall, glSampleCoverage, "glSampleCoverage"); pragma Import (Stdcall, glSamplePass, "glSamplePass"); end Sf.Window.GL;
with Interfaces.C, System; use type System.Address; package body FLTK.Widgets.Groups.Windows.Double is procedure double_window_set_draw_hook (W, D : in System.Address); pragma Import (C, double_window_set_draw_hook, "double_window_set_draw_hook"); pragma Inline (double_window_set_draw_hook); procedure double_window_set_handle_hook (W, H : in System.Address); pragma Import (C, double_window_set_handle_hook, "double_window_set_handle_hook"); pragma Inline (double_window_set_handle_hook); function new_fl_double_window (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_double_window, "new_fl_double_window"); pragma Inline (new_fl_double_window); function new_fl_double_window2 (X, Y : in Interfaces.C.int; Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_double_window2, "new_fl_double_window2"); pragma Inline (new_fl_double_window2); procedure free_fl_double_window (W : in System.Address); pragma Import (C, free_fl_double_window, "free_fl_double_window"); pragma Inline (free_fl_double_window); procedure fl_double_window_show (W : in System.Address); pragma Import (C, fl_double_window_show, "fl_double_window_show"); pragma Inline (fl_double_window_show); procedure fl_double_window_hide (W : in System.Address); pragma Import (C, fl_double_window_hide, "fl_double_window_hide"); pragma Inline (fl_double_window_hide); procedure fl_double_window_flush (W : in System.Address); pragma Import (C, fl_double_window_flush, "fl_double_window_flush"); pragma Inline (fl_double_window_flush); procedure fl_double_window_draw (W : in System.Address); pragma Import (C, fl_double_window_draw, "fl_double_window_draw"); pragma Inline (fl_double_window_draw); function fl_double_window_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_double_window_handle, "fl_double_window_handle"); pragma Inline (fl_double_window_handle); procedure Finalize (This : in out Double_Window) is begin if This.Void_Ptr /= System.Null_Address and then This in Double_Window'Class then This.Clear; free_fl_double_window (This.Void_Ptr); This.Void_Ptr := System.Null_Address; end if; Finalize (Window (This)); end Finalize; package body Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Double_Window is begin return This : Double_Window do This.Void_Ptr := new_fl_double_window (Interfaces.C.int (X), Interfaces.C.int (Y), Interfaces.C.int (W), Interfaces.C.int (H), Interfaces.C.To_C (Text)); fl_group_end (This.Void_Ptr); fl_widget_set_user_data (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); double_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); double_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; function Create (W, H : in Integer; Text : in String) return Double_Window is begin return This : Double_Window do This.Void_Ptr := new_fl_double_window2 (Interfaces.C.int (W), Interfaces.C.int (H), Interfaces.C.To_C (Text)); fl_group_end (This.Void_Ptr); fl_widget_set_user_data (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); double_window_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); double_window_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; end Forge; procedure Show (This : in out Double_Window) is begin fl_double_window_show (This.Void_Ptr); end Show; procedure Hide (This : in out Double_Window) is begin fl_double_window_hide (This.Void_Ptr); end Hide; procedure Flush (This : in out Double_Window) is begin fl_double_window_flush (This.Void_Ptr); end Flush; procedure Draw (This : in out Double_Window) is begin fl_double_window_draw (This.Void_Ptr); end Draw; function Handle (This : in out Double_Window; Event : in Event_Kind) return Event_Outcome is begin return Event_Outcome'Val (fl_double_window_handle (This.Void_Ptr, Event_Kind'Pos (Event))); end Handle; end FLTK.Widgets.Groups.Windows.Double;
-- Generated by utildgen.c from system includes private package Util.Http.Clients.Curl.Constants is CURLOPT_URL : constant Curl_Option := 10002; CURLOPT_HTTPGET : constant Curl_Option := 80; CURLOPT_POST : constant Curl_Option := 47; CURLOPT_CUSTOMREQUEST : constant Curl_Option := 10036; CURLOPT_READFUNCTION : constant Curl_Option := 20012; CURLOPT_WRITEUNCTION : constant Curl_Option := 20011; CURLOPT_HTTPHEADER : constant Curl_Option := 10023; CURLOPT_INTERFACE : constant Curl_Option := 10062; CURLOPT_USERPWD : constant Curl_Option := 10005; CURLOPT_HTTPAUTH : constant Curl_Option := 107; CURLOPT_MAXFILESIZE : constant Curl_Option := 114; CURLOPT_WRITEDATA : constant Curl_Option := 10001; CURLOPT_HEADER : constant Curl_Option := 42; CURLOPT_POSTFIELDS : constant Curl_Option := 10015; CURLOPT_POSTFIELDSIZE : constant Curl_Option := 60; CURLOPT_CONNECTTIMEOUT : constant Curl_Option := 78; CURLOPT_TIMEOUT : constant Curl_Option := 13; CURLOPT_NOBODY : constant Curl_Option := 44; CURLINFO_RESPONSE_CODE : constant CURL_Info := 2097154; end Util.Http.Clients.Curl.Constants;
----------------------------------------------------------------------- -- -- File: nt_console.ads -- Description: Win95/NT console support -- Rev: 0.2 -- Date: 08-june-1999 -- Author: Jerry van Dijk -- Mail: jdijk@acm.org -- -- Copyright (c) Jerry van Dijk, 1997, 1998, 1999 -- Billie Holidaystraat 28 -- 2324 LK LEIDEN -- THE NETHERLANDS -- tel int + 31 71 531 43 65 -- -- Permission granted to use for any purpose, provided this copyright -- remains attached and unmodified. -- -- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -- ----------------------------------------------------------------------- package NT_Console is ---------------------- -- TYPE DEFINITIONS -- ---------------------- subtype X_Pos is Natural range 0 .. 79; subtype Y_Pos is Natural range 0 .. 24; type Color_Type is (Black, Blue, Green, Cyan, Red, Magenta, Brown, Gray, Light_Blue, Light_Green, Light_Cyan, Light_Red, Light_Magenta, Yellow, White); ---------------------- -- EXTENDED PC KEYS -- ---------------------- Key_Alt_Escape : constant Character := Character'Val (16#01#); Key_Control_At : constant Character := Character'Val (16#03#); Key_Alt_Backspace : constant Character := Character'Val (16#0E#); Key_BackTab : constant Character := Character'Val (16#0F#); Key_Alt_Q : constant Character := Character'Val (16#10#); Key_Alt_W : constant Character := Character'Val (16#11#); Key_Alt_E : constant Character := Character'Val (16#12#); Key_Alt_R : constant Character := Character'Val (16#13#); Key_Alt_T : constant Character := Character'Val (16#14#); Key_Alt_Y : constant Character := Character'Val (16#15#); Key_Alt_U : constant Character := Character'Val (16#16#); Key_Alt_I : constant Character := Character'Val (16#17#); Key_Alt_O : constant Character := Character'Val (16#18#); Key_Alt_P : constant Character := Character'Val (16#19#); Key_Alt_LBracket : constant Character := Character'Val (16#1A#); Key_Alt_RBracket : constant Character := Character'Val (16#1B#); Key_Alt_Return : constant Character := Character'Val (16#1C#); Key_Alt_A : constant Character := Character'Val (16#1E#); Key_Alt_S : constant Character := Character'Val (16#1F#); Key_Alt_D : constant Character := Character'Val (16#20#); Key_Alt_F : constant Character := Character'Val (16#21#); Key_Alt_G : constant Character := Character'Val (16#22#); Key_Alt_H : constant Character := Character'Val (16#23#); Key_Alt_J : constant Character := Character'Val (16#24#); Key_Alt_K : constant Character := Character'Val (16#25#); Key_Alt_L : constant Character := Character'Val (16#26#); Key_Alt_Semicolon : constant Character := Character'Val (16#27#); Key_Alt_Quote : constant Character := Character'Val (16#28#); Key_Alt_Backquote : constant Character := Character'Val (16#29#); Key_Alt_Backslash : constant Character := Character'Val (16#2B#); Key_Alt_Z : constant Character := Character'Val (16#2C#); Key_Alt_X : constant Character := Character'Val (16#2D#); Key_Alt_C : constant Character := Character'Val (16#2E#); Key_Alt_V : constant Character := Character'Val (16#2F#); Key_Alt_B : constant Character := Character'Val (16#30#); Key_Alt_N : constant Character := Character'Val (16#31#); Key_Alt_M : constant Character := Character'Val (16#32#); Key_Alt_Comma : constant Character := Character'Val (16#33#); Key_Alt_Period : constant Character := Character'Val (16#34#); Key_Alt_Slash : constant Character := Character'Val (16#35#); Key_Alt_KPStar : constant Character := Character'Val (16#37#); Key_F1 : constant Character := Character'Val (16#3B#); Key_F2 : constant Character := Character'Val (16#3C#); Key_F3 : constant Character := Character'Val (16#3D#); Key_F4 : constant Character := Character'Val (16#3E#); Key_F5 : constant Character := Character'Val (16#3F#); Key_F6 : constant Character := Character'Val (16#40#); Key_F7 : constant Character := Character'Val (16#41#); Key_F8 : constant Character := Character'Val (16#42#); Key_F9 : constant Character := Character'Val (16#43#); Key_F10 : constant Character := Character'Val (16#44#); Key_Home : constant Character := Character'Val (16#47#); Key_Up : constant Character := Character'Val (16#48#); Key_PageUp : constant Character := Character'Val (16#49#); Key_Alt_KPMinus : constant Character := Character'Val (16#4A#); Key_Left : constant Character := Character'Val (16#4B#); Key_Center : constant Character := Character'Val (16#4C#); Key_Right : constant Character := Character'Val (16#4D#); Key_Alt_KPPlus : constant Character := Character'Val (16#4E#); Key_End : constant Character := Character'Val (16#4F#); Key_Down : constant Character := Character'Val (16#50#); Key_PageDown : constant Character := Character'Val (16#51#); Key_Insert : constant Character := Character'Val (16#52#); Key_Delete : constant Character := Character'Val (16#53#); Key_Shift_F1 : constant Character := Character'Val (16#54#); Key_Shift_F2 : constant Character := Character'Val (16#55#); Key_Shift_F3 : constant Character := Character'Val (16#56#); Key_Shift_F4 : constant Character := Character'Val (16#57#); Key_Shift_F5 : constant Character := Character'Val (16#58#); Key_Shift_F6 : constant Character := Character'Val (16#59#); Key_Shift_F7 : constant Character := Character'Val (16#5A#); Key_Shift_F8 : constant Character := Character'Val (16#5B#); Key_Shift_F9 : constant Character := Character'Val (16#5C#); Key_Shift_F10 : constant Character := Character'Val (16#5D#); Key_Control_F1 : constant Character := Character'Val (16#5E#); Key_Control_F2 : constant Character := Character'Val (16#5F#); Key_Control_F3 : constant Character := Character'Val (16#60#); Key_Control_F4 : constant Character := Character'Val (16#61#); Key_Control_F5 : constant Character := Character'Val (16#62#); Key_Control_F6 : constant Character := Character'Val (16#63#); Key_Control_F7 : constant Character := Character'Val (16#64#); Key_Control_F8 : constant Character := Character'Val (16#65#); Key_Control_F9 : constant Character := Character'Val (16#66#); Key_Control_F10 : constant Character := Character'Val (16#67#); Key_Alt_F1 : constant Character := Character'Val (16#68#); Key_Alt_F2 : constant Character := Character'Val (16#69#); Key_Alt_F3 : constant Character := Character'Val (16#6A#); Key_Alt_F4 : constant Character := Character'Val (16#6B#); Key_Alt_F5 : constant Character := Character'Val (16#6C#); Key_Alt_F6 : constant Character := Character'Val (16#6D#); Key_Alt_F7 : constant Character := Character'Val (16#6E#); Key_Alt_F8 : constant Character := Character'Val (16#6F#); Key_Alt_F9 : constant Character := Character'Val (16#70#); Key_Alt_F10 : constant Character := Character'Val (16#71#); Key_Control_Left : constant Character := Character'Val (16#73#); Key_Control_Right : constant Character := Character'Val (16#74#); Key_Control_End : constant Character := Character'Val (16#75#); Key_Control_PageDown : constant Character := Character'Val (16#76#); Key_Control_Home : constant Character := Character'Val (16#77#); Key_Alt_1 : constant Character := Character'Val (16#78#); Key_Alt_2 : constant Character := Character'Val (16#79#); Key_Alt_3 : constant Character := Character'Val (16#7A#); Key_Alt_4 : constant Character := Character'Val (16#7B#); Key_Alt_5 : constant Character := Character'Val (16#7C#); Key_Alt_6 : constant Character := Character'Val (16#7D#); Key_Alt_7 : constant Character := Character'Val (16#7E#); Key_Alt_8 : constant Character := Character'Val (16#7F#); Key_Alt_9 : constant Character := Character'Val (16#80#); Key_Alt_0 : constant Character := Character'Val (16#81#); Key_Alt_Dash : constant Character := Character'Val (16#82#); Key_Alt_Equals : constant Character := Character'Val (16#83#); Key_Control_PageUp : constant Character := Character'Val (16#84#); Key_F11 : constant Character := Character'Val (16#85#); Key_F12 : constant Character := Character'Val (16#86#); Key_Shift_F11 : constant Character := Character'Val (16#87#); Key_Shift_F12 : constant Character := Character'Val (16#88#); Key_Control_F11 : constant Character := Character'Val (16#89#); Key_Control_F12 : constant Character := Character'Val (16#8A#); Key_Alt_F11 : constant Character := Character'Val (16#8B#); Key_Alt_F12 : constant Character := Character'Val (16#8C#); Key_Control_Up : constant Character := Character'Val (16#8D#); Key_Control_KPDash : constant Character := Character'Val (16#8E#); Key_Control_Center : constant Character := Character'Val (16#8F#); Key_Control_KPPlus : constant Character := Character'Val (16#90#); Key_Control_Down : constant Character := Character'Val (16#91#); Key_Control_Insert : constant Character := Character'Val (16#92#); Key_Control_Delete : constant Character := Character'Val (16#93#); Key_Control_KPSlash : constant Character := Character'Val (16#95#); Key_Control_KPStar : constant Character := Character'Val (16#96#); Key_Alt_EHome : constant Character := Character'Val (16#97#); Key_Alt_EUp : constant Character := Character'Val (16#98#); Key_Alt_EPageUp : constant Character := Character'Val (16#99#); Key_Alt_ELeft : constant Character := Character'Val (16#9B#); Key_Alt_ERight : constant Character := Character'Val (16#9D#); Key_Alt_EEnd : constant Character := Character'Val (16#9F#); Key_Alt_EDown : constant Character := Character'Val (16#A0#); Key_Alt_EPageDown : constant Character := Character'Val (16#A1#); Key_Alt_EInsert : constant Character := Character'Val (16#A2#); Key_Alt_EDelete : constant Character := Character'Val (16#A3#); Key_Alt_KPSlash : constant Character := Character'Val (16#A4#); Key_Alt_Tab : constant Character := Character'Val (16#A5#); Key_Alt_Enter : constant Character := Character'Val (16#A6#); -------------------- -- CURSOR CONTROL -- -------------------- function Cursor_Visible return Boolean; procedure Set_Cursor (Visible : in Boolean); function Where_X return X_Pos; function Where_Y return Y_Pos; procedure Goto_XY (X : in X_Pos := X_Pos'First; Y : in Y_Pos := Y_Pos'First); ------------------- -- COLOR CONTROL -- ------------------- function Get_Foreground return Color_Type; function Get_Background return Color_Type; procedure Set_Foreground (Color : in Color_Type := Gray); procedure Set_Background (Color : in Color_Type := Black); -------------------- -- SCREEN CONTROL -- -------------------- procedure Clear_Screen (Color : in Color_Type := Black); ------------------- -- SOUND CONTROL -- ------------------- procedure Bleep; ------------------- -- INPUT CONTROL -- ------------------- function Get_Key return Character; function Key_Available return Boolean; end NT_Console;
-- This spec has been automatically generated from STM32WB55x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.I2C is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CR1_DNF_Field is HAL.UInt4; type CR1_Register is record PE : Boolean := False; TXIE : Boolean := False; RXIE : Boolean := False; ADDRIE : Boolean := False; NACKIE : Boolean := False; STOPIE : Boolean := False; TCIE : Boolean := False; ERRIE : Boolean := False; DNF : CR1_DNF_Field := 16#0#; ANFOFF : Boolean := False; -- unspecified Reserved_13_13 : HAL.Bit := 16#0#; TXDMAEN : Boolean := False; RXDMAEN : Boolean := False; SBC : Boolean := False; NOSTRETCH : Boolean := False; WUPEN : Boolean := False; GCEN : Boolean := False; SMBHEN : Boolean := False; SMBDEN : Boolean := False; ALERTEN : Boolean := False; PECEN : Boolean := False; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR1_Register use record PE at 0 range 0 .. 0; TXIE at 0 range 1 .. 1; RXIE at 0 range 2 .. 2; ADDRIE at 0 range 3 .. 3; NACKIE at 0 range 4 .. 4; STOPIE at 0 range 5 .. 5; TCIE at 0 range 6 .. 6; ERRIE at 0 range 7 .. 7; DNF at 0 range 8 .. 11; ANFOFF at 0 range 12 .. 12; Reserved_13_13 at 0 range 13 .. 13; TXDMAEN at 0 range 14 .. 14; RXDMAEN at 0 range 15 .. 15; SBC at 0 range 16 .. 16; NOSTRETCH at 0 range 17 .. 17; WUPEN at 0 range 18 .. 18; GCEN at 0 range 19 .. 19; SMBHEN at 0 range 20 .. 20; SMBDEN at 0 range 21 .. 21; ALERTEN at 0 range 22 .. 22; PECEN at 0 range 23 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; subtype CR2_SADD_Field is HAL.UInt10; subtype CR2_NBYTES_Field is HAL.UInt8; type CR2_Register is record SADD : CR2_SADD_Field := 16#0#; RD_WRN : Boolean := False; ADD10 : Boolean := False; HEAD10R : Boolean := False; START : Boolean := False; STOP : Boolean := False; NACK : Boolean := False; NBYTES : CR2_NBYTES_Field := 16#0#; RELOAD : Boolean := False; AUTOEND : Boolean := False; PECBYTE : Boolean := False; -- unspecified Reserved_27_31 : HAL.UInt5 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR2_Register use record SADD at 0 range 0 .. 9; RD_WRN at 0 range 10 .. 10; ADD10 at 0 range 11 .. 11; HEAD10R at 0 range 12 .. 12; START at 0 range 13 .. 13; STOP at 0 range 14 .. 14; NACK at 0 range 15 .. 15; NBYTES at 0 range 16 .. 23; RELOAD at 0 range 24 .. 24; AUTOEND at 0 range 25 .. 25; PECBYTE at 0 range 26 .. 26; Reserved_27_31 at 0 range 27 .. 31; end record; subtype OAR1_OA1_Field is HAL.UInt10; type OAR1_Register is record OA1 : OAR1_OA1_Field := 16#0#; OA1MODE : Boolean := False; -- unspecified Reserved_11_14 : HAL.UInt4 := 16#0#; OA1EN : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OAR1_Register use record OA1 at 0 range 0 .. 9; OA1MODE at 0 range 10 .. 10; Reserved_11_14 at 0 range 11 .. 14; OA1EN at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype OAR2_OA2_Field is HAL.UInt7; subtype OAR2_OA2MSK_Field is HAL.UInt3; type OAR2_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; OA2 : OAR2_OA2_Field := 16#0#; OA2MSK : OAR2_OA2MSK_Field := 16#0#; -- unspecified Reserved_11_14 : HAL.UInt4 := 16#0#; OA2EN : Boolean := False; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for OAR2_Register use record Reserved_0_0 at 0 range 0 .. 0; OA2 at 0 range 1 .. 7; OA2MSK at 0 range 8 .. 10; Reserved_11_14 at 0 range 11 .. 14; OA2EN at 0 range 15 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype TIMINGR_SCLL_Field is HAL.UInt8; subtype TIMINGR_SCLH_Field is HAL.UInt8; subtype TIMINGR_SDADEL_Field is HAL.UInt4; subtype TIMINGR_SCLDEL_Field is HAL.UInt4; subtype TIMINGR_PRESC_Field is HAL.UInt4; type TIMINGR_Register is record SCLL : TIMINGR_SCLL_Field := 16#0#; SCLH : TIMINGR_SCLH_Field := 16#0#; SDADEL : TIMINGR_SDADEL_Field := 16#0#; SCLDEL : TIMINGR_SCLDEL_Field := 16#0#; -- unspecified Reserved_24_27 : HAL.UInt4 := 16#0#; PRESC : TIMINGR_PRESC_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TIMINGR_Register use record SCLL at 0 range 0 .. 7; SCLH at 0 range 8 .. 15; SDADEL at 0 range 16 .. 19; SCLDEL at 0 range 20 .. 23; Reserved_24_27 at 0 range 24 .. 27; PRESC at 0 range 28 .. 31; end record; subtype TIMEOUTR_TIMEOUTA_Field is HAL.UInt12; subtype TIMEOUTR_TIMEOUTB_Field is HAL.UInt12; type TIMEOUTR_Register is record TIMEOUTA : TIMEOUTR_TIMEOUTA_Field := 16#0#; TIDLE : Boolean := False; -- unspecified Reserved_13_14 : HAL.UInt2 := 16#0#; TIMOUTEN : Boolean := False; TIMEOUTB : TIMEOUTR_TIMEOUTB_Field := 16#0#; -- unspecified Reserved_28_30 : HAL.UInt3 := 16#0#; TEXTEN : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TIMEOUTR_Register use record TIMEOUTA at 0 range 0 .. 11; TIDLE at 0 range 12 .. 12; Reserved_13_14 at 0 range 13 .. 14; TIMOUTEN at 0 range 15 .. 15; TIMEOUTB at 0 range 16 .. 27; Reserved_28_30 at 0 range 28 .. 30; TEXTEN at 0 range 31 .. 31; end record; subtype ISR_ADDCODE_Field is HAL.UInt7; type ISR_Register is record TXE : Boolean := False; TXIS : Boolean := False; RXNE : Boolean := False; ADDR : Boolean := False; NACKF : Boolean := False; STOPF : Boolean := False; TC : Boolean := False; TCR : Boolean := False; BERR : Boolean := False; ARLO : Boolean := False; OVR : Boolean := False; PECERR : Boolean := False; TIMEOUT : Boolean := False; ALERT : Boolean := False; -- unspecified Reserved_14_14 : HAL.Bit := 16#0#; BUSY : Boolean := False; DIR : Boolean := False; ADDCODE : ISR_ADDCODE_Field := 16#0#; -- unspecified Reserved_24_31 : HAL.UInt8 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ISR_Register use record TXE at 0 range 0 .. 0; TXIS at 0 range 1 .. 1; RXNE at 0 range 2 .. 2; ADDR at 0 range 3 .. 3; NACKF at 0 range 4 .. 4; STOPF at 0 range 5 .. 5; TC at 0 range 6 .. 6; TCR at 0 range 7 .. 7; BERR at 0 range 8 .. 8; ARLO at 0 range 9 .. 9; OVR at 0 range 10 .. 10; PECERR at 0 range 11 .. 11; TIMEOUT at 0 range 12 .. 12; ALERT at 0 range 13 .. 13; Reserved_14_14 at 0 range 14 .. 14; BUSY at 0 range 15 .. 15; DIR at 0 range 16 .. 16; ADDCODE at 0 range 17 .. 23; Reserved_24_31 at 0 range 24 .. 31; end record; type ICR_Register is record -- unspecified Reserved_0_2 : HAL.UInt3 := 16#0#; ADDRCF : Boolean := False; NACKCF : Boolean := False; STOPCF : Boolean := False; -- unspecified Reserved_6_7 : HAL.UInt2 := 16#0#; BERRCF : Boolean := False; ARLOCF : Boolean := False; OVRCF : Boolean := False; PECCF : Boolean := False; TIMOUTCF : Boolean := False; ALERTCF : Boolean := False; -- unspecified Reserved_14_31 : HAL.UInt18 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ICR_Register use record Reserved_0_2 at 0 range 0 .. 2; ADDRCF at 0 range 3 .. 3; NACKCF at 0 range 4 .. 4; STOPCF at 0 range 5 .. 5; Reserved_6_7 at 0 range 6 .. 7; BERRCF at 0 range 8 .. 8; ARLOCF at 0 range 9 .. 9; OVRCF at 0 range 10 .. 10; PECCF at 0 range 11 .. 11; TIMOUTCF at 0 range 12 .. 12; ALERTCF at 0 range 13 .. 13; Reserved_14_31 at 0 range 14 .. 31; end record; subtype PECR_PEC_Field is HAL.UInt8; type PECR_Register is record PEC : PECR_PEC_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PECR_Register use record PEC at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype RXDR_RXDATA_Field is HAL.UInt8; type RXDR_Register is record RXDATA : RXDR_RXDATA_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RXDR_Register use record RXDATA at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; subtype TXDR_TXDATA_Field is HAL.UInt8; type TXDR_Register is record TXDATA : TXDR_TXDATA_Field := 16#0#; -- unspecified Reserved_8_31 : HAL.UInt24 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TXDR_Register use record TXDATA at 0 range 0 .. 7; Reserved_8_31 at 0 range 8 .. 31; end record; ----------------- -- Peripherals -- ----------------- type I2C_Peripheral is record CR1 : aliased CR1_Register; CR2 : aliased CR2_Register; OAR1 : aliased OAR1_Register; OAR2 : aliased OAR2_Register; TIMINGR : aliased TIMINGR_Register; TIMEOUTR : aliased TIMEOUTR_Register; ISR : aliased ISR_Register; ICR : aliased ICR_Register; PECR : aliased PECR_Register; RXDR : aliased RXDR_Register; TXDR : aliased TXDR_Register; end record with Volatile; for I2C_Peripheral use record CR1 at 16#0# range 0 .. 31; CR2 at 16#4# range 0 .. 31; OAR1 at 16#8# range 0 .. 31; OAR2 at 16#C# range 0 .. 31; TIMINGR at 16#10# range 0 .. 31; TIMEOUTR at 16#14# range 0 .. 31; ISR at 16#18# range 0 .. 31; ICR at 16#1C# range 0 .. 31; PECR at 16#20# range 0 .. 31; RXDR at 16#24# range 0 .. 31; TXDR at 16#28# range 0 .. 31; end record; I2C1_Periph : aliased I2C_Peripheral with Import, Address => System'To_Address (16#40005400#); I2C3_Periph : aliased I2C_Peripheral with Import, Address => System'To_Address (16#40005C00#); end STM32_SVD.I2C;
package openGL.Texture.Coordinates -- -- Provides openGL texture co-ordinates. -- is ------ --- 2D -- type coordinate_Generator is abstract tagged null record; function to_Coordinates (Self : in coordinate_Generator; the_Vertices : access Sites) return Coordinates_2D is abstract; type xz_Generator is new coordinate_Generator with record Normalise : texture_Transform_2D; Tile : texture_Transform_2D; end record; overriding function to_Coordinates (Self : in xz_Generator; the_Vertices : access Sites) return Coordinates_2D; type xy_Generator is new coordinate_Generator with record Normalise : texture_Transform_2D; Tile : texture_Transform_2D; end record; overriding function to_Coordinates (Self : in xy_Generator; the_Vertices : access Sites) return Coordinates_2D; type zy_Generator is new coordinate_Generator with record Normalise : texture_Transform_2D; Tile : texture_Transform_2D; end record; overriding function to_Coordinates (Self : in zy_Generator; the_Vertices : access Sites) return Coordinates_2D; type mercator_Generator is new coordinate_Generator with null record; overriding function to_Coordinates (Self : in mercator_Generator; the_Vertices : access Sites) return Coordinates_2D; end openGL.Texture.Coordinates;
with Ada.Strings.Fixed; with Ada.Text_IO; with Templates_Parser; procedure Csv2Html is use type Templates_Parser.Vector_Tag; Chars : Templates_Parser.Vector_Tag; Speeches : Templates_Parser.Vector_Tag; CSV_File : Ada.Text_IO.File_Type; begin -- read the csv data Ada.Text_IO.Open (File => CSV_File, Mode => Ada.Text_IO.In_File, Name => "data.csv"); -- fill the tags while not Ada.Text_IO.End_Of_File (CSV_File) loop declare Whole_Line : String := Ada.Text_IO.Get_Line (CSV_File); Comma_Pos : Natural := Ada.Strings.Fixed.Index (Whole_Line, ","); begin Chars := Chars & Whole_Line (Whole_Line'First .. Comma_Pos - 1); Speeches := Speeches & Whole_Line (Comma_Pos + 1 .. Whole_Line'Last); end; end loop; Ada.Text_IO.Close (CSV_File); -- build translation table and output html declare Translations : constant Templates_Parser.Translate_Table := (1 => Templates_Parser.Assoc ("CHAR", Chars), 2 => Templates_Parser.Assoc ("SPEECH", Speeches)); begin Ada.Text_IO.Put_Line (Templates_Parser.Parse ("table.tmplt", Translations)); end; end Csv2Html;
------------------------------------------------------------------------------ -- Copyright (c) 2011, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Ada.Characters.Handling; with Ada.Characters.Latin_1; with Ada.Exceptions; with Ada.Strings; use Ada.Strings; procedure Natools.Chunked_Strings.Tests.CXA4030 (Report : in out Natools.Tests.Reporter'Class) is package NT renames Natools.Tests; begin NT.Section (Report, "Port of ACATS CXA4030"); declare package L1 renames Ada.Characters.Latin_1; New_Character_String : Chunked_String := To_Chunked_String (L1.LC_A_Grave & L1.LC_A_Ring & L1.LC_AE_Diphthong & L1.LC_C_Cedilla & L1.LC_E_Acute & L1.LC_I_Circumflex & L1.LC_Icelandic_Eth & L1.LC_N_Tilde & L1.LC_O_Oblique_Stroke & L1.LC_Icelandic_Thorn); TC_New_Character_String : constant Chunked_String := To_Chunked_String (L1.UC_A_Grave & L1.UC_A_Ring & L1.UC_AE_Diphthong & L1.UC_C_Cedilla & L1.UC_E_Acute & L1.UC_I_Circumflex & L1.UC_Icelandic_Eth & L1.UC_N_Tilde & L1.UC_O_Oblique_Stroke & L1.UC_Icelandic_Thorn); Map_To_Lower_Case_Ptr : constant Maps.Character_Mapping_Function := Ada.Characters.Handling.To_Lower'Access; Map_To_Upper_Case_Ptr : constant Maps.Character_Mapping_Function := Ada.Characters.Handling.To_Upper'Access; begin NT.Section (Report, "Function Index, Forward direction"); declare Name : constant String := "Mixed case mapped to lower"; begin Test (Report, Name, Index (Source => To_Chunked_String ("The library package Strings.Unbounded"), Pattern => "unb", Going => Ada.Strings.Forward, Mapping => Map_To_Lower_Case_Ptr), 29); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Upper case mapped to lower"; begin Test (Report, Name, Index (To_Chunked_String ("THE RAIN IN SPAIN FALLS MAINLY ON THE PLAIN"), "ain", Mapping => Map_To_Lower_Case_Ptr), 6); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Lower case mapped to lower"; begin Test (Report, Name, Index (To_Chunked_String ("maximum number"), "um", Ada.Strings.Forward, Ada.Characters.Handling.To_Lower'Access), 6); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Mixed case mapped to upper"; begin Test (Report, Name, Index (To_Chunked_String ("CoMpLeTeLy MiXeD CaSe StRiNg"), "MIXED CASE STRING", Ada.Strings.Forward, Map_To_Upper_Case_Ptr), 12); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Upper case mapped to lower (no match)"; begin Test (Report, Name, Index (To_Chunked_String ("STRING WITH NO MATCHING PATTERNS"), "WITH", Mapping => Map_To_Lower_Case_Ptr), 0); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Upper case mapped to upper"; begin Test (Report, Name, Index (To_Chunked_String ("THIS STRING IS IN UPPER CASE"), "IS", Ada.Strings.Forward, Ada.Characters.Handling.To_Upper'Access), 3); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Null string"; begin Test (Report, Name, Index (Null_Chunked_String, "is", Mapping => Map_To_Lower_Case_Ptr), 0); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Upper case mapped to lower"; begin Test (Report, Name, Index (To_Chunked_String ("AAABBBaaabbb"), "aabb", Mapping => Ada.Characters.Handling.To_Lower'Access), 2); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; NT.End_Section (Report); NT.Section (Report, "Function Index, Backward direction"); declare Name : constant String := "Mixed case mapped to lower"; begin Test (Report, Name, Index (To_Chunked_String ("Case of a Mixed Case String"), "case", Ada.Strings.Backward, Map_To_Lower_Case_Ptr), 17); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Mixed case mapped to upper"; begin Test (Report, Name, Index (To_Chunked_String ("Case of a Mixed Case String"), "CASE", Ada.Strings.Backward, Mapping => Map_To_Upper_Case_Ptr), 17); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Upper case mapped to lower"; begin Test (Report, Name, Index (To_Chunked_String ("rain, Rain, and more RAIN"), "rain", Ada.Strings.Backward, Ada.Characters.Handling.To_Lower'Access), 22); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Lower case mapped to upper"; begin Test (Report, Name, Index (To_Chunked_String ("RIGHT place, right time"), "RIGHT", Going => Ada.Strings.Backward, Mapping => Ada.Characters.Handling.To_Upper'Access), 14); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Upper case mapped to lower (no match)"; begin Test (Report, Name, Index (To_Chunked_String ("WOULD MATCH BUT FOR THE CASE"), "WOULD MATCH BUT FOR THE CASE", Going => Ada.Strings.Backward, Mapping => Map_To_Lower_Case_Ptr), 0); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; NT.End_Section (Report); declare Null_String : constant String := ""; TC_Natural : Natural := 1000; begin TC_Natural := Index (To_Chunked_String ("A Valid Chunked String"), Null_String, Going => Ada.Strings.Forward, Mapping => Ada.Characters.Handling.To_Lower'Access); NT.Item (Report, "Pattern_Error raised in Index", NT.Fail); NT.Info (Report, "No exception has been raised."); NT.Info (Report, "Return value: " & Natural'Image (TC_Natural)); exception when Pattern_Error => NT.Item (Report, "Pattern_Error raised in Index", NT.Success); when Error : others => NT.Item (Report, "Pattern_Error raised in Index", NT.Fail); NT.Info (Report, "Wrong exception " & Ada.Exceptions.Exception_Name (Error) & "has been raised."); end; NT.Section (Report, "Function Count with mapping function"); declare Name : constant String := "Upper case mapped to lower"; begin Test (Report, Name, Count (Source => To_Chunked_String ("ABABABA"), Pattern => "aba", Mapping => Map_To_Lower_Case_Ptr), 2); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Upper case mapped to lower (no match)"; begin Test (Report, Name, Count (To_Chunked_String ("ABABABA"), "ABA", Mapping => Map_To_Lower_Case_Ptr), 0); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Mixed case mapped to lower"; begin Test (Report, Name, Count (To_Chunked_String ("This IS a MISmatched issue"), "is", Ada.Characters.Handling.To_Lower'Access), 4); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Upper case mapped to upper"; begin Test (Report, Name, Count (To_Chunked_String ("ABABABA"), "ABA", Map_To_Upper_Case_Ptr), 2); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Upper case mapped to upper (no match)"; begin Test (Report, Name, Count (To_Chunked_String ("This IS a MISmatched issue"), "is", Mapping => Map_To_Upper_Case_Ptr), 0); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Mixed case mapped to lower"; begin Test (Report, Name, Count (To_Chunked_String ("She sells sea shells by the sea shore"), "s", Ada.Characters.Handling.To_Lower'Access), 8); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Empty string"; begin Test (Report, Name, Count (Null_Chunked_String, "match", Map_To_Upper_Case_Ptr), 0); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; NT.End_Section (Report); declare Null_Pattern_String : constant String := ""; TC_Natural : Natural := 1000; begin TC_Natural := Count (To_Chunked_String ("A Valid String"), Null_Pattern_String, Map_To_Lower_Case_Ptr); NT.Item (Report, "Pattern_Error raised in Count", NT.Fail); NT.Info (Report, "No exception has been raised."); NT.Info (Report, "Return value: " & Natural'Image (TC_Natural)); exception when Pattern_Error => NT.Item (Report, "Pattern_Error raised in Count", NT.Success); when Error : others => NT.Item (Report, "Pattern_Error raised in Count", NT.Fail); NT.Info (Report, "Wrong exception " & Ada.Exceptions.Exception_Name (Error) & "has been raised."); end; NT.Section (Report, "Function Translate"); declare Name : constant String := "Mixed case mapped to lower"; begin Test (Report, Name, Translate (Source => To_Chunked_String ("A Sample Mixed Case String"), Mapping => Map_To_Lower_Case_Ptr), "a sample mixed case string"); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Upper case mapped to lower"; begin Test (Report, Name, Translate (To_Chunked_String ("ALL LOWER CASE"), Ada.Characters.Handling.To_Lower'Access), "all lower case"); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Lower case mapped to lower"; begin Test (Report, Name, Translate (To_Chunked_String ("end with lower case"), Map_To_Lower_Case_Ptr), "end with lower case"); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Empty string"; begin Test (Report, Name, Translate (Null_Chunked_String, Ada.Characters.Handling.To_Lower'Access), Null_Chunked_String); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Lower case mapped to upper"; begin Test (Report, Name, Translate (To_Chunked_String ("start with lower case"), Map_To_Upper_Case_Ptr), "START WITH LOWER CASE"); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Upper case mapped to upper"; begin Test (Report, Name, Translate (To_Chunked_String ("ALL UPPER CASE STRING"), Ada.Characters.Handling.To_Upper'Access), "ALL UPPER CASE STRING"); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Mixed case mapped to upper"; begin Test (Report, Name, Translate (To_Chunked_String ("LoTs Of MiXeD CaSe ChArAcTeRs"), Map_To_Upper_Case_Ptr), "LOTS OF MIXED CASE CHARACTERS"); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Diacritics"; begin Test (Report, Name, Translate (New_Character_String, Ada.Characters.Handling.To_Upper'Access), TC_New_Character_String); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; NT.End_Section (Report); NT.Section (Report, "Procedure Translate"); declare use Ada.Characters.Handling; Str_1 : Chunked_String := To_Chunked_String ("AN ALL UPPER CASE STRING"); Str_2 : Chunked_String := To_Chunked_String ("A Mixed Case String"); Str_3 : Chunked_String := To_Chunked_String ("a string with lower case letters"); TC_Str_1 : constant Chunked_String := Str_1; TC_Str_3 : constant Chunked_String := Str_3; begin declare Name : constant String := "Upper case mapped to lower"; begin Translate (Source => Str_1, Mapping => Map_To_Lower_Case_Ptr); Test (Report, Name, Str_1, To_Chunked_String ("an all upper case string")); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Lower case mapped back to upper"; begin Translate (Source => Str_1, Mapping => Map_To_Upper_Case_Ptr); Test (Report, Name, Str_1, TC_Str_1); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Mixed case mapped to lower"; begin Translate (Str_2, Mapping => Map_To_Lower_Case_Ptr); Test (Report, Name, Str_2, To_Chunked_String ("a mixed case string")); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Lower case mapped to upper"; begin Translate (Str_2, Mapping => To_Upper'Access); Test (Report, Name, Str_2, To_Chunked_String ("A MIXED CASE STRING")); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Lower case mapped to lower"; begin Translate (Str_3, To_Lower'Access); Test (Report, Name, Str_3, TC_Str_3); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Lower case mapped to upper"; begin Translate (Str_3, To_Upper'Access); Test (Report, Name, Str_3, To_Chunked_String ("A STRING WITH LOWER CASE LETTERS")); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; declare Name : constant String := "Diacritics"; begin Translate (New_Character_String, Map_To_Upper_Case_Ptr); Test (Report, Name, New_Character_String, TC_New_Character_String); exception when Error : others => NT.Report_Exception (Report, Name, Error); end; end; NT.End_Section (Report); exception when Error : others => NT.Item (Report, "Preparation", NT.Error); NT.Info (Report, "Exception: " & Ada.Exceptions.Exception_Name (Error)); NT.Info (Report, Ada.Exceptions.Exception_Message (Error)); end; NT.End_Section (Report); end Natools.Chunked_Strings.Tests.CXA4030;
package BSSNBase.Data_IO is procedure read_data (file_name : String := "data.txt"); procedure read_grid (file_name : String := "grid.txt"); procedure write_data (file_name : String := "data.txt"); procedure write_grid (file_name : String := "grid.txt"); procedure read_data_fmt (file_name : String := "data.txt"); procedure read_grid_fmt (file_name : String := "grid.txt"); procedure write_data_fmt (file_name : String := "data.txt"); procedure write_grid_fmt (file_name : String := "grid.txt"); end BSSNBase.Data_IO;
-------------------------------------------------------------------------------- -- -- -- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers. -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU Lesser General Public -- -- License as published by the Free Software Foundation; either -- -- version 2.1 of the License, or (at your option) any later version. -- -- -- -- This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- -- Lesser General Public License for more details. -- -- -- -- You should have received a copy of the GNU Lesser General Public -- -- License along with this library; if not, write to the Free Software -- -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- -------------------------------------------------------------------------------- -- @brief System variable related types and methods. -- $Author$ -- $Date$ -- $Revision$ package RASCAL.Variable is type Variable_Type is (GS_String,Number,Macro,Expanded,Literal); -- -- Returns true if the system variable exists. -- function Exists (Name : in String) return Boolean; -- -- Sets the system variable 'Name' to 'New_Value'. -- procedure Set_Value (Name : string; New_Value : string; Var_Type : Variable_Type := Literal); -- -- Unsets (deletes) the variable Name. -- procedure UnSet (Name : string); -- -- Returns the value of the system variable 'Variable'. -- function Get_Value (Variable : in String) return String; -- -- Translates possible system variables etc. in string. -- function Translate (Str : in String) return String; end RASCAL.Variable;
with Ada.Integer_Text_IO, tools; use Ada.Integer_Text_IO, tools; package body Garden_Pkg is package Position_Generator is new Random_Generator(Position); function GetRandPos return Position is begin return Position_Generator.GetRandom; end GetRandPos; function GetField(pos : Position) return Boolean is begin return Fields(pos); end GetField; task body Mantis is pos : Position := GetRandPos; alive : Boolean := true; procedure Jump is begin pos := GetRandPos; Output.Puts("Mantis jumped - pos:" & Position'Image(pos), 1); end Jump; procedure Poisoned is begin alive := false; Output.Puts("Mantis died - pos:" & Position'Image(pos), 1); numberOfMantises := numberOfMantises - 1; end Poisoned; begin Output.Puts("Mantis created - pos:" & Position'Image(pos), 1); while alive and John'Callable loop if GetField(pos) = true then Poisoned; else Jump; if GetField(pos) = true then Poisoned; end if; end if; delay 0.1; end loop; end Mantis; task body Gardener is pos : Position := GetRandPos; procedure SprayField is begin Fields(pos) := true; Output.Puts("Gardener sprayed - pos:" & Position'Image(pos), 1); end SprayField; procedure SprayAbsorbed is begin for i in Position'Range loop Fields(i) := false; end loop; Output.Puts("Spray absorbed", 1); end SprayAbsorbed; begin Output.Puts("Gardener created - pos:" & Position'Image(pos), 1); while numberOfMantises > 0 loop pos := GetRandPos; SprayField; delay 0.2; SprayAbsorbed; end loop; end Gardener; procedure Start is numberOfLarvae : Natural; begin Output.Puts("Number of mantise larvae:", 0); Get(numberOfLarvae); numberOfMantises := numberOfLarvae + 1; declare mantises : Mantis_Array(1 .. numberOfMantises); procedure createMantises is begin for i in 1 .. numberOfMantises loop mantises(i) := new Mantis; end loop; end createMantises; procedure createFields is begin for i in Position'Range loop Fields(i) := false; end loop; end createFields; begin John := new Gardener; createFields; createMantises; end; end Start; end Garden_Pkg;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Finalization; with Adabots_Lua_Dispatcher; package Adabots is type Turtle is new Ada.Finalization.Limited_Controlled with private; type Turtle_Inventory_Slot is range 1 .. 16; type Stack_Count is range 0 .. 64; type Item_Detail is record Count : Stack_Count; Name : Ada.Strings.Unbounded.Unbounded_String; end record; function Create_Turtle return Turtle; function Create_Turtle (Port : Integer) return Turtle; -- Movement procedure Turn_Right (T : Turtle); procedure Turn_Left (T : Turtle); function Forward (T : Turtle) return Boolean; function Back (T : Turtle) return Boolean; function Up (T : Turtle) return Boolean; function Down (T : Turtle) return Boolean; -- Digging function Dig_Down (T : Turtle) return Boolean; function Dig_Up (T : Turtle) return Boolean; function Dig (T : Turtle) return Boolean; -- Placing function Place (T : Turtle) return Boolean; function Place_Down (T : Turtle) return Boolean; function Place_Up (T : Turtle) return Boolean; -- Inventory management procedure Select_Slot (T : Turtle; Slot : Turtle_Inventory_Slot); function Get_Item_Count (T : Turtle; Slot : Turtle_Inventory_Slot) return Stack_Count; function Get_Selected_Slot (T : Turtle) return Turtle_Inventory_Slot; -- TODO really implement these two: function Get_Item_Detail (T : Turtle) return Item_Detail; function Get_Item_Detail (T : Turtle; Slot : Turtle_Inventory_Slot) return Item_Detail; -- https://tweaked.cc/module/turtle.html#v:drop function Drop (T : Turtle; Amount : Stack_Count := 64) return Boolean; -- function DropUp (T : Turtle; Amount : Stack_Count := 64) return Boolean; -- function DropDown (T : Turtle; Amount : Stack_Count := 64) return Boolean; function Detect (T : Turtle) return Boolean; function Detect_Down (T : Turtle) return Boolean; function Detect_Up (T : Turtle) return Boolean; -- these procedures assert that the function of the same name returned true procedure Forward (T : Turtle); procedure Back (T : Turtle); procedure Up (T : Turtle); procedure Down (T : Turtle); procedure Dig_Down (T : Turtle); procedure Dig_Up (T : Turtle); procedure Dig (T : Turtle); procedure Place (T : Turtle); procedure Place_Down (T : Turtle); procedure Place_Up (T : Turtle); procedure Drop (T : Turtle; Amount : Stack_Count := 64); -- these procedures don't care what the result is procedure Maybe_Dig_Down (T : Turtle); procedure Maybe_Dig_Up (T : Turtle); procedure Maybe_Dig (T : Turtle); procedure Maybe_Place (T : Turtle); procedure Maybe_Place_Down (T : Turtle); procedure Maybe_Place_Up (T : Turtle); type Command_Computer is new Ada.Finalization.Limited_Controlled with private; function Create_Command_Computer return Command_Computer; function Create_Command_Computer (Port : Integer) return Command_Computer; type Material is (Grass, Planks, Air, Glass, Ice, Gold_Block, Sand, Bedrock, Stone); type Relative_Location is record X_Offset : Integer := 0; Y_Offset : Integer := 0; Z_Offset : Integer := 0; end record; function Image (P : Relative_Location) return String is (P.X_Offset'Image & ", " & P.Y_Offset'Image & ", " & P.Z_Offset'Image); function "+" (A, B : Relative_Location) return Relative_Location; function "-" (A, B : Relative_Location) return Relative_Location; type Absolute_Location is record X : Integer := 0; Y : Integer := 0; Z : Integer := 0; end record; function "+" (A, B : Absolute_Location) return Absolute_Location; function "+" (A : Absolute_Location; B : Relative_Location) return Absolute_Location; function Set_Block (C : Command_Computer; L : Relative_Location; B : Material) return Boolean; procedure Maybe_Set_Block (C : Command_Computer; L : Relative_Location; B : Material); procedure Set_Cube (C : Command_Computer; First : Relative_Location; Last : Relative_Location; B : Material); function Get_Block_Info (C : Command_Computer; L : Absolute_Location) return Material; private type Turtle is new Ada.Finalization.Limited_Controlled with record Dispatcher : Adabots_Lua_Dispatcher.Lua_Dispatcher; end record; function Parse_Item_Details (Table : String) return Item_Detail; type Command_Computer is new Ada.Finalization.Limited_Controlled with record Dispatcher : Adabots_Lua_Dispatcher.Lua_Dispatcher; end record; end Adabots;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Containers.Indefinite_Vectors; use Ada.Containers; -- XML includes libraries with Input_Sources.File; use Input_Sources.File; with Sax.Readers; use Sax.Readers; with DOM.Readers; use DOM.Readers; with DOM.Core; use DOM.Core; with DOM.Core.Documents; use DOM.Core.Documents; with DOM.Core.Nodes; use DOM.Core.Nodes; with DOM.Core.Attrs; use DOM.Core.Attrs; package Parser_Xml is -- Simple vector of Strings package String_Vector is new Indefinite_Vectors (Natural, String); function Extract_Nodes (File_Name : String; Parent_Name : String) return Unbounded_String; function Get_Xml_Tree_From_File (File_Name : String; Description : String) return Document; function Get_Nodes_Value_From_Xml_Tree (Xml_Tree : Document; Value_Description : String) return String_Vector.Vector; end Parser_Xml;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . T H R E A D S -- -- -- -- S p e c -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2005 The European Space Agency -- -- Copyright (C) 2003-2016, AdaCore -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- -- The port of GNARL to bare board targets was initially developed by the -- -- Real-Time Systems Group at the Technical University of Madrid. -- -- -- ------------------------------------------------------------------------------ -- Package that implements basic tasking functionalities pragma Restrictions (No_Elaboration_Code); with System; with System.Storage_Elements; with System.BB.CPU_Primitives; with System.BB.Time; with System.BB.Interrupts; with System.Multiprocessors; with System.BB.CPU_Primitives.Multiprocessors; package System.BB.Threads is pragma Preelaborate; use type System.Multiprocessors.CPU; -------------------------- -- Basic thread support -- -------------------------- Initialized : Boolean := False; -- Boolean that indicates whether the tasking executive has finished its -- initialization. type Thread_Descriptor; -- This type contains the information about a thread type Thread_Id is access all Thread_Descriptor; -- Type used as thread identifier Null_Thread_Id : constant Thread_Id := null; -- Identifier used to define an invalid value for a thread identifier type Thread_States is (Runnable, Suspended, Delayed); -- These are the three possible states for a thread under the Ravenscar -- profile restrictions: Runnable (not blocked, and it may also be -- executing), Suspended (waiting on an entry call), and Delayed (waiting -- on a delay until statement). type Thread_Descriptor is record Context : aliased System.BB.CPU_Primitives.Context_Buffer; -- Location where the hardware registers (stack pointer, program -- counter, ...) are stored. This field supports context switches among -- threads. -- It is important that the Context field is placed at the beginning of -- the record, because this assumption is using for implementing context -- switching. Take into account the alignment (8 bytes, 64 bits) to -- compute the required size. ATCB : System.Address; -- Address of the Ada Task Control Block corresponding to the Ada task -- that executes on this thread. Base_CPU : System.Multiprocessors.CPU_Range; -- CPU affinity of the thread Base_Priority : Integer; -- Base priority of the thread Active_Priority : Integer; pragma Volatile (Active_Priority); -- Active priority that differs from the base priority due to dynamic -- priority changes required by the Ceiling Priority Protocol. -- This field is marked as Volatile for a fast implementation -- of Get_Priority. Top_Of_Stack : System.Address; -- Address of the top of the stack that is used by the thread Bottom_Of_Stack : System.Address; -- Address of the bottom of the stack that is used by the thread Next : Thread_Id; -- Points to the ready thread that is in the next position for -- execution. Alarm_Time : System.BB.Time.Time; -- Time (absolute) when the alarm for this thread expires Next_Alarm : Thread_Id; -- Next thread in the alarm queue. The queue is ordered by expiration -- times. The first place is occupied by the thread which must be -- first awaken. State : Thread_States; -- Encodes some basic information about the state of a thread In_Interrupt : Boolean; pragma Volatile (In_Interrupt); -- True iff this task has been interrupted, and an interrupt handler -- is being executed. Wakeup_Signaled : Boolean; -- Variable which reflects whether another thread has performed a -- Wakeup operation on the thread. It may happen when a task is about -- to suspend itself, but it is preempted just before by the task that -- is going to awake it. Global_List : Thread_Id; -- Next thread in the global list. The queue is ordered by creation -- time. The first place is occupied by the environment thread, and -- it links all threads in the system. Execution_Time : System.BB.Time.Composite_Execution_Time; -- CPU time spent for this thread end record; function Get_Affinity (Thread : Thread_Id) return System.Multiprocessors.CPU_Range with -- Return CPU affinity of the given thread (maybe Not_A_Specific_CPU) Pre => Thread /= Null_Thread_Id, Inline => True; function Get_CPU (Thread : Thread_Id) return System.Multiprocessors.CPU with -- Return the CPU in charge of the given thread (always a valid CPU) Pre => Thread /= Null_Thread_Id, Inline => True; procedure Initialize (Environment_Thread : Thread_Id; Main_Priority : System.Any_Priority) with -- Procedure to initialize the board and the data structures related to the -- low level tasking system. This procedure must be called before any other -- tasking operation. The operations to perform are: -- - Hardware initialization -- * Any board-specific initialization -- * Interrupts -- * Timer -- - Initialize stacks for main procedures to be executed on slave CPUs -- - Initialize the thread descriptor for the environment task -- * Set base CPU for the environment task to the one on which this -- initialization code executes -- * Set the base and active priority of the environment task -- * Store the boundaries of the stack for the environment task -- * Initialize the register context -- - Initialize the global queues -- * Set the environment task as first (and only at this moment) in -- the ready queue -- * Set the environment task as first (and only at this moment) in -- the global list of tasks -- * Set the environment task as the currently executing task -- - Initialize the floating point unit -- - Signal the flag corresponding to the initialization Pre => -- This procedure must be called by the master CPU CPU_Primitives.Multiprocessors.Current_CPU = Multiprocessors.CPU'First -- Initialization can only happen once and then not Initialized; procedure Initialize_Slave (Idle_Thread : Thread_Id; Idle_Priority : Integer; Stack_Address : System.Address; Stack_Size : System.Storage_Elements.Storage_Offset) with -- Procedure to initialize the idle thread on a slave CPU. -- This thread is used to handle interrupt if the CPU doesn't have any -- other task. The initialization for the main CPU must have been -- performed. The operations to perform are: -- - Initialize the thread descriptor -- * Set base CPU to the one on which this code executes -- * Set the base and active priority -- * Store the boundaries of the stack -- * Initialize the register context -- - Initialize the global queues -- * Set the task as the currently executing task in this processor. Pre => -- It must happen after the initialization of the master CPU Initialized; procedure Thread_Create (Id : Thread_Id; Code : System.Address; Arg : System.Address; Priority : Integer; Base_CPU : System.Multiprocessors.CPU_Range; Stack_Address : System.Address; Stack_Size : System.Storage_Elements.Storage_Offset) with -- Create a new thread -- -- The new thread executes the code at address Code and using Args as -- argument. Priority is the base priority of the new thread. The new -- thread is provided with a stack of size Stack_Size that has been -- preallocated at Stack_Address. -- -- A procedure to destroy threads is not available because that is not -- allowed by the Ravenscar profile. Pre => Initialized; function Thread_Self return Thread_Id with -- Return the thread identifier of the calling thread Post => Thread_Self'Result /= Null_Thread_Id, Inline => True; ---------------- -- Scheduling -- ---------------- procedure Set_Priority (Priority : Integer); pragma Inline (Set_Priority); -- Set the active priority of the executing thread to the given value function Get_Priority (Id : Thread_Id) return Integer with -- Get the current active priority of any thread Pre => Id /= Null_Thread_Id, Inline => True; procedure Sleep; -- The calling thread is unconditionally suspended. In the case when there -- is a request to wakeup the caller just before the state changed to -- Suspended then the situation is signaled with the flag Wakeup_Signaled, -- and the call to Sleep consumes this token and the state remains -- Runnable. procedure Wakeup (Id : Thread_Id) with -- Thread Id becomes ready (the thread must be previously suspended). In -- the case when there is a request to wakeup the caller just before the -- state changed to Suspended then the situation is signaled with the -- flag Wakeup_Signaled (the state remains unchanged in this case). Pre => Id /= Null_Thread_Id -- We can only wakeup a task that is already suspended or about to be -- suspended (and hence still runnable). and then Id.all.State in Suspended | Runnable -- Any wakeup previously signaled must have been consumed and then not Id.all.Wakeup_Signaled; ---------- -- ATCB -- ---------- procedure Set_ATCB (Id : Thread_Id; ATCB : System.Address); pragma Inline (Set_ATCB); -- This procedure sets the ATCB passed as argument for the thread ID function Get_ATCB return System.Address; pragma Inline (Get_ATCB); -- Returns the ATCB of the currently executing thread end System.BB.Threads;
-- CB4008A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK THAT NESTED LAST WISHES EXCEPTION HANDLERS WORK -- (FOR PROCEDURES). -- DAT 4/15/81 -- SPS 3/28/83 WITH REPORT; USE REPORT; PROCEDURE CB4008A IS C : INTEGER := 0; E : EXCEPTION; DEPTH : CONSTANT := 99; PROCEDURE F; PROCEDURE I IS BEGIN C := C + 1; IF C >= DEPTH THEN RAISE E; END IF; END I; PROCEDURE O IS BEGIN C := C - 1; END O; PROCEDURE X IS PROCEDURE X1 IS PROCEDURE X2 IS BEGIN F; END X2; PROCEDURE X3 IS BEGIN I; X2; EXCEPTION WHEN E => O; RAISE; END X3; BEGIN I; X3; EXCEPTION WHEN E => O; RAISE; END X1; PROCEDURE X1A IS BEGIN I; X1; FAILED ("INCORRECT EXECUTION SEQUENCE"); EXCEPTION WHEN E => O; RAISE; END X1A; BEGIN I; X1A; EXCEPTION WHEN E => O; RAISE; END X; PROCEDURE Y IS BEGIN I; X; EXCEPTION WHEN E => O; RAISE; END Y; PROCEDURE F IS PROCEDURE F2; PROCEDURE F1 IS BEGIN I; F2; EXCEPTION WHEN E => O; RAISE; END F1; PROCEDURE F2 IS BEGIN I; Y; EXCEPTION WHEN E => O; RAISE; END F2; BEGIN I; F1; EXCEPTION WHEN E => O; RAISE; END F; BEGIN TEST ("CB4008A", "(PROCEDURE) LAST WISHES UNWIND PROPERLY"); BEGIN I; Y; FAILED ("INCORRECT EXECUTION SEQUENCE 2"); EXCEPTION WHEN E => O; IF C /= 0 THEN FAILED ("EXCEPTION HANDLER MISSED SOMEWHERE"); END IF; END; RESULT; END CB4008A;
#ifndef __OCARINA_GENERATED_MARSHALLERS_H_ #define __OCARINA_GENERATED_MARSHALLERS_H_ /*****************************************************/ /* This file was automatically generated by Ocarina */ /* Do NOT hand-modify this file, as your */ /* changes will be lost when you re-run Ocarina */ /*****************************************************/ #endif
-- $Id: Sort.md,v 1.0 1992/08/07 14:42:01 grosch rel $ -- $Log: Sort.md,v $ -- Ich, Doktor Josef Grosch, Informatiker, Aug. 1994 generic with function IsLess (X, Y: Integer) return Boolean; with procedure Swap (X, Y: Integer); package Sort is procedure QuickSort (Lwb, Upb: Integer); -- Sort data from the indices 'Lwb' to 'Upb' using quicksort. end Sort;
package Warn10_Pkg is Size : constant Natural := 100; type My_Array is array(1..Size, 1..Size) of Float; type Root is tagged record Input_Values : My_Array; end record; function Get_Input_Value( Driver : Root; I, J : Natural) return Float; end Warn10_Pkg;
with ada.unchecked_Deallocation; package body XML.Writer is Depth: Natural; procedure Free is new ada.Unchecked_Deallocation (Attributes_t, Attributes_view); procedure Start_Document (F: in ada.Text_IO.File_Type) is begin ada.Text_IO.Put_Line (F, "<?xml version=""1.0"" standalone=""yes""?>"); Depth := 0; end Start_Document; procedure End_Document (F: in ada.Text_IO.File_Type) is begin null; end End_Document; procedure Start (F: in ada.Text_IO.File_Type; Name: in String; Atts: in Attributes_view) is begin for Pad in 1 .. Depth loop ada.Text_IO.Put (F, " "); end loop; Depth := Depth + 1; ada.Text_IO.Put (F, "<" & Name); for Att in Atts'Range loop ada.Text_IO.Put (F, " " & to_String (Atts (Att).Name) & "=""" & to_String (Atts (Att).Value) & """"); end loop; ada.Text_IO.Put_Line (F, ">"); end Start; procedure Start (F: in ada.Text_IO.File_Type; Name: in unbounded_String; Atts: in Attributes_view) is begin Start (F, to_String (Name), Atts); end Start; procedure Finish (F: in ada.Text_IO.File_Type; Name: in String) is begin Depth := Depth - 1; for Pad in 1 .. Depth loop ada.Text_IO.Put (F, " "); end loop; ada.Text_IO.Put_Line (F, "</" & Name & ">"); end Finish; procedure Finish (F: in ada.Text_IO.File_Type; Name: in unbounded_String) is begin Finish (F, to_String (Name)); end Finish; procedure Empty (F: in ada.Text_IO.File_Type; Name: in String; Atts: in Attributes_view) is begin for Pad in 1 .. Depth loop ada.Text_IO.Put (F, " "); end loop; ada.Text_IO.Put (F, "<" & Name); for Att in Atts'Range loop ada.Text_IO.Put (F, " " & to_String (Atts (Att).Name) & "=""" & to_String (Atts (Att).Value) & """"); end loop; ada.Text_IO.Put_Line (F, "/>"); end Empty; procedure Empty (F: in ada.Text_IO.File_Type; Name: in unbounded_String; Atts: in Attributes_view) is begin Empty (F, to_String (Name), Atts); end Empty; function "+" (K, V: in String) return Attribute_t is begin return Attribute_t'(to_unbounded_String (K), to_unbounded_String (V)); end "+"; function "+" (K, V: in String) return Attributes_view is begin return new Attributes_t'(1 => Attribute_t'(to_unbounded_String (K), to_unbounded_String (V))); end "+"; function "+" (K: in unbounded_String; V: in String) return Attribute_t is begin return Attribute_t'(K, to_unbounded_String (V)); end "+"; function "+" (K: in unbounded_String; V: in String) return Attributes_view is begin return new Attributes_t'(1 => Attribute_t' (K, to_unbounded_String (V))); end "+"; function "+" (K: in String; V: in unbounded_String) return Attribute_t is begin return Attribute_t'(to_unbounded_String (K), V); end "+"; function "+" (K: in String; V: in unbounded_String) return Attributes_view is begin return new Attributes_t'(1 => Attribute_t'(to_unbounded_String (K), V)); end "+"; function MkAtt (L, R: in Attribute_t) return Attributes_view is begin return new Attributes_t'(L, R); end MkAtt; function "&" (L, R: in Attribute_t) return Attributes_view is begin return new Attributes_t'(L, R); end "&"; function "&" (L: in Attributes_view; R: in Attribute_t) return Attributes_view is Result: Attributes_view; ByeBye: Attributes_view; begin Result := new Attributes_t (1 .. L'Length + 1); Result (1 .. L'Length) := L.all; Result (L'Length + 1) := R; ByeBye := L; Free (ByeBye); return Result; end "&"; end XML.Writer;
-- { dg-do run } procedure Boolean_Expr2 is function Ident_Bool (B : Boolean) return Boolean is begin return B; end; begin if Boolean'Succ (Ident_Bool(False)) /= True then raise Program_Error; end if; if Boolean'Pred (Ident_Bool(True)) /= False then raise Program_Error; end if; end;
with opengl.surface_Profile.privvy, opengl.Display .privvy, eGL.Binding, interfaces.c.Strings, System; package body opengl.Surface is use eGL.Binding; -- Forge -- procedure define (Self : in out Item; surface_Profile : in opengl.surface_Profile.item'Class; Display : in opengl.Display.Item; Window_Id : in Natural) is use opengl.Display .privvy, opengl.surface_Profile.privvy, System; begin Self.egl_Surface := eglCreateWindowSurface (to_eGL (Display), to_eGL (surface_Profile), egl.NativeWindowType (Window_Id), null); -- const EGLint *attribList); if self.egl_Surface = EGL_NO_SURFACE then raise opengl.Error with "unable to create an EGL surface for a window"; end if; Self.Display := Display; end define; -- Operations -- procedure swap_Buffers (Self : in Item) is use openGL.Display.privvy, eGL; use type EGLBoolean; Success : egl.EGLBoolean; begin Success := eglSwapBuffers (to_eGL (Self.Display), Self.egl_Surface); if Success = EGL_FALSE then raise opengl.Error with "unable to swap egl buffers"; end if; end; end opengl.Surface;
-- { dg-do compile } with Discr23_Pkg; use Discr23_Pkg; package body Discr23 is N : constant Text := Get; function Try (A : in Text) return Text is begin return A; exception when others => return N; end; procedure Dummy is begin null; end; end Discr23;
------------------------------------------------------------------------------ -- Copyright (c) 2017, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Natools.Smaz_64; with Lithium.Comment_Cookie_Smaz_Hash; package body Lithium.Comment_Cookie_Smaz is package Sx renames Natools.S_Expressions; Dict : constant Natools.Smaz_64.Dictionary := (Last_Code => 60, Values_Last => 130, Variable_Length_Verbatim => False, Max_Word_Length => 17, Offsets => (16, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 57, 58, 60, 62, 64, 65, 66, 67, 68, 70, 71, 73, 75, 77, 80, 84, 88, 93, 96, 99, 100, 102, 104, 106, 108, 109, 111, 113, 114, 117, 118, 119, 121, 122, 124, 126, 128, 130), Values => "legacy-comment comment-markdown eoatmcn rlghsi.omp-u/comy" & "enleacf""@dmabfrroou://httpbloggmailwww.frkinrior ""zonanwnetx" & "jreveecheris_", Hash => Lithium.Comment_Cookie_Smaz_Hash.Hash'Access); function Encoder (Data : in Natools.S_Expressions.Atom) return String is begin return Key & Sx.To_String (Natools.Smaz_64.Compress (Dict, Sx.To_String (Data))); end Encoder; function Decoder (Data : in String) return Natools.S_Expressions.Atom is begin if Data'Length > 0 then return Sx.To_Atom (Natools.Smaz_64.Decompress (Dict, Sx.To_Atom (Data (Data'First + 1 .. Data'Last)))); else return Sx.Null_Atom; end if; end Decoder; end Lithium.Comment_Cookie_Smaz;
pragma Warnings (Off); pragma Style_Checks (Off); ------------------------------------------------------------------------- -- GLOBE_3D.Collision_detection -- -- Copyright (c) Gautier de Montmollin 1999 .. 2008 -- SWITZERLAND -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- NB : this is the MIT License, as found 12 - Sep - 2007 on the site -- http://www.opensource.org/licenses/mit - license.php ------------------------------------------------------------------------- -- Change log -- -- 21 - May - 2008 : GM : slide mode working, by adding dist_before > 0.0 -- 14 - May - 2008 : GM : package created (re - used most of old Engine_3D) package GLOBE_3D.Collision_detection is -- Reaction to an object - and the world connected to it type Reaction_method is (elastic, slide); type Ball_type is record centre : Point_3D; radius : Real; end record; -- Collision between a ball, intending to do a step (vector), against -- an object o. If there is a collision, step is reduced in length and -- may change direction. -- Typically, the ball's centre is the camera position and step is the camera's -- move between two images. But the ball can be the abstraction of any moving -- object, actor, .. . procedure Reaction ( o : Object_3D'Class; ball : Ball_type; method : Reaction_method; step : in out Vector_3D; -- Whole step (in : desired, out : effective) reacted : out Real -- reaction in proportion to step; in [0, 1] ); -- Unsupported : exception; -- something not yet implemented Zero_normal, Not_one_normal : exception; -- only occur when body's check_normals = True, -- and also when normals are wrong, of course .. . end GLOBE_3D.Collision_detection;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- SQL Database Access -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2014, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with Ada.Numerics.Discrete_Random; with Matreshka.Internals.SQL_Drivers.Firebird.Fields; with Matreshka.Internals.SQL_Parameter_Rewriters.Firebird; package body Matreshka.Internals.SQL_Drivers.Firebird.Queries is SQL_Dialect : constant Isc_Db_Dialect := 3; Rewriter : SQL_Parameter_Rewriters.Firebird.Firebird_Parameter_Rewriter; function Random_String (Length : Interfaces.C.size_t) return Isc_String; ---------------- -- Bind_Value -- ---------------- overriding procedure Bind_Value (Self : not null access Firebird_Query; Name : League.Strings.Universal_String; Value : League.Holders.Holder; Direction : SQL.Parameter_Directions) is pragma Unreferenced (Direction); begin Self.Parameters.Set_Value (Name, Value); end Bind_Value; ----------------- -- Bound_Value -- ----------------- overriding function Bound_Value (Self : not null access Firebird_Query; Name : League.Strings.Universal_String) return League.Holders.Holder is pragma Unreferenced (Self); pragma Unreferenced (Name); begin return League.Holders.Empty_Holder; end Bound_Value; ------------------- -- Error_Message -- ------------------- overriding function Error_Message (Self : not null access Firebird_Query) return League.Strings.Universal_String is begin return Self.Error; end Error_Message; ------------- -- Execute -- ------------- overriding function Execute (Self : not null access Firebird_Query) return Boolean is Value : League.Holders.Holder; Result : Isc_Result_Code; begin -- Prepare parameter values. for Idx in 1 .. Self.Parameters.Number_Of_Positional loop Value := Self.Parameters.Value (Idx); Self.Sql_Params.Fields.Element (Isc_Valid_Field_Index (Idx)).Value (Value); end loop; Self.Sql_Record.Clear_Values; if Self.Sql_Type = DDL then return Self.Execute_Immediate; end if; case Self.Sql_Type is when Simple_Select | Select_For_Update => Result := Isc_Dsql_Execute (Self.Status'Access, Databases.Firebird_Database'Class (Self.Database.all).Transaction_Handle, Self.Stmt_Handle'Access, Sql_Dialect, Self.Sql_Params.Sqlda); if Result > 0 then Self.Error := Get_Error (Self.Status'Access); return False; end if; Self.State := Active; Self.Sql_Record.Clear_Values; when Exec_Procedure => Result := Isc_Dsql_Execute2 (Self.Status'Access, Databases.Firebird_Database'Class (Self.Database.all).Transaction_Handle, Self.Stmt_Handle'Access, Sql_Dialect, Self.Sql_Params.Sqlda, Self.Sql_Record.Sqlda); if Self.Status (1) = 1 and then Self.Status (2) > 0 then Self.Error := Get_Error (Self.Status'Access); return False; end if; when Commit | Rollback => return False; when Unknown | Insert | Update | Delete | DDL | Get_Segment | Put_Segment | Start_Transaction | Set_Generator | Save_Point_Operation => Result := Isc_Dsql_Execute (Self.Status'Access, Databases.Firebird_Database'Class (Self.Database.all).Transaction_Handle, Self.Stmt_Handle'Access, Sql_Dialect, Self.Sql_Params.Sqlda); if Result > 0 then Self.Error := Get_Error (Self.Status'Access); return False; end if; end case; Self.Is_Valid := False; return True; exception when others => Self.Free_Handle; return False; end Execute; ----------------------- -- Execute_Immediate -- ----------------------- function Execute_Immediate (Self : not null access Firebird_Query) return Boolean is Result : Isc_Result_Code; begin Self.Free_Handle; declare Statement : constant Isc_String := To_Isc_String (Self.Sql_Text); begin Result := Isc_Dsql_Execute_Immediate (Self.Status'Access, Databases.Firebird_Database'Class (Self.Database.all).Database_Handle, Databases.Firebird_Database'Class (Self.Database.all).Transaction_Handle, Statement'Length, Statement, Sql_Dialect, Self.Sql_Params.Sqlda); end; if Result > 0 then Self.Error := Get_Error (Self.Status'Access); return False; end if; return True; end Execute_Immediate; ------------ -- Finish -- ------------ overriding procedure Finish (Self : not null access Firebird_Query) is use type Isc_Long; EC : constant Isc_Result_Codes (1 .. 2) := (Isc_Bad_Stmt_Handle, Isc_Dsql_Cursor_Close_Err); Result : Isc_Result_Code; pragma Warnings (Off, Result); begin if Self.Stmt_Handle /= Null_Isc_Stmt_Handle then case Self.Sql_Type is when Simple_Select | Select_For_Update => Result := Isc_Dsql_Free_Statement (Self.Status'Access, Self.Stmt_Handle'Access, Isc_Sql_Close); if Self.Status (1) = 1 and then Self.Status (2) > 0 and then not Check_For_Error (Self.Status'Access, EC) then Self.Error := Get_Error (Self.Status'Access); end if; when others => Self.Free_Handle; end case; end if; Self.State := Inactive; end Finish; ----------------- -- Free_Handle -- ----------------- procedure Free_Handle (Self : not null access Firebird_Query) is use type Isc_Long; Result : Isc_Result_Code; begin Self.Sql_Record.Count (0); if Self.Stmt_Handle /= Null_Isc_Stmt_Handle then Result := Isc_Dsql_Free_Statement (Self.Status'Access, Self.Stmt_Handle'Access, Isc_Sql_Drop); Self.Stmt_Handle := Null_Isc_Stmt_Handle; Self.State := Inactive; if Self.Status (1) = 1 and then Result > 0 and then Result /= Isc_Bad_Stmt_Handle then Self.Error := Get_Error (Self.Status'Access); end if; end if; end Free_Handle; ---------------- -- Initialize -- ---------------- procedure Initialize (Self : not null access Firebird_Query'Class; Database : not null access Databases.Firebird_Database'Class; Codec : access League.Text_Codecs.Text_Codec; Utf : Boolean) is begin Self.Sql_Record.Codec := Codec; Self.Sql_Params.Codec := Codec; Self.Sql_Record.Utf := Utf; Self.Sql_Params.Utf := Utf; Self.Is_Valid := False; SQL_Drivers.Initialize (Self, Database_Access (Database)); end Initialize; ---------------- -- Invalidate -- ---------------- overriding procedure Invalidate (Self : not null access Firebird_Query) is begin Self.Finish; if Self.Stmt_Handle /= Null_Isc_Stmt_Handle then Self.Free_Handle; end if; Self.Sql_Params.Finalize; Self.Sql_Record.Finalize; -- Call Invalidate of parent tagged type. Abstract_Query (Self.all).Invalidate; end Invalidate; --------------- -- Is_Active -- --------------- overriding function Is_Active (Self : not null access Firebird_Query) return Boolean is begin return Self.State = Active; end Is_Active; -------------- -- Is_Valid -- -------------- overriding function Is_Valid (Self : not null access Firebird_Query) return Boolean is begin return Self.Is_Valid; end Is_Valid; ---------- -- Next -- ---------- overriding function Next (Self : not null access Firebird_Query) return Boolean is use type Isc_Long; Result : Isc_Result_Code; begin Result := Isc_Dsql_Fetch (Self.Status'Access, Self.Stmt_Handle'Access, Sql_Dialect, Self.Sql_Record.Sqlda); if Result > 0 then if Result = 100 then Self.Is_Valid := False; return False; else declare EC : constant Isc_Result_Codes (1 .. 1) := (others => Isc_Dsql_Cursor_Err); begin if Check_For_Error (Self.Status'Access, EC) then Self.Is_Valid := False; return False; else Self.Error := Get_Error (Self.Status'Access); Self.Finish; Self.Is_Valid := False; return False; end if; end; end if; else Self.Is_Valid := True; return True; end if; end Next; ------------- -- Prepare -- ------------- overriding function Prepare (Self : not null access Firebird_Query; Query : League.Strings.Universal_String) return Boolean is use type Records.Isc_Sqlda_Access; Result : Isc_Result_Code; Field : Fields.Field_Access; begin Self.Finish; Rewriter.Rewrite (Query, Self.Sql_Text, Self.Parameters); Self.Sql_Params.Count (Isc_Field_Index (Self.Parameters.Number_Of_Positional)); -- add params for Idx in 1 .. Isc_Field_Index (Self.Parameters.Number_Of_Positional) loop Field := Self.Sql_Params.Fields.Element (Idx); Field.Set_Null (True); Field.Sqlvar.Sqltype := Isc_Type_Empty; end loop; Result := Isc_Dsql_Alloc_Statement2 (Self.Status'Access, Databases.Firebird_Database'Class (Self.Database.all).Database_Handle, Self.Stmt_Handle'Access); if Result > 0 then Self.Error := Get_Error (Self.Status'Access); return False; end if; Self.Sql_Record.Count (1); declare Statement : constant Isc_String := To_Isc_String (Self.Sql_Text); begin Result := Isc_Dsql_Prepare (Self.Status'Access, Databases.Firebird_Database'Class (Self.Database.all).Transaction_Handle, Self.Stmt_Handle'Access, 0, Statement, Sql_Dialect, Self.Sql_Record.Sqlda); if Result > 0 then Self.Error := Get_Error (Self.Status'Access); return False; end if; end; -- Get the type of the statement declare use type Interfaces.C.char; Len : Isc_Long; Buffer : aliased Isc_String := (1 .. 9 => Interfaces.C.nul); Item : Isc_String (1 .. 1); begin Item (1) := Isc_Info_Sql_Stmt_Type; Result := Isc_Dsql_Sql_Info (Self.Status'Access, Self.Stmt_Handle'Access, 1, Item, 8, Buffer'Access); if Result > 0 then Self.Error := Get_Error (Self.Status'Access); return False; end if; if Buffer (1) /= Isc_Info_Sql_Stmt_Type then return False; end if; Len := Isc_Vax_Integer (Buffer (2 .. 4), 2); Self.Sql_Type := Query_Sql_Type'Val (Isc_Vax_Integer (Buffer (4 .. 9), Isc_Short (Len))); end; if Self.Sql_Type = Select_For_Update then Self.Cursor_Name := Random_String (10); Result := Isc_Dsql_Set_Cursor_Name (Self.Status'Access, Self.Stmt_Handle'Access, Self.Cursor_Name, 0); if Result > 0 then Self.Error := Get_Error (Self.Status'Access); return False; end if; end if; -- Done getting the type case Self.Sql_Type is when Get_Segment | Put_Segment | Start_Transaction => Self.Free_Handle; return False; when Insert | Update | Delete | Simple_Select | Select_For_Update | Exec_Procedure => if Self.Sql_Params.Sqlda /= null then Result := Isc_Dsql_Describe_Bind (Self.Status'Access, Self.Stmt_Handle'Access, Sql_Dialect, Self.Sql_Params.Sqlda); if Result > 0 then Self.Error := Get_Error (Self.Status'Access); return False; end if; end if; Self.Sql_Params.Init; case Self.Sql_Type is when Simple_Select | Select_For_Update | Exec_Procedure => if Self.Sql_Record.Sqlda.Sqld > Self.Sql_Record.Sqlda.Sqln then Self.Sql_Record.Count (Self.Sql_Record.Sqlda.Sqld); Result := Isc_Dsql_Describe (Self.Status'Access, Self.Stmt_Handle'Access, Sql_Dialect, Self.Sql_Record.Sqlda); if Result > 0 then Self.Error := Get_Error (Self.Status'Access); return False; end if; else if Self.Sql_Record.Sqlda.Sqld = 0 then Self.Sql_Record.Count (0); end if; end if; Self.Sql_Record.Init; when Unknown | Insert | Update | Delete | DDL | Get_Segment | Put_Segment | Start_Transaction | Commit | Rollback | Set_Generator | Save_Point_Operation => Self.Sql_Record.Count (0); end case; when Unknown | DDL | Commit | Rollback | Set_Generator | Save_Point_Operation => null; end case; return True; exception when others => if Self.Stmt_Handle /= Null_Isc_Stmt_Handle then Self.Free_Handle; end if; return False; end Prepare; ------------------- -- Random_String -- ------------------- function Random_String (Length : Interfaces.C.size_t) return Isc_String is use type Interfaces.C.size_t; use type Interfaces.C.char; subtype A_Z is Interfaces.C.char range '0' .. 'z'; package Rand is new Ada.Numerics.Discrete_Random (A_Z); Gen : Rand.Generator; Str : Isc_String (1 .. Length); Char : Interfaces.C.char; begin Rand.Reset (Gen); for Idx in 1 .. Length - 1 loop loop Char := Rand.Random (Gen); exit when (Char >= '0' and then Char <= '9') or else (Char >= 'A' and then Char <= 'Z') or else (Char >= 'a' and then Char <= 'z'); end loop; Str (Idx) := Char; end loop; Str (Str'Last) := Interfaces.C.nul; return Str; end Random_String; ----------- -- Value -- ----------- overriding function Value (Self : not null access Firebird_Query; Index : Positive) return League.Holders.Holder is begin return Self.Sql_Record.Fields.Element (Isc_Valid_Field_Index (Index)).Value; end Value; end Matreshka.Internals.SQL_Drivers.Firebird.Queries;
package VFA1_Pkg is type Int8_t is mod 2**8; type Int is new Integer; pragma Volatile_Full_Access (Int); Counter1 : Int; Counter2 : Integer; pragma Volatile_Full_Access (Counter2); type Arr is array (1 .. 4) of Int8_t; for Arr'Alignment use 4; pragma Volatile_Full_Access (Arr); Timer1 : Arr; Timer2 : array (1 .. 4) of Int8_t; for Timer2'Alignment use 4; pragma Volatile_Full_Access (Timer2); type Rec is record A : Short_Integer; B : Short_Integer; end record; type Rec_VFA is new Rec; pragma Volatile_Full_Access (Rec_VFA); Buffer1 : Rec_VFA; Buffer2 : Rec; pragma Volatile_Full_Access (Buffer2); type Code is record R : Int8_t; I : Int8_t; end record; pragma Volatile_Full_Access (Code); type CArr is array (1 .. 2) of Code; pragma Volatile_Full_Access (CArr); Mixer1 : Carr; Mixer2 : array (1 .. 2) of Code; pragma Volatile_Full_Access (Mixer2); end VFA1_Pkg;
with AUnit.Assertions; use AUnit.Assertions; with NeuralNet; with NeuralNet.IO; with MathUtils; with Ada.Text_IO; package body NeuralNetIOTests is procedure Register_Tests (T: in out TestCase) is use AUnit.Test_Cases.Registration; begin Register_Routine (T, testCreateNNFile'Access, "Neural Net IO: create file"); Register_Routine (T, testLoadNNFile'Access, "Neural Net IO: load file"); end Register_Tests; function Name(T: TestCase) return Test_String is begin return Format("Neural Net IO Tests"); end Name; nn_file_path: constant String := "test_net.nn"; nn_input_data: MathUtils.Vector; nn_expected_results: MathUtils.Vector; procedure testCreateNNFile(T : in out Test_Cases.Test_Case'Class) is config: NeuralNet.Config(2); nn_input: MathUtils.Vector; begin for i in 0 .. 10 loop nn_input_data.Append(Float(i) / 10.0); end loop; config.act := NeuralNet.RELU; config.inputSize := 1; config.lr := 0.05; config.gradientClipAbs := 0.4; config.sizes := (1 => 2, 2 => 1); declare nn: NeuralNet.Net := NeuralNet.create(config); begin for i of nn_input_data loop declare inp: MathUtils.Vector; begin inp.Append(i); nn_expected_results.Append(nn.forward(inp)); end; end loop; NeuralNet.IO.save(nn, nn_file_path); end; end testCreateNNFile; procedure testLoadNNFile(T : in out Test_Cases.Test_Case'Class) is status: Boolean := False; nn: NeuralNet.Net := NeuralNet.IO.load(nn_file_path, status); tmp_inp: MathUtils.Vector; begin Assert(status, "can't load the nn file"); for idx in nn_input_data.First_Index .. nn_input_data.Last_Index loop tmp_inp.Clear; tmp_inp.Append(nn_input_data(idx)); declare res: constant Float := nn.forward(tmp_inp).First_Element; exp_res: constant Float := nn_expected_results(idx); begin Assert(abs(res - exp_res) < 0.001, "NN result failure: " & res'Image & " " & exp_res'Image); end; end loop; end testLoadNNFile; end NeuralNetIOTests;
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2013, Vadim Godunko <vgodunko@gmail.com> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Internals.Links; with AMF.Internals.Tables.CMOF_Element_Table; with AMF.Internals.Tables.CMOF_Metamodel; with AMF.Internals.Tables.CMOF_Notification; with AMF.Internals.Tables.CMOF_Types; package body AMF.Internals.Tables.CMOF_Attributes is use type Matreshka.Internals.Strings.Shared_String_Access; -- Association -- -- 13 Association::isDerived -- 7 Classifier::isFinalSpecialization -- 2 NamedElement::name -- 4 NamedElement::namespace -- 1 Element::owner -- 6 Type::package -- 5 NamedElement::qualifiedName -- 3 NamedElement::visibility -- -- 9 Classifier::attribute -- 4 Namespace::elementImport -- 15 Association::endType -- 10 Classifier::feature -- 11 Classifier::general -- 3 Namespace::importedMember -- 12 Classifier::inheritedMember -- 7 Namespace::member -- 16 Association::memberEnd -- 17 Association::navigableOwnedEnd -- 2 Element::ownedComment -- 1 Element::ownedElement -- 14 Association::ownedEnd -- 6 Namespace::ownedMember -- 8 Namespace::ownedRule -- 5 Namespace::packageImport -- 13 Relationship::relatedElement -- Class -- -- 8 Class::isAbstract -- 7 Classifier::isFinalSpecialization -- 2 NamedElement::name -- 4 NamedElement::namespace -- 1 Element::owner -- 6 Type::package -- 5 NamedElement::qualifiedName -- 3 NamedElement::visibility -- -- 9 Classifier::attribute -- 4 Namespace::elementImport -- 10 Classifier::feature -- 11 Classifier::general -- 3 Namespace::importedMember -- 12 Classifier::inheritedMember -- 7 Namespace::member -- 13 Class::ownedAttribute -- 2 Element::ownedComment -- 1 Element::ownedElement -- 6 Namespace::ownedMember -- 14 Class::ownedOperation -- 8 Namespace::ownedRule -- 5 Namespace::packageImport -- 15 Class::superClass -- Comment -- -- 2 Comment::body -- 1 Element::owner -- -- 3 Comment::annotatedElement -- 2 Element::ownedComment -- 1 Element::ownedElement -- Constraint -- -- 7 Constraint::context -- 2 NamedElement::name -- 4 NamedElement::namespace -- 1 Element::owner -- 5 NamedElement::qualifiedName -- 6 Constraint::specification -- 3 NamedElement::visibility -- -- 3 Constraint::constrainedElement -- 2 Element::ownedComment -- 1 Element::ownedElement -- DataType -- -- 7 Classifier::isFinalSpecialization -- 2 NamedElement::name -- 4 NamedElement::namespace -- 1 Element::owner -- 6 Type::package -- 5 NamedElement::qualifiedName -- 3 NamedElement::visibility -- -- 9 Classifier::attribute -- 4 Namespace::elementImport -- 10 Classifier::feature -- 11 Classifier::general -- 3 Namespace::importedMember -- 12 Classifier::inheritedMember -- 7 Namespace::member -- 13 DataType::ownedAttribute -- 2 Element::ownedComment -- 1 Element::ownedElement -- 6 Namespace::ownedMember -- 14 DataType::ownedOperation -- 8 Namespace::ownedRule -- 5 Namespace::packageImport -- ElementImport -- -- 3 ElementImport::alias -- 4 ElementImport::importedElement -- 5 ElementImport::importingNamespace -- 1 Element::owner -- 2 ElementImport::visibility -- -- 2 Element::ownedComment -- 1 Element::ownedElement -- 13 Relationship::relatedElement -- 3 DirectedRelationship::source -- 4 DirectedRelationship::target -- Enumeration -- -- 7 Classifier::isFinalSpecialization -- 2 NamedElement::name -- 4 NamedElement::namespace -- 1 Element::owner -- 6 Type::package -- 5 NamedElement::qualifiedName -- 3 NamedElement::visibility -- -- 9 Classifier::attribute -- 4 Namespace::elementImport -- 10 Classifier::feature -- 11 Classifier::general -- 3 Namespace::importedMember -- 12 Classifier::inheritedMember -- 7 Namespace::member -- 13 DataType::ownedAttribute -- 2 Element::ownedComment -- 1 Element::ownedElement -- 15 Enumeration::ownedLiteral -- 6 Namespace::ownedMember -- 14 DataType::ownedOperation -- 8 Namespace::ownedRule -- 5 Namespace::packageImport -- EnumerationLiteral -- -- 6 EnumerationLiteral::enumeration -- 2 NamedElement::name -- 4 NamedElement::namespace -- 1 Element::owner -- 5 NamedElement::qualifiedName -- 3 NamedElement::visibility -- -- 2 Element::ownedComment -- 1 Element::ownedElement -- Expression -- -- 2 NamedElement::name -- 4 NamedElement::namespace -- 1 Element::owner -- 5 NamedElement::qualifiedName -- 6 TypedElement::type -- 3 NamedElement::visibility -- -- 3 Expression::operand -- 2 Element::ownedComment -- 1 Element::ownedElement -- OpaqueExpression -- -- 7 OpaqueExpression::body -- 8 OpaqueExpression::language -- 2 NamedElement::name -- 4 NamedElement::namespace -- 1 Element::owner -- 5 NamedElement::qualifiedName -- 6 TypedElement::type -- 3 NamedElement::visibility -- -- 2 Element::ownedComment -- 1 Element::ownedElement -- Operation -- -- 15 Operation::bodyCondition -- 12 Operation::class -- 13 Operation::datatype -- 11 RedefinableElement::isLeaf -- 7 Operation::isOrdered -- 6 Operation::isQuery -- 8 Operation::isUnique -- 9 Operation::lower -- 2 NamedElement::name -- 4 NamedElement::namespace -- 1 Element::owner -- 5 NamedElement::qualifiedName -- 14 Operation::type -- 10 Operation::upper -- 3 NamedElement::visibility -- -- 4 Namespace::elementImport -- 11 Feature::featuringClassifier -- 3 Namespace::importedMember -- 7 Namespace::member -- 2 Element::ownedComment -- 1 Element::ownedElement -- 6 Namespace::ownedMember -- 16 Operation::ownedParameter -- 12 BehavioralFeature::ownedParameter -- 8 Namespace::ownedRule -- 5 Namespace::packageImport -- 18 Operation::postcondition -- 17 Operation::precondition -- 14 Operation::raisedException -- 13 BehavioralFeature::raisedException -- 10 RedefinableElement::redefinedElement -- 15 Operation::redefinedOperation -- 9 RedefinableElement::redefinitionContext -- Package -- -- 2 NamedElement::name -- 4 NamedElement::namespace -- 6 Package::nestingPackage -- 1 Element::owner -- 5 NamedElement::qualifiedName -- 7 Package::uri -- 3 NamedElement::visibility -- -- 4 Namespace::elementImport -- 3 Namespace::importedMember -- 7 Namespace::member -- 11 Package::nestedPackage -- 2 Element::ownedComment -- 1 Element::ownedElement -- 6 Namespace::ownedMember -- 8 Namespace::ownedRule -- 10 Package::ownedType -- 5 Namespace::packageImport -- 12 Package::packageMerge -- 9 Package::packagedElement -- PackageImport -- -- 3 PackageImport::importedPackage -- 4 PackageImport::importingNamespace -- 1 Element::owner -- 2 PackageImport::visibility -- -- 2 Element::ownedComment -- 1 Element::ownedElement -- 13 Relationship::relatedElement -- 3 DirectedRelationship::source -- 4 DirectedRelationship::target -- PackageMerge -- -- 3 PackageMerge::mergedPackage -- 1 Element::owner -- 2 PackageMerge::receivingPackage -- -- 2 Element::ownedComment -- 1 Element::ownedElement -- 13 Relationship::relatedElement -- 3 DirectedRelationship::source -- 4 DirectedRelationship::target -- Parameter -- -- 12 Parameter::default -- 11 Parameter::direction -- 7 MultiplicityElement::isOrdered -- 8 MultiplicityElement::isUnique -- 9 MultiplicityElement::lower -- 2 NamedElement::name -- 4 NamedElement::namespace -- 13 Parameter::operation -- 1 Element::owner -- 5 NamedElement::qualifiedName -- 6 TypedElement::type -- 10 MultiplicityElement::upper -- 3 NamedElement::visibility -- -- 2 Element::ownedComment -- 1 Element::ownedElement -- PrimitiveType -- -- 7 Classifier::isFinalSpecialization -- 2 NamedElement::name -- 4 NamedElement::namespace -- 1 Element::owner -- 6 Type::package -- 5 NamedElement::qualifiedName -- 3 NamedElement::visibility -- -- 9 Classifier::attribute -- 4 Namespace::elementImport -- 10 Classifier::feature -- 11 Classifier::general -- 3 Namespace::importedMember -- 12 Classifier::inheritedMember -- 7 Namespace::member -- 13 DataType::ownedAttribute -- 2 Element::ownedComment -- 1 Element::ownedElement -- 6 Namespace::ownedMember -- 14 DataType::ownedOperation -- 8 Namespace::ownedRule -- 5 Namespace::packageImport -- Property -- -- 21 Property::association -- 17 Property::class -- 20 Property::datatype -- 12 Property::default -- 15 Property::isComposite -- 13 Property::isDerived -- 16 Property::isDerivedUnion -- 11 RedefinableElement::isLeaf -- 7 MultiplicityElement::isOrdered -- 14 Property::isReadOnly -- 8 MultiplicityElement::isUnique -- 9 MultiplicityElement::lower -- 2 NamedElement::name -- 4 NamedElement::namespace -- 19 Property::opposite -- 1 Element::owner -- 18 Property::owningAssociation -- 5 NamedElement::qualifiedName -- 6 TypedElement::type -- 10 MultiplicityElement::upper -- 3 NamedElement::visibility -- -- 11 Feature::featuringClassifier -- 2 Element::ownedComment -- 1 Element::ownedElement -- 10 RedefinableElement::redefinedElement -- 3 Property::redefinedProperty -- 9 RedefinableElement::redefinitionContext -- 4 Property::subsettedProperty -- Tag -- -- 2 Tag::name -- 1 Element::owner -- 4 Tag::tagOwner -- 3 Tag::value -- -- 3 Tag::element -- 2 Element::ownedComment -- 1 Element::ownedElement ------------------------ -- Internal_Get_Alias -- ------------------------ function Internal_Get_Alias (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (3).String_Value; end Internal_Get_Alias; ------------------------------------ -- Internal_Get_Annotated_Element -- ------------------------------------ function Internal_Get_Annotated_Element (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Comment => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when others => raise Program_Error; end case; end Internal_Get_Annotated_Element; ------------------------------ -- Internal_Get_Association -- ------------------------------ function Internal_Get_Association (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (21).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Association; ---------------------------- -- Internal_Get_Attribute -- ---------------------------- function Internal_Get_Attribute (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 9; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 9; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 9; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 9; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 9; when others => raise Program_Error; end case; end Internal_Get_Attribute; ----------------------- -- Internal_Get_Body -- ----------------------- function Internal_Get_Body (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_String is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (7).String_Collection; end Internal_Get_Body; ----------------------- -- Internal_Get_Body -- ----------------------- function Internal_Get_Body (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (2).String_Value; end Internal_Get_Body; --------------------------------- -- Internal_Get_Body_Condition -- --------------------------------- function Internal_Get_Body_Condition (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (15).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Body_Condition; ------------------------ -- Internal_Get_Class -- ------------------------ function Internal_Get_Class (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (12).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (17).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Class; -------------------------------------- -- Internal_Get_Constrained_Element -- -------------------------------------- function Internal_Get_Constrained_Element (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Constraint => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when others => raise Program_Error; end case; end Internal_Get_Constrained_Element; -------------------------- -- Internal_Get_Context -- -------------------------- function Internal_Get_Context (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Constraint => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (7).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Context; --------------------------- -- Internal_Get_Datatype -- --------------------------- function Internal_Get_Datatype (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (13).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (20).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Datatype; -------------------------- -- Internal_Get_Default -- -------------------------- function Internal_Get_Default (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (12).String_Value; end Internal_Get_Default; ---------------------------- -- Internal_Get_Direction -- ---------------------------- function Internal_Get_Direction (Self : AMF.Internals.AMF_Element) return AMF.CMOF.CMOF_Parameter_Direction_Kind is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (11).Parameter_Direction_Kind_Value; end Internal_Get_Direction; -------------------------- -- Internal_Get_Element -- -------------------------- function Internal_Get_Element (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Tag => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when others => raise Program_Error; end case; end Internal_Get_Element; --------------------------------- -- Internal_Get_Element_Import -- --------------------------------- function Internal_Get_Element_Import (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 4; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 4; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 4; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 4; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 4; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 4; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 4; when others => raise Program_Error; end case; end Internal_Get_Element_Import; --------------------------- -- Internal_Get_End_Type -- --------------------------- function Internal_Get_End_Type (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 15; when others => raise Program_Error; end case; end Internal_Get_End_Type; ------------------------------ -- Internal_Get_Enumeration -- ------------------------------ function Internal_Get_Enumeration (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration_Literal => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Enumeration; -------------------------- -- Internal_Get_Feature -- -------------------------- function Internal_Get_Feature (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 10; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 10; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 10; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 10; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 10; when others => raise Program_Error; end case; end Internal_Get_Feature; --------------------------------------- -- Internal_Get_Featuring_Classifier -- --------------------------------------- function Internal_Get_Featuring_Classifier (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 11; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 11; when others => raise Program_Error; end case; end Internal_Get_Featuring_Classifier; -------------------------- -- Internal_Get_General -- -------------------------- function Internal_Get_General (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 11; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 11; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 11; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 11; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 11; when others => raise Program_Error; end case; end Internal_Get_General; ----------------------------------- -- Internal_Get_Imported_Element -- ----------------------------------- function Internal_Get_Imported_Element (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Imported_Element; ---------------------------------- -- Internal_Get_Imported_Member -- ---------------------------------- function Internal_Get_Imported_Member (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when others => raise Program_Error; end case; end Internal_Get_Imported_Member; ----------------------------------- -- Internal_Get_Imported_Package -- ----------------------------------- function Internal_Get_Imported_Package (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (3).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Imported_Package; -------------------------------------- -- Internal_Get_Importing_Namespace -- -------------------------------------- function Internal_Get_Importing_Namespace (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (5).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Importing_Namespace; ----------------------------------- -- Internal_Get_Inherited_Member -- ----------------------------------- function Internal_Get_Inherited_Member (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 12; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 12; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 12; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 12; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 12; when others => raise Program_Error; end case; end Internal_Get_Inherited_Member; ------------------------------ -- Internal_Get_Is_Abstract -- ------------------------------ function Internal_Get_Is_Abstract (Self : AMF.Internals.AMF_Element) return Boolean is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (8).Boolean_Value; end Internal_Get_Is_Abstract; ------------------------------- -- Internal_Get_Is_Composite -- ------------------------------- function Internal_Get_Is_Composite (Self : AMF.Internals.AMF_Element) return Boolean is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (15).Boolean_Value; end Internal_Get_Is_Composite; ----------------------------- -- Internal_Get_Is_Derived -- ----------------------------- function Internal_Get_Is_Derived (Self : AMF.Internals.AMF_Element) return Boolean is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (13).Boolean_Value; end Internal_Get_Is_Derived; ----------------------------------- -- Internal_Get_Is_Derived_Union -- ----------------------------------- function Internal_Get_Is_Derived_Union (Self : AMF.Internals.AMF_Element) return Boolean is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (16).Boolean_Value; end Internal_Get_Is_Derived_Union; ------------------------------------------ -- Internal_Get_Is_Final_Specialization -- ------------------------------------------ function Internal_Get_Is_Final_Specialization (Self : AMF.Internals.AMF_Element) return Boolean is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (7).Boolean_Value; end Internal_Get_Is_Final_Specialization; -------------------------- -- Internal_Get_Is_Leaf -- -------------------------- function Internal_Get_Is_Leaf (Self : AMF.Internals.AMF_Element) return Boolean is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (11).Boolean_Value; end Internal_Get_Is_Leaf; ----------------------------- -- Internal_Get_Is_Ordered -- ----------------------------- function Internal_Get_Is_Ordered (Self : AMF.Internals.AMF_Element) return Boolean is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (7).Boolean_Value; end Internal_Get_Is_Ordered; --------------------------- -- Internal_Get_Is_Query -- --------------------------- function Internal_Get_Is_Query (Self : AMF.Internals.AMF_Element) return Boolean is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Boolean_Value; end Internal_Get_Is_Query; ------------------------------- -- Internal_Get_Is_Read_Only -- ------------------------------- function Internal_Get_Is_Read_Only (Self : AMF.Internals.AMF_Element) return Boolean is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (14).Boolean_Value; end Internal_Get_Is_Read_Only; ---------------------------- -- Internal_Get_Is_Unique -- ---------------------------- function Internal_Get_Is_Unique (Self : AMF.Internals.AMF_Element) return Boolean is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (8).Boolean_Value; end Internal_Get_Is_Unique; --------------------------- -- Internal_Get_Language -- --------------------------- function Internal_Get_Language (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_String is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (8).String_Collection; end Internal_Get_Language; ------------------------ -- Internal_Get_Lower -- ------------------------ function Internal_Get_Lower (Self : AMF.Internals.AMF_Element) return AMF.Optional_Integer is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (9).Integer_Holder; end Internal_Get_Lower; ------------------------- -- Internal_Get_Member -- ------------------------- function Internal_Get_Member (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 7; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 7; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 7; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 7; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 7; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 7; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 7; when others => raise Program_Error; end case; end Internal_Get_Member; ----------------------------- -- Internal_Get_Member_End -- ----------------------------- function Internal_Get_Member_End (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 16; when others => raise Program_Error; end case; end Internal_Get_Member_End; --------------------------------- -- Internal_Get_Merged_Package -- --------------------------------- function Internal_Get_Merged_Package (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (3).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Merged_Package; ----------------------- -- Internal_Get_Name -- ----------------------- function Internal_Get_Name (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (2).String_Value; end Internal_Get_Name; ---------------------------- -- Internal_Get_Namespace -- ---------------------------- function Internal_Get_Namespace (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Constraint => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration_Literal => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Expression => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Opaque_Expression => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Parameter => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Namespace; -------------------------------------- -- Internal_Get_Navigable_Owned_End -- -------------------------------------- function Internal_Get_Navigable_Owned_End (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 17; when others => raise Program_Error; end case; end Internal_Get_Navigable_Owned_End; --------------------------------- -- Internal_Get_Nested_Package -- --------------------------------- function Internal_Get_Nested_Package (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 11; when others => raise Program_Error; end case; end Internal_Get_Nested_Package; ---------------------------------- -- Internal_Get_Nesting_Package -- ---------------------------------- function Internal_Get_Nesting_Package (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Nesting_Package; -------------------------- -- Internal_Get_Operand -- -------------------------- function Internal_Get_Operand (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Expression => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when others => raise Program_Error; end case; end Internal_Get_Operand; ---------------------------- -- Internal_Get_Operation -- ---------------------------- function Internal_Get_Operation (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Parameter => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (13).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Operation; --------------------------- -- Internal_Get_Opposite -- --------------------------- function Internal_Get_Opposite (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (19).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Opposite; ---------------------------------- -- Internal_Get_Owned_Attribute -- ---------------------------------- function Internal_Get_Owned_Attribute (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 13; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 13; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 13; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 13; when others => raise Program_Error; end case; end Internal_Get_Owned_Attribute; -------------------------------- -- Internal_Get_Owned_Comment -- -------------------------------- function Internal_Get_Owned_Comment (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Comment => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Constraint => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration_Literal => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Expression => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Opaque_Expression => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Parameter => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Tag => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 2; when others => raise Program_Error; end case; end Internal_Get_Owned_Comment; -------------------------------- -- Internal_Get_Owned_Element -- -------------------------------- function Internal_Get_Owned_Element (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Comment => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Constraint => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration_Literal => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Expression => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Opaque_Expression => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Parameter => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Tag => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 1; when others => raise Program_Error; end case; end Internal_Get_Owned_Element; ---------------------------- -- Internal_Get_Owned_End -- ---------------------------- function Internal_Get_Owned_End (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 14; when others => raise Program_Error; end case; end Internal_Get_Owned_End; -------------------------------- -- Internal_Get_Owned_Literal -- -------------------------------- function Internal_Get_Owned_Literal (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 15; when others => raise Program_Error; end case; end Internal_Get_Owned_Literal; ------------------------------- -- Internal_Get_Owned_Member -- ------------------------------- function Internal_Get_Owned_Member (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 6; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 6; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 6; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 6; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 6; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 6; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 6; when others => raise Program_Error; end case; end Internal_Get_Owned_Member; ---------------------------------- -- Internal_Get_Owned_Operation -- ---------------------------------- function Internal_Get_Owned_Operation (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 14; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 14; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 14; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 14; when others => raise Program_Error; end case; end Internal_Get_Owned_Operation; ---------------------------------- -- Internal_Get_Owned_Parameter -- ---------------------------------- function Internal_Get_Owned_Parameter (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 16; when others => raise Program_Error; end case; end Internal_Get_Owned_Parameter; ----------------------------- -- Internal_Get_Owned_Rule -- ----------------------------- function Internal_Get_Owned_Rule (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 8; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 8; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 8; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 8; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 8; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 8; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 8; when others => raise Program_Error; end case; end Internal_Get_Owned_Rule; ----------------------------- -- Internal_Get_Owned_Type -- ----------------------------- function Internal_Get_Owned_Type (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 10; when others => raise Program_Error; end case; end Internal_Get_Owned_Type; ------------------------ -- Internal_Get_Owner -- ------------------------ function Internal_Get_Owner (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Comment => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Constraint => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration_Literal => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Expression => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Opaque_Expression => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Parameter => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Tag => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (1).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Owner; ------------------------------------- -- Internal_Get_Owning_Association -- ------------------------------------- function Internal_Get_Owning_Association (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (18).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Owning_Association; -------------------------- -- Internal_Get_Package -- -------------------------- function Internal_Get_Package (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Package; --------------------------------- -- Internal_Get_Package_Import -- --------------------------------- function Internal_Get_Package_Import (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 5; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 5; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 5; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 5; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 5; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 5; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 5; when others => raise Program_Error; end case; end Internal_Get_Package_Import; -------------------------------- -- Internal_Get_Package_Merge -- -------------------------------- function Internal_Get_Package_Merge (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 12; when others => raise Program_Error; end case; end Internal_Get_Package_Merge; ----------------------------------- -- Internal_Get_Packaged_Element -- ----------------------------------- function Internal_Get_Packaged_Element (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 9; when others => raise Program_Error; end case; end Internal_Get_Packaged_Element; -------------------------------- -- Internal_Get_Postcondition -- -------------------------------- function Internal_Get_Postcondition (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 18; when others => raise Program_Error; end case; end Internal_Get_Postcondition; ------------------------------- -- Internal_Get_Precondition -- ------------------------------- function Internal_Get_Precondition (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 17; when others => raise Program_Error; end case; end Internal_Get_Precondition; --------------------------------- -- Internal_Get_Qualified_Name -- --------------------------------- function Internal_Get_Qualified_Name (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (5).String_Value; end Internal_Get_Qualified_Name; ----------------------------------- -- Internal_Get_Raised_Exception -- ----------------------------------- function Internal_Get_Raised_Exception (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 14; when others => raise Program_Error; end case; end Internal_Get_Raised_Exception; ------------------------------------ -- Internal_Get_Receiving_Package -- ------------------------------------ function Internal_Get_Receiving_Package (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (2).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Receiving_Package; ------------------------------------ -- Internal_Get_Redefined_Element -- ------------------------------------ function Internal_Get_Redefined_Element (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 10; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 10; when others => raise Program_Error; end case; end Internal_Get_Redefined_Element; -------------------------------------- -- Internal_Get_Redefined_Operation -- -------------------------------------- function Internal_Get_Redefined_Operation (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 15; when others => raise Program_Error; end case; end Internal_Get_Redefined_Operation; ------------------------------------- -- Internal_Get_Redefined_Property -- ------------------------------------- function Internal_Get_Redefined_Property (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when others => raise Program_Error; end case; end Internal_Get_Redefined_Property; --------------------------------------- -- Internal_Get_Redefinition_Context -- --------------------------------------- function Internal_Get_Redefinition_Context (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 9; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 9; when others => raise Program_Error; end case; end Internal_Get_Redefinition_Context; ---------------------------------- -- Internal_Get_Related_Element -- ---------------------------------- function Internal_Get_Related_Element (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 13; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 13; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 13; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 13; when others => raise Program_Error; end case; end Internal_Get_Related_Element; ------------------------- -- Internal_Get_Source -- ------------------------- function Internal_Get_Source (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 3; when others => raise Program_Error; end case; end Internal_Get_Source; -------------------------------- -- Internal_Get_Specification -- -------------------------------- function Internal_Get_Specification (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Constraint => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Specification; ------------------------------------- -- Internal_Get_Subsetted_Property -- ------------------------------------- function Internal_Get_Subsetted_Property (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 4; when others => raise Program_Error; end case; end Internal_Get_Subsetted_Property; ------------------------------ -- Internal_Get_Super_Class -- ------------------------------ function Internal_Get_Super_Class (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 15; when others => raise Program_Error; end case; end Internal_Get_Super_Class; ---------------------------- -- Internal_Get_Tag_Owner -- ---------------------------- function Internal_Get_Tag_Owner (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Tag => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (4).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Tag_Owner; ------------------------- -- Internal_Get_Target -- ------------------------- function Internal_Get_Target (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Collection_Of_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 4; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 4; when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge => return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (0).Collection + 4; when others => raise Program_Error; end case; end Internal_Get_Target; ----------------------- -- Internal_Get_Type -- ----------------------- function Internal_Get_Type (Self : AMF.Internals.AMF_Element) return AMF.Internals.AMF_Element is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Expression => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Opaque_Expression => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (14).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Parameter => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Link, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => return AMF.Internals.Links.Opposite_Element (AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Link, Self); when others => raise Program_Error; end case; end Internal_Get_Type; ------------------------ -- Internal_Get_Upper -- ------------------------ function Internal_Get_Upper (Self : AMF.Internals.AMF_Element) return AMF.Optional_Unlimited_Natural is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (10).Unlimited_Natural_Holder; end Internal_Get_Upper; ---------------------- -- Internal_Get_Uri -- ---------------------- function Internal_Get_Uri (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (7).String_Value; end Internal_Get_Uri; ------------------------ -- Internal_Get_Value -- ------------------------ function Internal_Get_Value (Self : AMF.Internals.AMF_Element) return Matreshka.Internals.Strings.Shared_String_Access is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (3).String_Value; end Internal_Get_Value; ----------------------------- -- Internal_Get_Visibility -- ----------------------------- function Internal_Get_Visibility (Self : AMF.Internals.AMF_Element) return AMF.CMOF.CMOF_Visibility_Kind is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (2).Visibility_Kind_Value; end Internal_Get_Visibility; ----------------------------- -- Internal_Get_Visibility -- ----------------------------- function Internal_Get_Visibility (Self : AMF.Internals.AMF_Element) return AMF.CMOF.Optional_CMOF_Visibility_Kind is begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (3).Visibility_Kind_Holder; end Internal_Get_Visibility; ------------------------ -- Internal_Set_Alias -- ------------------------ procedure Internal_Set_Alias (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (3).String_Value; CMOF_Element_Table.Table (Self).Member (3).String_Value := To; if CMOF_Element_Table.Table (Self).Member (3).String_Value /= null then Matreshka.Internals.Strings.Reference (CMOF_Element_Table.Table (Self).Member (3).String_Value); end if; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Import_Alias, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Alias; ------------------------------ -- Internal_Set_Association -- ------------------------------ procedure Internal_Set_Association (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Association_Member_End_Association, To, Self); when others => raise Program_Error; end case; end Internal_Set_Association; ----------------------- -- Internal_Set_Body -- ----------------------- procedure Internal_Set_Body (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (2).String_Value; CMOF_Element_Table.Table (Self).Member (2).String_Value := To; if CMOF_Element_Table.Table (Self).Member (2).String_Value /= null then Matreshka.Internals.Strings.Reference (CMOF_Element_Table.Table (Self).Member (2).String_Value); end if; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Comment_Body, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Body; --------------------------------- -- Internal_Set_Body_Condition -- --------------------------------- procedure Internal_Set_Body_Condition (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Operation_Body_Condition_Body_Context, Self, To); when others => raise Program_Error; end case; end Internal_Set_Body_Condition; ------------------------ -- Internal_Set_Class -- ------------------------ procedure Internal_Set_Class (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Class_Owned_Operation_Class, To, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Class_Owned_Attribute_Class, To, Self); when others => raise Program_Error; end case; end Internal_Set_Class; -------------------------- -- Internal_Set_Context -- -------------------------- procedure Internal_Set_Context (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Constraint => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Owned_Rule_Context, To, Self); when others => raise Program_Error; end case; end Internal_Set_Context; --------------------------- -- Internal_Set_Datatype -- --------------------------- procedure Internal_Set_Datatype (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Data_Type_Owned_Operation_Datatype, To, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Data_Type_Owned_Attribute_Datatype, To, Self); when others => raise Program_Error; end case; end Internal_Set_Datatype; -------------------------- -- Internal_Set_Default -- -------------------------- procedure Internal_Set_Default (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (12).String_Value; CMOF_Element_Table.Table (Self).Member (12).String_Value := To; if CMOF_Element_Table.Table (Self).Member (12).String_Value /= null then Matreshka.Internals.Strings.Reference (CMOF_Element_Table.Table (Self).Member (12).String_Value); end if; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Parameter_Default, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Default; ---------------------------- -- Internal_Set_Direction -- ---------------------------- procedure Internal_Set_Direction (Self : AMF.Internals.AMF_Element; To : AMF.CMOF.CMOF_Parameter_Direction_Kind) is Old : AMF.CMOF.CMOF_Parameter_Direction_Kind; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (11).Parameter_Direction_Kind_Value; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (11).Parameter_Direction_Kind_Value := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Parameter_Direction, Old, To); end Internal_Set_Direction; ------------------------------ -- Internal_Set_Enumeration -- ------------------------------ procedure Internal_Set_Enumeration (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration_Literal => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Enumeration_Owned_Literal_Enumeration, To, Self); when others => raise Program_Error; end case; end Internal_Set_Enumeration; ----------------------------------- -- Internal_Set_Imported_Element -- ----------------------------------- procedure Internal_Set_Imported_Element (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Element_Import_Imported_Element_Element_Import, Self, To); when others => raise Program_Error; end case; end Internal_Set_Imported_Element; ----------------------------------- -- Internal_Set_Imported_Package -- ----------------------------------- procedure Internal_Set_Imported_Package (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Import_Imported_Package_Package_Import, Self, To); when others => raise Program_Error; end case; end Internal_Set_Imported_Package; -------------------------------------- -- Internal_Set_Importing_Namespace -- -------------------------------------- procedure Internal_Set_Importing_Namespace (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Element_Import => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Element_Import_Importing_Namespace, To, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Import => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Namespace_Package_Import_Importing_Namespace, To, Self); when others => raise Program_Error; end case; end Internal_Set_Importing_Namespace; ------------------------------ -- Internal_Set_Is_Abstract -- ------------------------------ procedure Internal_Set_Is_Abstract (Self : AMF.Internals.AMF_Element; To : Boolean) is Old : Boolean; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (8).Boolean_Value; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (8).Boolean_Value := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Class_Is_Abstract, Old, To); end Internal_Set_Is_Abstract; ------------------------------- -- Internal_Set_Is_Composite -- ------------------------------- procedure Internal_Set_Is_Composite (Self : AMF.Internals.AMF_Element; To : Boolean) is Old : Boolean; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (15).Boolean_Value; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (15).Boolean_Value := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Is_Composite, Old, To); end Internal_Set_Is_Composite; ----------------------------- -- Internal_Set_Is_Derived -- ----------------------------- procedure Internal_Set_Is_Derived (Self : AMF.Internals.AMF_Element; To : Boolean) is Old : Boolean; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (13).Boolean_Value; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (13).Boolean_Value := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Association_Is_Derived, Old, To); end Internal_Set_Is_Derived; ----------------------------------- -- Internal_Set_Is_Derived_Union -- ----------------------------------- procedure Internal_Set_Is_Derived_Union (Self : AMF.Internals.AMF_Element; To : Boolean) is Old : Boolean; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (16).Boolean_Value; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (16).Boolean_Value := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Is_Derived_Union, Old, To); end Internal_Set_Is_Derived_Union; ------------------------------------------ -- Internal_Set_Is_Final_Specialization -- ------------------------------------------ procedure Internal_Set_Is_Final_Specialization (Self : AMF.Internals.AMF_Element; To : Boolean) is Old : Boolean; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (7).Boolean_Value; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (7).Boolean_Value := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Classifier_Is_Final_Specialization, Old, To); end Internal_Set_Is_Final_Specialization; -------------------------- -- Internal_Set_Is_Leaf -- -------------------------- procedure Internal_Set_Is_Leaf (Self : AMF.Internals.AMF_Element; To : Boolean) is Old : Boolean; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (11).Boolean_Value; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (11).Boolean_Value := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Redefinable_Element_Is_Leaf, Old, To); end Internal_Set_Is_Leaf; ----------------------------- -- Internal_Set_Is_Ordered -- ----------------------------- procedure Internal_Set_Is_Ordered (Self : AMF.Internals.AMF_Element; To : Boolean) is Old : Boolean; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (7).Boolean_Value; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (7).Boolean_Value := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Is_Ordered, Old, To); end Internal_Set_Is_Ordered; --------------------------- -- Internal_Set_Is_Query -- --------------------------- procedure Internal_Set_Is_Query (Self : AMF.Internals.AMF_Element; To : Boolean) is Old : Boolean; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Boolean_Value; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (6).Boolean_Value := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Is_Query, Old, To); end Internal_Set_Is_Query; ------------------------------- -- Internal_Set_Is_Read_Only -- ------------------------------- procedure Internal_Set_Is_Read_Only (Self : AMF.Internals.AMF_Element; To : Boolean) is Old : Boolean; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (14).Boolean_Value; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (14).Boolean_Value := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Property_Is_Read_Only, Old, To); end Internal_Set_Is_Read_Only; ---------------------------- -- Internal_Set_Is_Unique -- ---------------------------- procedure Internal_Set_Is_Unique (Self : AMF.Internals.AMF_Element; To : Boolean) is Old : Boolean; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (8).Boolean_Value; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (8).Boolean_Value := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Is_Unique, Old, To); end Internal_Set_Is_Unique; ------------------------ -- Internal_Set_Lower -- ------------------------ procedure Internal_Set_Lower (Self : AMF.Internals.AMF_Element; To : AMF.Optional_Integer) is Old : AMF.Optional_Integer; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (9).Integer_Holder; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (9).Integer_Holder := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Lower, Old, To); end Internal_Set_Lower; --------------------------------- -- Internal_Set_Merged_Package -- --------------------------------- procedure Internal_Set_Merged_Package (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Merge_Merged_Package_Package_Merge, Self, To); when others => raise Program_Error; end case; end Internal_Set_Merged_Package; ----------------------- -- Internal_Set_Name -- ----------------------- procedure Internal_Set_Name (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (2).String_Value; CMOF_Element_Table.Table (Self).Member (2).String_Value := To; if CMOF_Element_Table.Table (Self).Member (2).String_Value /= null then Matreshka.Internals.Strings.Reference (CMOF_Element_Table.Table (Self).Member (2).String_Value); end if; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Name, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Name; ---------------------------------- -- Internal_Set_Nesting_Package -- ---------------------------------- procedure Internal_Set_Nesting_Package (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Nested_Package_Nesting_Package, To, Self); when others => raise Program_Error; end case; end Internal_Set_Nesting_Package; ---------------------------- -- Internal_Set_Operation -- ---------------------------- procedure Internal_Set_Operation (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Parameter => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Operation_Owned_Parameter_Operation, To, Self); when others => raise Program_Error; end case; end Internal_Set_Operation; --------------------------- -- Internal_Set_Opposite -- --------------------------- procedure Internal_Set_Opposite (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Property_Opposite_Property, Self, To); when others => raise Program_Error; end case; end Internal_Set_Opposite; ------------------------------------- -- Internal_Set_Owning_Association -- ------------------------------------- procedure Internal_Set_Owning_Association (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Association_Owned_End_Owning_Association, To, Self); when others => raise Program_Error; end case; end Internal_Set_Owning_Association; -------------------------- -- Internal_Set_Package -- -------------------------- procedure Internal_Set_Package (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Association => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Owned_Type_Package, To, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Class => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Owned_Type_Package, To, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Data_Type => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Owned_Type_Package, To, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Enumeration => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Owned_Type_Package, To, Self); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Primitive_Type => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Owned_Type_Package, To, Self); when others => raise Program_Error; end case; end Internal_Set_Package; ------------------------------------ -- Internal_Set_Receiving_Package -- ------------------------------------ procedure Internal_Set_Receiving_Package (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Package_Merge => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Package_Package_Merge_Receiving_Package, To, Self); when others => raise Program_Error; end case; end Internal_Set_Receiving_Package; -------------------------------- -- Internal_Set_Specification -- -------------------------------- procedure Internal_Set_Specification (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Constraint => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Constraint_Specification_Owning_Constraint, Self, To); when others => raise Program_Error; end case; end Internal_Set_Specification; ---------------------------- -- Internal_Set_Tag_Owner -- ---------------------------- procedure Internal_Set_Tag_Owner (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Tag => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Tag_Tag_Owner_Owned_Tag, Self, To); when others => raise Program_Error; end case; end Internal_Set_Tag_Owner; ----------------------- -- Internal_Set_Type -- ----------------------- procedure Internal_Set_Type (Self : AMF.Internals.AMF_Element; To : AMF.Internals.AMF_Element) is begin case AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Kind is when AMF.Internals.Tables.CMOF_Types.E_CMOF_Expression => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Typed_Element_Type_Typed_Element, Self, To); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Opaque_Expression => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Typed_Element_Type_Typed_Element, Self, To); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Operation => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Operation_Type_Operation, Self, To); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Parameter => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Typed_Element_Type_Typed_Element, Self, To); when AMF.Internals.Tables.CMOF_Types.E_CMOF_Property => AMF.Internals.Links.Create_Link (AMF.Internals.Tables.CMOF_Metamodel.MA_CMOF_Typed_Element_Type_Typed_Element, Self, To); when others => raise Program_Error; end case; end Internal_Set_Type; ------------------------ -- Internal_Set_Upper -- ------------------------ procedure Internal_Set_Upper (Self : AMF.Internals.AMF_Element; To : AMF.Optional_Unlimited_Natural) is Old : AMF.Optional_Unlimited_Natural; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (10).Unlimited_Natural_Holder; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (10).Unlimited_Natural_Holder := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Operation_Upper, Old, To); end Internal_Set_Upper; ---------------------- -- Internal_Set_Uri -- ---------------------- procedure Internal_Set_Uri (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (7).String_Value; CMOF_Element_Table.Table (Self).Member (7).String_Value := To; if CMOF_Element_Table.Table (Self).Member (7).String_Value /= null then Matreshka.Internals.Strings.Reference (CMOF_Element_Table.Table (Self).Member (7).String_Value); end if; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Package_Uri, Old, To); if Old /= null then Matreshka.Internals.Strings.Reference (Old); end if; end Internal_Set_Uri; ------------------------ -- Internal_Set_Value -- ------------------------ procedure Internal_Set_Value (Self : AMF.Internals.AMF_Element; To : Matreshka.Internals.Strings.Shared_String_Access) is Old : Matreshka.Internals.Strings.Shared_String_Access; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (3).String_Value; CMOF_Element_Table.Table (Self).Member (3).String_Value := To; Matreshka.Internals.Strings.Reference (CMOF_Element_Table.Table (Self).Member (3).String_Value); AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Tag_Value, Old, To); Matreshka.Internals.Strings.Dereference (Old); end Internal_Set_Value; ----------------------------- -- Internal_Set_Visibility -- ----------------------------- procedure Internal_Set_Visibility (Self : AMF.Internals.AMF_Element; To : AMF.CMOF.CMOF_Visibility_Kind) is Old : AMF.CMOF.CMOF_Visibility_Kind; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (2).Visibility_Kind_Value; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (2).Visibility_Kind_Value := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Element_Import_Visibility, Old, To); end Internal_Set_Visibility; ----------------------------- -- Internal_Set_Visibility -- ----------------------------- procedure Internal_Set_Visibility (Self : AMF.Internals.AMF_Element; To : AMF.CMOF.Optional_CMOF_Visibility_Kind) is Old : AMF.CMOF.Optional_CMOF_Visibility_Kind; begin Old := AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (3).Visibility_Kind_Holder; AMF.Internals.Tables.CMOF_Element_Table.Table (Self).Member (3).Visibility_Kind_Holder := To; AMF.Internals.Tables.CMOF_Notification.Notify_Attribute_Set (Self, AMF.Internals.Tables.CMOF_Metamodel.MP_CMOF_Named_Element_Visibility, Old, To); end Internal_Set_Visibility; end AMF.Internals.Tables.CMOF_Attributes;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S E M _ P R A G -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- Pragma handling is isolated in a separate package -- (logically this processing belongs in chapter 4) with Namet; use Namet; with Opt; use Opt; with Snames; use Snames; with Types; use Types; package Sem_Prag is -- The following table lists all pragmas that emulate an Ada 2012 aspect Aspect_Specifying_Pragma : constant array (Pragma_Id) of Boolean := (Pragma_Abstract_State => True, Pragma_All_Calls_Remote => True, Pragma_Annotate => True, Pragma_Async_Readers => True, Pragma_Async_Writers => True, Pragma_Asynchronous => True, Pragma_Atomic => True, Pragma_Atomic_Components => True, Pragma_Attach_Handler => True, Pragma_Constant_After_Elaboration => True, Pragma_Contract_Cases => True, Pragma_Convention => True, Pragma_CPU => True, Pragma_CUDA_Global => True, Pragma_Default_Initial_Condition => True, Pragma_Default_Storage_Pool => True, Pragma_Depends => True, Pragma_Discard_Names => True, Pragma_Dispatching_Domain => True, Pragma_Effective_Reads => True, Pragma_Effective_Writes => True, Pragma_Elaborate_Body => True, Pragma_Export => True, Pragma_Extensions_Visible => True, Pragma_Favor_Top_Level => True, Pragma_Ghost => True, Pragma_Global => True, Pragma_Import => True, Pragma_Independent => True, Pragma_Independent_Components => True, Pragma_Initial_Condition => True, Pragma_Initializes => True, Pragma_Inline => True, Pragma_Inline_Always => True, Pragma_Interrupt_Handler => True, Pragma_Interrupt_Priority => True, Pragma_Invariant => True, Pragma_Linker_Section => True, Pragma_Lock_Free => True, Pragma_No_Elaboration_Code_All => True, Pragma_No_Return => True, Pragma_Obsolescent => True, Pragma_Pack => True, Pragma_Part_Of => True, Pragma_Persistent_BSS => True, Pragma_Post => True, Pragma_Post_Class => True, Pragma_Postcondition => True, Pragma_Pre => True, Pragma_Pre_Class => True, Pragma_Precondition => True, Pragma_Predicate => True, Pragma_Preelaborable_Initialization => True, Pragma_Preelaborate => True, Pragma_Priority => True, Pragma_Pure => True, Pragma_Pure_Function => True, Pragma_Refined_Depends => True, Pragma_Refined_Global => True, Pragma_Refined_Post => True, Pragma_Refined_State => True, Pragma_Relative_Deadline => True, Pragma_Remote_Access_Type => True, Pragma_Remote_Call_Interface => True, Pragma_Remote_Types => True, Pragma_Secondary_Stack_Size => True, Pragma_Shared => True, Pragma_Shared_Passive => True, Pragma_Simple_Storage_Pool_Type => True, Pragma_SPARK_Mode => True, Pragma_Storage_Size => True, Pragma_Suppress => True, Pragma_Suppress_Debug_Info => True, Pragma_Suppress_Initialization => True, Pragma_Test_Case => True, Pragma_Thread_Local_Storage => True, Pragma_Type_Invariant => True, Pragma_Unchecked_Union => True, Pragma_Universal_Aliasing => True, Pragma_Universal_Data => True, Pragma_Unmodified => True, Pragma_Unreferenced => True, Pragma_Unreferenced_Objects => True, Pragma_Unsuppress => True, Pragma_Volatile => True, Pragma_Volatile_Components => True, Pragma_Volatile_Full_Access => True, Pragma_Warnings => True, others => False); -- The following table lists all pragmas that act as an assertion -- expression. Assertion_Expression_Pragma : constant array (Pragma_Id) of Boolean := (Pragma_Assert => True, Pragma_Assert_And_Cut => True, Pragma_Assume => True, Pragma_Check => True, Pragma_Contract_Cases => True, Pragma_Default_Initial_Condition => True, Pragma_Initial_Condition => True, Pragma_Invariant => True, Pragma_Loop_Invariant => True, Pragma_Loop_Variant => True, Pragma_Post => True, Pragma_Post_Class => True, Pragma_Postcondition => True, Pragma_Pre => True, Pragma_Pre_Class => True, Pragma_Precondition => True, Pragma_Predicate => True, Pragma_Refined_Post => True, Pragma_Test_Case => True, Pragma_Type_Invariant => True, Pragma_Type_Invariant_Class => True, others => False); -- The following table lists all the implementation-defined pragmas that -- should apply to the anonymous object produced by the analysis of a -- single protected or task type. The table should be synchronized with -- Aspect_On_Anonymous_Object_OK in unit Aspects. Pragma_On_Anonymous_Object_OK : constant array (Pragma_Id) of Boolean := (Pragma_Depends => True, Pragma_Global => True, Pragma_Part_Of => True, others => False); -- The following table lists all the implementation-defined pragmas that -- may apply to a body stub (no language defined pragmas apply). The table -- should be synchronized with Aspect_On_Body_Or_Stub_OK in unit Aspects. Pragma_On_Body_Or_Stub_OK : constant array (Pragma_Id) of Boolean := (Pragma_Refined_Depends => True, Pragma_Refined_Global => True, Pragma_Refined_Post => True, Pragma_SPARK_Mode => True, Pragma_Warnings => True, others => False); -- The following table lists all pragmas which are significant in SPARK and -- as a result get translated into verification conditions. The table is an -- amalgamation of the pragmas listed in SPARK RM 16.1 and internally added -- entries. Pragma_Significant_In_SPARK : constant array (Pragma_Id) of Boolean := (Pragma_All_Calls_Remote => False, Pragma_Asynchronous => False, Pragma_Default_Storage_Pool => False, Pragma_Discard_Names => False, Pragma_Dispatching_Domain => False, Pragma_Priority_Specific_Dispatching => False, Pragma_Remote_Call_Interface => False, Pragma_Remote_Types => False, Pragma_Shared_Passive => False, Pragma_Task_Dispatching_Policy => False, Pragma_Unmodified => False, Pragma_Unreferenced => False, Pragma_Warnings => False, others => True); ----------------- -- Subprograms -- ----------------- procedure Analyze_Pragma (N : Node_Id); -- Analyze procedure for pragma reference node N procedure Analyze_Contract_Cases_In_Decl_Part (N : Node_Id; Freeze_Id : Entity_Id := Empty); -- Perform full analysis of delayed pragma Contract_Cases. Freeze_Id is the -- entity of [generic] package body or [generic] subprogram body which -- caused "freezing" of the related contract where the pragma resides. procedure Analyze_Depends_In_Decl_Part (N : Node_Id); -- Perform full analysis of delayed pragma Depends. This routine is also -- capable of performing basic analysis of pragma Refined_Depends. procedure Analyze_External_Property_In_Decl_Part (N : Node_Id; Expr_Val : out Boolean); -- Perform full analysis of delayed pragmas Async_Readers, Async_Writers, -- Effective_Reads, Effective_Writes and No_Caching. Flag Expr_Val contains -- the Boolean argument of the pragma or a default True if no argument -- is present. procedure Analyze_Global_In_Decl_Part (N : Node_Id); -- Perform full analysis of delayed pragma Global. This routine is also -- capable of performing basic analysis of pragma Refined_Global. procedure Analyze_Initial_Condition_In_Decl_Part (N : Node_Id); -- Perform full analysis of delayed pragma Initial_Condition procedure Analyze_Initializes_In_Decl_Part (N : Node_Id); -- Perform full analysis of delayed pragma Initializes procedure Analyze_Part_Of_In_Decl_Part (N : Node_Id; Freeze_Id : Entity_Id := Empty); -- Perform full analysis of delayed pragma Part_Of. Freeze_Id is the entity -- of [generic] package body or [generic] subprogram body which caused the -- "freezing" of the related contract where the pragma resides. procedure Analyze_Pre_Post_Condition_In_Decl_Part (N : Node_Id; Freeze_Id : Entity_Id := Empty); -- Perform full analysis of pragmas Precondition and Postcondition. -- Freeze_Id denotes the entity of [generic] package body or [generic] -- subprogram body which caused "freezing" of the related contract where -- the pragma resides. procedure Analyze_Refined_Depends_In_Decl_Part (N : Node_Id); -- Preform full analysis of delayed pragma Refined_Depends. This routine -- uses Analyze_Depends_In_Decl_Part as a starting point, then performs -- various consistency checks between Depends and Refined_Depends. procedure Analyze_Refined_Global_In_Decl_Part (N : Node_Id); -- Perform full analysis of delayed pragma Refined_Global. This routine -- uses Analyze_Global_In_Decl_Part as a starting point, then performs -- various consistency checks between Global and Refined_Global. procedure Analyze_Refined_State_In_Decl_Part (N : Node_Id; Freeze_Id : Entity_Id := Empty); -- Perform full analysis of delayed pragma Refined_State. Freeze_Id denotes -- the entity of [generic] package body or [generic] subprogram body which -- caused "freezing" of the related contract where the pragma resides. procedure Analyze_Subprogram_Variant_In_Decl_Part (N : Node_Id; Freeze_Id : Entity_Id := Empty); -- Perform full analysis of delayed pragma Subprogram_Variant. Freeze_Id is -- the entity of [generic] package body or [generic] subprogram body which -- caused "freezing" of the related contract where the pragma resides. procedure Analyze_Test_Case_In_Decl_Part (N : Node_Id); -- Perform preanalysis of pragma Test_Case function Build_Pragma_Check_Equivalent (Prag : Node_Id; Subp_Id : Entity_Id := Empty; Inher_Id : Entity_Id := Empty; Keep_Pragma_Id : Boolean := False) return Node_Id; -- Transform a pre- or [refined] postcondition denoted by Prag into an -- equivalent pragma Check. When the pre- or postcondition is inherited, -- the routine replaces the references of all formals of Inher_Id -- and primitive operations of its controlling type by references -- to the corresponding entities of Subp_Id and the descendant type. -- Keep_Pragma_Id is True when the newly created pragma should be -- in fact of the same kind as the source pragma Prag. This is used -- in GNATprove_Mode to generate the inherited pre- and postconditions. procedure Check_Applicable_Policy (N : Node_Id); -- N is either an N_Aspect or an N_Pragma node. There are two cases. If -- the name of the aspect or pragma is not one of those recognized as -- an assertion kind by an Assertion_Policy pragma, then the call has -- no effect. Note that in the case of a pragma derived from an aspect, -- the name we use for the purpose of this procedure is the aspect name, -- which may be different from the pragma name (e.g. Precondition for -- Pre aspect). In addition, 'Class aspects are recognized (and the -- corresponding special names used in the processing). -- -- If the name is a valid assertion kind name, then the Check_Policy pragma -- chain is checked for a matching entry (or for an Assertion entry which -- matches all possibilities). If a matching entry is found then the policy -- is checked. If it is On or Check, then the Is_Checked flag is set in -- the aspect or pragma node. If it is Off, Ignore, or Disable, then the -- Is_Ignored flag is set in the aspect or pragma node. Additionally for -- policy Disable, the Is_Disabled flag is set. -- -- If no matching Check_Policy pragma is found then the effect depends on -- whether -gnata was used, if so, then the call has no effect, otherwise -- Is_Ignored (but not Is_Disabled) is set True. procedure Check_External_Properties (Item : Node_Id; AR : Boolean; AW : Boolean; ER : Boolean; EW : Boolean); -- Flags AR, AW, ER and EW denote the static values of external properties -- Async_Readers, Async_Writers, Effective_Reads and Effective_Writes. Item -- is the related variable or state. Ensure legality of the combination and -- issue an error for an illegal combination. function Check_Kind (Nam : Name_Id) return Name_Id; -- This function is used in connection with pragmas Assert, Check, -- and assertion aspects and pragmas, to determine if Check pragmas -- (or corresponding assertion aspects or pragmas) are currently active -- as determined by the presence of -gnata on the command line (which -- sets the default), and the appearance of pragmas Check_Policy and -- Assertion_Policy as configuration pragmas either in a configuration -- pragma file, or at the start of the current unit, or locally given -- Check_Policy and Assertion_Policy pragmas that are currently active. -- -- The value returned is one of the names Check, Ignore, Disable (On -- returns Check, and Off returns Ignore). -- -- Note: for assertion kinds Pre'Class, Post'Class, Invariant'Class, -- and Type_Invariant'Class, the name passed is Name_uPre, Name_uPost, -- Name_uInvariant, or Name_uType_Invariant, which corresponds to _Pre, -- _Post, _Invariant, or _Type_Invariant, which are special names used -- in identifiers to represent these attribute references. procedure Check_Missing_Part_Of (Item_Id : Entity_Id); -- Determine whether the placement within the state space of an abstract -- state, variable or package instantiation denoted by Item_Id requires the -- use of indicator/option Part_Of. If this is the case, emit an error. procedure Collect_Inherited_Class_Wide_Conditions (Subp : Entity_Id); -- In GNATprove mode, when analyzing an overriding subprogram, check -- whether the overridden operations have class-wide pre/postconditions, -- and generate the corresponding pragmas. The pragmas are inserted after -- the subprogram declaration, together with those generated for other -- aspects of the subprogram. procedure Collect_Subprogram_Inputs_Outputs (Subp_Id : Entity_Id; Synthesize : Boolean := False; Subp_Inputs : in out Elist_Id; Subp_Outputs : in out Elist_Id; Global_Seen : out Boolean); -- Subsidiary to the analysis of pragmas Depends, Global, Refined_Depends -- and Refined_Global. The routine is also used by GNATprove. Collect all -- inputs and outputs of subprogram Subp_Id in lists Subp_Inputs (inputs) -- and Subp_Outputs (outputs). The inputs and outputs are gathered from: -- 1) The formal parameters of the subprogram -- 2) The generic formal parameters of the generic subprogram -- 3) The current instance of a concurrent type -- 4) The items of pragma [Refined_]Global -- or -- 5) The items of pragma [Refined_]Depends if there is no pragma -- [Refined_]Global present and flag Synthesize is set to True. -- If the subprogram has no inputs and/or outputs, then the returned list -- is No_Elist. Flag Global_Seen is set when the related subprogram has -- pragma [Refined_]Global. function Delay_Config_Pragma_Analyze (N : Node_Id) return Boolean; -- N is a pragma appearing in a configuration pragma file. Most such -- pragmas are analyzed when the file is read, before parsing and analyzing -- the main unit. However, the analysis of certain pragmas results in -- adding information to the compiled main unit, and this cannot be done -- till the main unit is processed. Such pragmas return True from this -- function and in Frontend pragmas where Delay_Config_Pragma_Analyze is -- True have their analysis delayed until after the main program is parsed -- and analyzed. function Find_Related_Package_Or_Body (Prag : Node_Id; Do_Checks : Boolean := False) return Node_Id; -- Subsidiary to the analysis of pragmas -- Abstract_State -- Initial_Condition -- Initializes -- Refined_State -- Find the declaration of the related package [body] subject to pragma -- Prag. The return value is either N_Package_Declaration, N_Package_Body, -- or Empty if the placement of the pragma is illegal. If flag Do_Checks is -- set, the routine reports duplicate pragmas. function Find_Related_Declaration_Or_Body (Prag : Node_Id; Do_Checks : Boolean := False) return Node_Id; -- Subsidiary to the analysis of pragmas -- Contract_Cases -- Depends -- Extensions_Visible -- Global -- Initializes -- Max_Entry_Queue_Depth -- Max_Entry_Queue_Length -- Max_Queue_Length -- Post -- Post_Class -- Postcondition -- Pre -- Pre_Class -- Precondition -- Refined_Depends -- Refined_Global -- Refined_Post -- Refined_State -- Test_Case -- Volatile_Function -- as well as attributes 'Old and 'Result. Find the declaration of the -- related entry, subprogram or task type [body] subject to pragma Prag. -- If flag Do_Checks is set, the routine reports duplicate pragmas and -- detects improper use of refinement pragmas in stand alone expression -- functions. function Get_Argument (Prag : Node_Id; Context_Id : Node_Id := Empty) return Node_Id; -- Obtain the argument of pragma Prag depending on context and the nature -- of the pragma. The argument is extracted in the following manner: -- -- When the pragma is generated from an aspect, return the corresponding -- aspect when Context_Id denotes a generic unit. -- -- Otherwise return the first argument of Prag -- -- Context denotes the entity of the function, package or procedure where -- Prag resides. function Get_SPARK_Mode_From_Annotation (N : Node_Id) return SPARK_Mode_Type; -- Given an aspect or pragma SPARK_Mode node, return corresponding mode id procedure Initialize; -- Initializes data structures used for pragma processing. Must be called -- before analyzing each new main source program. function Is_Config_Static_String (Arg : Node_Id) return Boolean; -- This is called for a configuration pragma that requires either string -- literal or a concatenation of string literals. We cannot use normal -- static string processing because it is too early in the case of the -- pragma appearing in a configuration pragmas file. If Arg is of an -- appropriate form, then this call obtains the string (doing any necessary -- concatenations) and places it in Name_Buffer, setting Name_Len to its -- length, and then returns True. If it is not of the correct form, then an -- appropriate error message is posted, and False is returned. function Is_Elaboration_SPARK_Mode (N : Node_Id) return Boolean; -- Determine whether pragma SPARK_Mode appears in the statement part of a -- package body. function Is_Enabled_Pragma (Prag : Node_Id) return Boolean; -- Determine whether a Boolean-like SPARK pragma Prag is enabled. To be -- considered enabled, the pragma must either: -- * Appear without its Boolean expression -- * The Boolean expression evaluates to "True" -- -- Boolean-like SPARK pragmas differ from pure Boolean Ada pragmas in that -- their optional Boolean expression must be static and cannot benefit from -- forward references. The following are Boolean-like SPARK pragmas: -- Async_Readers -- Async_Writers -- Constant_After_Elaboration -- Effective_Reads -- Effective_Writes -- Extensions_Visible -- Volatile_Function function Is_Non_Significant_Pragma_Reference (N : Node_Id) return Boolean; -- The node N is a node for an entity and the issue is whether the -- occurrence is a reference for the purposes of giving warnings about -- unreferenced variables. This function returns True if the reference is -- not a reference from this point of view (e.g. the occurrence in a pragma -- Pack) and False if it is a real reference (e.g. the occurrence in a -- pragma Export); function Is_Pragma_String_Literal (Par : Node_Id) return Boolean; -- Given an N_Pragma_Argument_Association node, Par, which has the form of -- an operator symbol, determines whether or not it should be treated as an -- string literal. This is called by Sem_Ch6.Analyze_Operator_Symbol. If -- True is returned, the argument is converted to a string literal. If -- False is returned, then the argument is treated as an entity reference -- to the operator. function Is_Private_SPARK_Mode (N : Node_Id) return Boolean; -- Determine whether pragma SPARK_Mode appears in the private part of a -- package. function Is_Valid_Assertion_Kind (Nam : Name_Id) return Boolean; -- Returns True if Nam is one of the names recognized as a valid assertion -- kind by the Assertion_Policy pragma. Note that the 'Class cases are -- represented by the corresponding special names Name_uPre, Name_uPost, -- Name_uInvariant, and Name_uType_Invariant (_Pre, _Post, _Invariant, -- and _Type_Invariant). procedure Process_Compilation_Unit_Pragmas (N : Node_Id); -- Called at the start of processing compilation unit N to deal with any -- special issues regarding pragmas. In particular, we have to deal with -- Suppress_All at this stage, since it can appear after the unit instead -- of before (actually we allow it to appear anywhere). procedure Relocate_Pragmas_To_Anonymous_Object (Typ_Decl : Node_Id; Obj_Decl : Node_Id); -- Relocate all pragmas that appear in the visible declarations of task or -- protected type declaration Typ_Decl after the declaration of anonymous -- object Obj_Decl. Table Pragmas_On_Anonymous_Object_OK contains the list -- of candidate pragmas. procedure Relocate_Pragmas_To_Body (Subp_Body : Node_Id; Target_Body : Node_Id := Empty); -- Resocate all pragmas that follow and apply to subprogram body Subp_Body -- to its own declaration list. Candidate pragmas are classified in table -- Pragma_On_Body_Or_Stub_OK. If Target_Body is set, the pragma are moved -- to the declarations of Target_Body. This formal should be set when -- dealing with subprogram body stubs or expression functions. procedure Set_Encoded_Interface_Name (E : Entity_Id; S : Node_Id); -- This routine is used to set an encoded interface name. The node S is -- an N_String_Literal node for the external name to be set, and E is an -- entity whose Interface_Name field is to be set. In the normal case where -- S contains a name that is a valid C identifier, then S is simply set as -- the value of the Interface_Name. Otherwise it is encoded as needed by -- particular operating systems. See the body for details of the encoding. procedure Set_Overflow_Mode (N : Node_Id); -- Sets Sem.Scope_Suppress according to the overflow modes specified in -- the pragma Overflow_Mode passed in argument. This should only be called -- after N has been successfully analyzed. function Test_Case_Arg (Prag : Node_Id; Arg_Nam : Name_Id; From_Aspect : Boolean := False) return Node_Id; -- Obtain argument "Name", "Mode", "Ensures" or "Requires" from Test_Case -- pragma Prag as denoted by Arg_Nam. When From_Aspect is set, an attempt -- is made to retrieve the argument from the corresponding aspect if there -- is one. The returned argument has several formats: -- -- N_Pragma_Argument_Association if retrieved directly from the pragma -- -- N_Component_Association if retrieved from the corresponding aspect and -- the argument appears in a named association form. -- -- An arbitrary expression if retrieved from the corresponding aspect and -- the argument appears in positional form. -- -- Empty if there is no such argument procedure Validate_Compile_Time_Warning_Errors; -- This routine is called after calling the back end to validate pragmas -- Compile_Time_Error and Compile_Time_Warning for size and alignment -- appropriateness. The reason it is called that late is to take advantage -- of any back-annotation of size and alignment performed by the back end. end Sem_Prag;
-- Copyright 2021 Jeff Foley. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local json = require("json") name = "IPdata" type = "api" function start() set_rate_limit(1) end function check() local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c ~= nil and c.key ~= nil and c.key ~= "") then return true end return false end function asn(ctx, addr, asn) if addr == "" then return end local c local cfg = datasrc_config() if cfg ~= nil then c = cfg.credentials end if (c == nil or c.key == nil or c.key == "") then return end local resp, err = request(ctx, {['url']=build_url(addr, c.key)}) if (err ~= nil and err ~= "") then log(ctx, "asn request to service failed: " .. err) return end local d = json.decode(resp) if (d == nil or d.asn == nil) then return end new_asn(ctx, { ['addr']=addr, ['asn']=tonumber(d.asn:gsub(3)), desc=d.name, prefix=d.route, netblocks={d.route}, }) end function build_url(addr, key) return "https://api.ipdata.co/" .. addr .. "/asn?api-key=" .. key end
-- --- Day 7: Handy Haversacks --- -- -- You land at the regional airport in time for your next flight. In fact, -- it looks like you'll even have time to grab some food: -- all flights are currently delayed due to issues in luggage processing. -- -- Due to recent aviation regulations, -- many rules (your puzzle input) are being enforced about bags and their contents; -- bags must be color-coded and must contain specific quantities of other color-coded bags. -- Apparently, nobody responsible for these regulations considered how long they would take to enforce! -- -- For example, consider the following rules: -- -- light red bags contain 1 bright white bag, 2 muted yellow bags. -- dark orange bags contain 3 bright white bags, 4 muted yellow bags. -- bright white bags contain 1 shiny gold bag. -- muted yellow bags contain 2 shiny gold bags, 9 faded blue bags. -- shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags. -- dark olive bags contain 3 faded blue bags, 4 dotted black bags. -- vibrant plum bags contain 5 faded blue bags, 6 dotted black bags. -- faded blue bags contain no other bags. -- dotted black bags contain no other bags. -- -- These rules specify the required contents for 9 bag types. -- In this example, every faded blue bag is empty, -- every vibrant plum bag contains 11 bags (5 faded blue and 6 dotted black), and so on. -- -- You have a shiny gold bag. If you wanted to carry it in at least one other bag, -- how many different bag colors would be valid for the outermost bag? -- (In other words: how many colors can, eventually, contain at least one shiny gold bag?) -- -- In the above rules, the following options would be available to you: -- -- A bright white bag, which can hold your shiny gold bag directly. -- A muted yellow bag, which can hold your shiny gold bag directly, -- plus some other bags. -- A dark orange bag, which can hold bright white and muted yellow bags, -- either of which could then hold your shiny gold bag. -- A light red bag, which can hold bright white and muted yellow bags, -- either of which could then hold your shiny gold bag. -- -- So, in this example, the number of bag colors that can eventually -- contain at least one shiny gold bag is 4. -- -- How many bag colors can eventually contain at least one shiny gold bag? -- (The list of rules is quite long; make sure you get all of it.) package Adventofcode.Day_7 is type Bag; type Bags is access Bag; type Bag is tagged record Colour : Ada.Strings.Unbounded.Unbounded_String; Count : Natural := 0; Allowed_Content : Bags; end record; Funci end Adventofcode.Day_7;
-- Copyright (c) 2019 Maxim Reznik <reznikmm@gmail.com> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- -- -- Coroutine is a basic components for non-preemptive multitasking. -- with System.Storage_Elements; private with Ada.Containers.Vectors; package Coroutines is pragma Preelaborate; procedure Initialize; -- Call this before use type Runable_Code is not null access procedure; -- A procedure to be executed as coroutine procedure Start (Runable : Runable_Code; Stack_Size : System.Storage_Elements.Storage_Count); -- Launch a new coroutine. -- Runable is an actual code to be executed under the coroutine; -- it should not execute any blocking call (except Yield). -- Stack_Size is size of stack dedicated to execute the coroutine. generic type Argument_Type is private; procedure Generic_Start (Runable : not null access procedure (Argument : Argument_Type); Stack_Size : System.Storage_Elements.Storage_Count; Argument : Argument_Type); -- Generic version of Start procedure. Runable should be library-level -- procedure. procedure Yield; -- Runable procedure can call Yield to suspend execution. The coroutine -- stay ready for execution. type Event_Id is private; type Event_Id_Array is array (Positive range <>) of Event_Id; procedure Yield (Wait : Event_Id); -- Runable procadure can call Yield to suspend execution until Wait event -- happens. procedure Yield (Wait : Event_Id_Array := (1 .. 0 => <>); Result : access Natural := null); -- Runable procadure can call Yield to suspend execution until one of event -- on Wait happens. On resume Result is an index of the event_id. If Wait -- is empty, then this Yield never returns. private type Event_Object is limited interface; type Event_Id is access all Event_Object'Class; not overriding procedure Activate (Self : in out Event_Object) is abstract; not overriding function Ready (Self : Event_Object) return Boolean is abstract; not overriding procedure Deactivate (Self : in out Event_Object) is abstract; type Context is new System.Address; function Null_Context return Context is (Context (System.Null_Address)); package Context_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Context); type Coroutine_Manager is limited interface; type Coroutine_Manager_Access is access all Coroutine_Manager'Class; not overriding procedure Get_Always_Ready_Event (Self : in out Coroutine_Manager; Result : out Event_Id) is abstract; not overriding procedure New_Round (Self : in out Coroutine_Manager; Queue : in out Context_Vectors.Vector; Timeout : Duration) is null; Manager : Coroutine_Manager_Access; function Hash (Self : Context) return Ada.Containers.Hash_Type; function Current_Context return Context; end Coroutines;
-- This spec has been automatically generated from out.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with System; -- USI package MSP430_SVD.USI is pragma Preelaborate; --------------- -- Registers -- --------------- -- USICTL0_USIPE array type USICTL0_USIPE_Field_Array is array (5 .. 7) of MSP430_SVD.Bit with Component_Size => 1, Size => 3; -- Type definition for USICTL0_USIPE type USICTL0_USIPE_Field (As_Array : Boolean := False) is record case As_Array is when False => -- USIPE as a value Val : MSP430_SVD.UInt3; when True => -- USIPE as an array Arr : USICTL0_USIPE_Field_Array; end case; end record with Unchecked_Union, Size => 3; for USICTL0_USIPE_Field use record Val at 0 range 0 .. 2; Arr at 0 range 0 .. 2; end record; -- USI Control Register 0 type USICTL0_Register is record -- USI Software Reset USISWRST : MSP430_SVD.Bit := 16#0#; -- USI Output Enable USIOE : MSP430_SVD.Bit := 16#0#; -- USI General Output Enable Latch USIGE : MSP430_SVD.Bit := 16#0#; -- USI Master Select 0:Slave / 1:Master USIMST : MSP430_SVD.Bit := 16#0#; -- USI LSB first 1:LSB / 0:MSB USILSB : MSP430_SVD.Bit := 16#0#; -- USI Port Enable Px.5 USIPE : USICTL0_USIPE_Field := (As_Array => False, Val => 16#0#); end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USICTL0_Register use record USISWRST at 0 range 0 .. 0; USIOE at 0 range 1 .. 1; USIGE at 0 range 2 .. 2; USIMST at 0 range 3 .. 3; USILSB at 0 range 4 .. 4; USIPE at 0 range 5 .. 7; end record; -- USI Control Register 1 type USICTL1_Register is record -- USI Counter Interrupt Flag USIIFG : MSP430_SVD.Bit := 16#0#; -- USI START Condition interrupt Flag USISTTIFG : MSP430_SVD.Bit := 16#0#; -- USI STOP Condition received USISTP : MSP430_SVD.Bit := 16#0#; -- USI Arbitration Lost USIAL : MSP430_SVD.Bit := 16#0#; -- USI Counter Interrupt enable USIIE : MSP430_SVD.Bit := 16#0#; -- USI START Condition interrupt enable USISTTIE : MSP430_SVD.Bit := 16#0#; -- USI I2C Mode USII2C : MSP430_SVD.Bit := 16#0#; -- USI Sync. Mode: Clock Phase USICKPH : MSP430_SVD.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USICTL1_Register use record USIIFG at 0 range 0 .. 0; USISTTIFG at 0 range 1 .. 1; USISTP at 0 range 2 .. 2; USIAL at 0 range 3 .. 3; USIIE at 0 range 4 .. 4; USISTTIE at 0 range 5 .. 5; USII2C at 0 range 6 .. 6; USICKPH at 0 range 7 .. 7; end record; -- USI Clock Source Select 2 type USICKCTL_USISSEL_Field is (-- USI Clock Source: 0 Usissel_0, -- USI Clock Source: 1 Usissel_1, -- USI Clock Source: 2 Usissel_2, -- USI Clock Source: 3 Usissel_3, -- USI Clock Source: 4 Usissel_4, -- USI Clock Source: 5 Usissel_5, -- USI Clock Source: 6 Usissel_6, -- USI Clock Source: 7 Usissel_7) with Size => 3; for USICKCTL_USISSEL_Field use (Usissel_0 => 0, Usissel_1 => 1, Usissel_2 => 2, Usissel_3 => 3, Usissel_4 => 4, Usissel_5 => 5, Usissel_6 => 6, Usissel_7 => 7); -- USI Clock Divider 2 type USICKCTL_USIDIV_Field is (-- USI Clock Divider: 0 Usidiv_0, -- USI Clock Divider: 1 Usidiv_1, -- USI Clock Divider: 2 Usidiv_2, -- USI Clock Divider: 3 Usidiv_3, -- USI Clock Divider: 4 Usidiv_4, -- USI Clock Divider: 5 Usidiv_5, -- USI Clock Divider: 6 Usidiv_6, -- USI Clock Divider: 7 Usidiv_7) with Size => 3; for USICKCTL_USIDIV_Field use (Usidiv_0 => 0, Usidiv_1 => 1, Usidiv_2 => 2, Usidiv_3 => 3, Usidiv_4 => 4, Usidiv_5 => 5, Usidiv_6 => 6, Usidiv_7 => 7); -- USI Clock Control Register type USICKCTL_Register is record -- USI Software Clock USISWCLK : MSP430_SVD.Bit := 16#0#; -- USI Clock Polarity 0:Inactive=Low / 1:Inactive=High USICKPL : MSP430_SVD.Bit := 16#0#; -- USI Clock Source Select 2 USISSEL : USICKCTL_USISSEL_Field := MSP430_SVD.USI.Usissel_0; -- USI Clock Divider 2 USIDIV : USICKCTL_USIDIV_Field := MSP430_SVD.USI.Usidiv_0; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USICKCTL_Register use record USISWCLK at 0 range 0 .. 0; USICKPL at 0 range 1 .. 1; USISSEL at 0 range 2 .. 4; USIDIV at 0 range 5 .. 7; end record; -- USICNT array type USICNT_Field_Array is array (0 .. 4) of MSP430_SVD.Bit with Component_Size => 1, Size => 5; -- Type definition for USICNT type USICNT_Field (As_Array : Boolean := False) is record case As_Array is when False => -- USICNT as a value Val : MSP430_SVD.UInt5; when True => -- USICNT as an array Arr : USICNT_Field_Array; end case; end record with Unchecked_Union, Size => 5; for USICNT_Field use record Val at 0 range 0 .. 4; Arr at 0 range 0 .. 4; end record; -- USI Bit Counter Register type USICNT_Register is record -- USI Bit Count 0 USICNT : USICNT_Field := (As_Array => False, Val => 16#0#); -- USI Interrupt Flag Clear Control USIIFGCC : MSP430_SVD.Bit := 16#0#; -- USI 16 Bit Shift Register Enable USI16B : MSP430_SVD.Bit := 16#0#; -- USI SCL Released USISCLREL : MSP430_SVD.Bit := 16#0#; end record with Volatile_Full_Access, Object_Size => 8, Bit_Order => System.Low_Order_First; for USICNT_Register use record USICNT at 0 range 0 .. 4; USIIFGCC at 0 range 5 .. 5; USI16B at 0 range 6 .. 6; USISCLREL at 0 range 7 .. 7; end record; ----------------- -- Peripherals -- ----------------- -- USI type USI_Peripheral is record -- USI Control Register 0 USICTL0 : aliased USICTL0_Register; -- USI Control Register 1 USICTL1 : aliased USICTL1_Register; -- USI Clock Control Register USICKCTL : aliased USICKCTL_Register; -- USI Bit Counter Register USICNT : aliased USICNT_Register; -- USI Low Byte Shift Register USISRL : aliased MSP430_SVD.Byte; -- USI High Byte Shift Register USISRH : aliased MSP430_SVD.Byte; end record with Volatile; for USI_Peripheral use record USICTL0 at 16#0# range 0 .. 7; USICTL1 at 16#1# range 0 .. 7; USICKCTL at 16#2# range 0 .. 7; USICNT at 16#3# range 0 .. 7; USISRL at 16#4# range 0 .. 7; USISRH at 16#5# range 0 .. 7; end record; -- USI USI_Periph : aliased USI_Peripheral with Import, Address => USI_Base; end MSP430_SVD.USI;
package Linear_Search with SPARK_Mode is type T is range 0 .. 10; subtype U is T range 1 .. 10; type Ar is array (U) of Integer; function Search (A : Ar; I : Integer) return T with -- If I exists in A, then Search'Result indicates its position Post => (if Search'Result in A'Range then A (Search'Result) = I else (for all Index in A'Range => A (Index) /= I)); end Linear_Search;
-- The Village of Vampire by YT, このソースコードはNYSLです with Vampire.Forms; with Vampire.Villages; package Vampire.Configurations is Temporary_Directory : constant String := "_data/tmp"; -- locking Lock_Name : aliased constant String := "_data/tmp/lock-vampire"; -- for debug Debug_Log_File_Name : aliased constant String := "_data/log/debug-log.txt"; -- for uses Users_Directory : aliased constant String := "_data/users"; -- temporary file for users Users_Log_File_Name : aliased constant String := "_data/log/users-log"; -- for casts Cast_File_Name : constant String := "cast"; -- for villages Villages_Data_Directory : aliased constant String := "_data/villages"; Villages_HTML_Directory : aliased constant String := "villages"; Villages_Index_HTML_File_Name : aliased constant String := "villages/index.html"; Villages_Index_RSS_File_Name : aliased constant String := "villages/wanted.rdf"; -- temporary file for villages Villages_Cache_File_Name : aliased constant String := "_data/cache/cache-villages"; Villages_Blocking_Short_Term_File_Name : aliased constant String := "_data/config/disabled-short"; -- for rendering Style_Sheet_File_Name : aliased constant String := "style.css"; Image_Directory : aliased constant String := "image"; Background_Image_File_Name : aliased constant String := Image_Directory & "/" & "background.png"; Relative_Role_Image_File_Names : aliased constant Villages.Role_Images := ( Villages.Gremlin => new String'("gremlin.png"), Villages.Vampire_Role => new String'("vampire.png"), Villages.Servant => new String'("servant.png"), Villages.Inhabitant | Villages.Loved_Inhabitant | Villages.Unfortunate_Inhabitant => new String'("inhabitant.png"), Villages.Detective => new String'("detective.png"), Villages.Doctor => new String'("doctor.png"), Villages.Astronomer => new String'("astronomer.png"), Villages.Hunter => new String'("hunter.png"), Villages.Lover | Villages.Sweetheart_M | Villages.Sweetheart_F => new String'("sweetheart.png")); -- templates type Template_Names_Type is record Style_Sheet_File_Name : not null Static_String_Access; Image_Directory : not null Static_String_Access; Background_Image_File_Name : not null Static_String_Access; Relative_Role_Image_File_Names : not null access constant Villages.Role_Images; Template_Index_File_Name : not null access constant String; Template_Register_File_Name : not null access constant String; Template_User_File_Name : not null access constant String; Template_User_List_File_Name : not null access constant String; Template_Village_File_Name : not null access constant String; Template_Preview_File_Name : not null access constant String; Template_Target_File_Name : not null access constant String; Template_Message_File_Name : not null access constant String; Template_Log_Index_File_Name : not null access constant String; end record; Template_Names : constant array (Forms.Template_Set_Type) of aliased Template_Names_Type := ( Forms.For_Full => ( Style_Sheet_File_Name => Style_Sheet_File_Name'Access, Image_Directory => Image_Directory'Access, Background_Image_File_Name => Background_Image_File_Name'Access, Relative_Role_Image_File_Names => Relative_Role_Image_File_Names'Access, Template_Index_File_Name => new String'("template-index.html"), Template_Register_File_Name => new String'("template-register.html"), Template_User_File_Name => new String'("template-user.html"), Template_User_List_File_Name => new String'("template-userlist.html"), Template_Village_File_Name => new String'("template-village.html"), Template_Preview_File_Name => new String'("template-preview.html"), Template_Target_File_Name => new String'("template-target.html"), Template_Message_File_Name => new String'("template-message.html"), Template_Log_Index_File_Name => new String'("template-logindex.html")), Forms.For_Mobile => ( Style_Sheet_File_Name => Style_Sheet_File_Name'Access, Image_Directory => Image_Directory'Access, Background_Image_File_Name => Background_Image_File_Name'Access, Relative_Role_Image_File_Names => Relative_Role_Image_File_Names'Access, Template_Index_File_Name => new String'("template-index-simple.html"), Template_Register_File_Name => new String'("template-register-simple.html"), Template_User_File_Name => new String'("template-user-simple.html"), Template_User_List_File_Name => new String'("template-userlist-simple.html"), Template_Village_File_Name => new String'("template-village-simple.html"), Template_Preview_File_Name => new String'("template-preview-simple.html"), Template_Target_File_Name => new String'("template-target-simple.html"), Template_Message_File_Name => new String'("template-message-simple.html"), Template_Log_Index_File_Name => new String'("template-logindex-simple.html"))); -- 携帯版で1ページに表示する発言数 Speeches_Per_Page : constant := 12; -- cookie有効期限 Cookie_Duration : constant Duration := 4 * 24 * 60 * 60 * 1.0; -- ムラムラスカウター(仮) Muramura_Duration : constant Duration := 24 * 60 * 60 * 1.0; end Vampire.Configurations;
----------------------------------------------------------------------- -- gen-artifacts-docs -- Artifact for documentation -- Copyright (C) 2012, 2013, 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.Files; with Util.Log.Loggers; with Util.Strings; with Util.Streams.Pipes; with Util.Streams.Texts; with Util.Processes; with Ada.Directories; with Ada.Strings.Fixed; with Ada.Text_IO; with Ada.Characters.Handling; with Ada.Strings.Maps; with Ada.Exceptions; with Gen.Utils; package body Gen.Artifacts.Docs is use Util.Log; use type Ada.Strings.Maps.Character_Set; Log : constant Loggers.Logger := Loggers.Create ("Gen.Artifacts.Docs"); Spaces : constant Ada.Strings.Maps.Character_Set := Ada.Strings.Maps.To_Set (' ') or Ada.Strings.Maps.To_Set (ASCII.HT) or Ada.Strings.Maps.To_Set (ASCII.VT) or Ada.Strings.Maps.To_Set (ASCII.CR) or Ada.Strings.Maps.To_Set (ASCII.LF); -- ------------------------------ -- Prepare the model after all the configuration files have been read and before -- actually invoking the generation. -- ------------------------------ overriding procedure Prepare (Handler : in out Artifact; Model : in out Gen.Model.Packages.Model_Definition'Class; Context : in out Generator'Class) is pragma Unreferenced (Model); Docs : Doc_Maps.Map; Command : constant String := Context.Get_Parameter ("generator.doc.xslt.command"); begin Log.Info ("Using command: {0}", Command); Handler.Xslt_Command := Ada.Strings.Unbounded.To_Unbounded_String (Command); Handler.Scan_Files ("src", Docs); Handler.Scan_Files ("config", Docs); Handler.Scan_Files ("db", Docs); Handler.Scan_Files ("plugins", Docs); Generate (Docs, Context.Get_Result_Directory); end Prepare; -- ------------------------------ -- Include the document extract represented by <b>Name</b> into the document <b>Into</b>. -- The included document is marked so that it will not be generated. -- ------------------------------ procedure Include (Docs : in out Doc_Maps.Map; Into : in out File_Document; Name : in String; Position : in Natural) is -- Include the lines from the document into another. procedure Do_Include (Source : in String; Doc : in out File_Document); -- ------------------------------ -- Include the lines from the document into another. -- ------------------------------ procedure Do_Include (Source : in String; Doc : in out File_Document) is pragma Unreferenced (Source); Iter : Line_Vectors.Cursor := Doc.Lines.Last; begin while Line_Vectors.Has_Element (Iter) loop Into.Lines.Insert (Before => Position, New_Item => Line_Vectors.Element (Iter)); Line_Vectors.Previous (Iter); end loop; Doc.Was_Included := True; end Do_Include; Pos : constant Doc_Maps.Cursor := Docs.Find (Name); begin if not Doc_Maps.Has_Element (Pos) then Log.Error ("Cannot include document '{0}'", Name); return; end if; Docs.Update_Element (Pos, Do_Include'Access); end Include; -- ------------------------------ -- Generate the project documentation that was collected in <b>Docs</b>. -- The documentation is merged so that the @include tags are replaced by the matching -- document extracts. -- ------------------------------ procedure Generate (Docs : in out Doc_Maps.Map; Dir : in String) is -- Merge the documentation. procedure Merge (Source : in String; Doc : in out File_Document); -- Generate the documentation. procedure Generate (Source : in String; Doc : in File_Document); -- ------------------------------ -- Merge the documentation. -- ------------------------------ procedure Merge (Source : in String; Doc : in out File_Document) is pragma Unreferenced (Source); Pos : Natural := 1; begin while Pos <= Natural (Doc.Lines.Length) loop declare L : constant Line_Type := Line_Vectors.Element (Doc.Lines, Pos); begin if L.Kind = L_INCLUDE then Line_Vectors.Delete (Doc.Lines, Pos); Include (Docs, Doc, L.Content, Pos); else Pos := Pos + 1; end if; end; end loop; end Merge; -- ------------------------------ -- Generate the documentation. -- ------------------------------ procedure Generate (Source : in String; Doc : in File_Document) is procedure Write (Line : in Line_Type); Name : constant String := Ada.Strings.Unbounded.To_String (Doc.Name) & ".wiki"; Path : constant String := Util.Files.Compose (Dir, Name); File : Ada.Text_IO.File_Type; Iter : Line_Vectors.Cursor := Doc.Lines.First; Need_Newline : Boolean := False; procedure Write (Line : in Line_Type) is begin if Line.Kind = L_LIST then Ada.Text_IO.New_Line (File); Ada.Text_IO.Put (File, Line.Content); Need_Newline := True; elsif Line.Kind = L_LIST_ITEM then Ada.Text_IO.Put (File, Line.Content); Need_Newline := True; else if Need_Newline then Ada.Text_IO.New_Line (File); Need_Newline := False; end if; Ada.Text_IO.Put_Line (File, Line.Content); end if; end Write; begin if Doc.Lines.Is_Empty or Doc.Was_Included then return; end if; Log.Info ("Generating doc {0}", Path); Ada.Directories.Create_Path (Dir); Ada.Text_IO.Create (File => File, Mode => Ada.Text_IO.Out_File, Name => Path); Ada.Text_IO.Put_Line (File, "#summary " & Ada.Strings.Unbounded.To_String (Doc.Title)); Ada.Text_IO.New_Line (File); while Line_Vectors.Has_Element (Iter) loop Line_Vectors.Query_Element (Iter, Write'Access); Line_Vectors.Next (Iter); end loop; Ada.Text_IO.New_Line (File); Ada.Text_IO.Put_Line (File, "----"); Ada.Text_IO.Put_Line (File, "[http://code.google.com/p/ada-gen Generated by Dynamo] _from " & Source & "_"); Ada.Text_IO.Close (File); end Generate; Iter : Doc_Maps.Cursor := Docs.First; begin -- First pass: merge the documentation. while Doc_Maps.Has_Element (Iter) loop Docs.Update_Element (Position => Iter, Process => Merge'Access); Doc_Maps.Next (Iter); end loop; -- Second pass: build the documentation. Iter := Docs.First; while Doc_Maps.Has_Element (Iter) loop Doc_Maps.Query_Element (Iter, Generate'Access); Doc_Maps.Next (Iter); end loop; end Generate; -- ------------------------------ -- Scan the files in the directory refered to by <b>Path</b> and collect the documentation -- in the <b>Docs</b> hashed map. -- ------------------------------ procedure Scan_Files (Handler : in out Artifact; Path : in String; Docs : in out Doc_Maps.Map) is use Ada.Directories; File_Filter : constant Filter_Type := (Ordinary_File => True, Directory => False, others => False); Dir_Filter : constant Filter_Type := (Ordinary_File => False, Directory => True, others => False); Ent : Ada.Directories.Directory_Entry_Type; Search : Search_Type; begin if not Ada.Directories.Exists (Path) then return; end if; Start_Search (Search, Directory => Path, Pattern => "*", Filter => File_Filter); while More_Entries (Search) loop Get_Next_Entry (Search, Ent); declare Name : constant String := Simple_Name (Ent); Full_Path : constant String := Ada.Directories.Full_Name (Ent); Doc : File_Document; Pos : constant Natural := Util.Strings.Rindex (Name, '.'); begin if Gen.Utils.Is_File_Ignored (Name) or Pos = 0 then Log.Debug ("File {0} ignored", Name); else Log.Debug ("Collect {0}", Full_Path); if Name (Pos .. Name'Last) = ".ads" then Handler.Read_Ada_File (Full_Path, Doc); elsif Name (Pos .. Name'Last) = ".xml" then Handler.Read_Xml_File (Full_Path, Doc); end if; Log.Info ("Adding document '{0}'", Name); Docs.Include (Name, Doc); end if; end; end loop; Start_Search (Search, Directory => Path, Pattern => "*", Filter => Dir_Filter); while More_Entries (Search) loop Get_Next_Entry (Search, Ent); declare Name : constant String := Simple_Name (Ent); begin if not Gen.Utils.Is_File_Ignored (Name) and Name /= "regtests" then Handler.Scan_Files (Ada.Directories.Full_Name (Ent), Docs); end if; end; end loop; end Scan_Files; -- ------------------------------ -- Returns True if the line indicates a bullet or numbered list. -- ------------------------------ function Is_List (Line : in String) return Boolean is begin if Line'Length <= 3 then return False; else return Line (Line'First + 2) = '*'; end if; end Is_List; -- ------------------------------ -- Returns True if the line indicates a code sample. -- ------------------------------ function Is_Code (Line : in String) return Boolean is begin if Line'Length <= 3 then return False; else return Line (Line'First) = ' ' and Line (Line'First + 1) = ' '; end if; end Is_Code; -- ------------------------------ -- Append a raw text line to the document. -- ------------------------------ procedure Append_Line (Doc : in out File_Document; Line : in String) is begin if Doc.State = IN_LIST then Doc.Lines.Append (Line_Type '(Len => Line'Length, Kind => L_LIST_ITEM, Content => Line)); else Doc.Lines.Append (Line_Type '(Len => Line'Length, Kind => L_TEXT, Content => Line)); end if; end Append_Line; -- ------------------------------ -- Look and analyze the tag defined on the line. -- ------------------------------ procedure Append_Tag (Doc : in out File_Document; Tag : in String) is use Ada.Strings.Unbounded; use Ada.Strings; Pos : constant Natural := Util.Strings.Index (Tag, ' '); begin if Pos = 0 then return; end if; declare Value : constant String := Ada.Strings.Fixed.Trim (Tag (Pos .. Tag'Last), Spaces, Spaces); begin if Tag (Tag'First .. Pos - 1) = TAG_TITLE then Doc.Title := To_Unbounded_String (Value); elsif Tag (Tag'First .. Pos - 1) = TAG_SEE then Doc.Lines.Append (Line_Type '(Len => Value'Length, Kind => L_SEE, Content => Value)); elsif Tag (Tag'First .. Pos - 1) = TAG_INCLUDE then Doc.Lines.Append (Line_Type '(Len => Value'Length, Kind => L_INCLUDE, Content => Value)); end if; end; end Append_Tag; -- ------------------------------ -- Analyse the documentation line and collect the documentation text. -- ------------------------------ procedure Append (Doc : in out File_Document; Line : in String) is begin if Line'Length >= 1 and then Line (Line'First) = TAG_CHAR then -- Force a close of the code extract if we see some @xxx command. if Doc.State = IN_CODE or Doc.State = IN_CODE_SEPARATOR then Append_Line (Doc, "}}}"); Append_Line (Doc, ""); end if; Doc.State := IN_PARA; Append_Tag (Doc, Line (Line'First + 1 .. Line'Last)); return; end if; case Doc.State is when IN_PARA => if Line'Length = 0 then Doc.State := IN_SEPARATOR; elsif Is_List (Line) then Doc.State := IN_LIST; end if; Append_Line (Doc, Line); when IN_SEPARATOR => if Is_List (Line) then Doc.State := IN_LIST; elsif Is_Code (Line) then Doc.State := IN_CODE; Append_Line (Doc, "{{{"); end if; Append_Line (Doc, Line); when IN_CODE => if Line'Length = 0 then Doc.State := IN_CODE_SEPARATOR; return; end if; Append_Line (Doc, Line); when IN_CODE_SEPARATOR => if Line'Length > 0 and then (Ada.Characters.Handling.Is_Letter (Line (Line'First)) or Line (Line'First) = '=') then Append_Line (Doc, "}}}"); Append_Line (Doc, ""); Doc.State := IN_PARA; end if; Append_Line (Doc, Line); when IN_LIST => if Is_List (Line) then Doc.Lines.Append (Line_Type '(Len => Line'Length, Kind => L_LIST, Content => Line)); elsif Line'Length = 0 then Doc.State := IN_SEPARATOR; Append_Line (Doc, Line); else Append_Line (Doc, " " & Ada.Strings.Fixed.Trim (Line, Ada.Strings.Left)); end if; end case; end Append; -- ------------------------------ -- After having collected the documentation, terminate the document by making sure -- the opened elements are closed. -- ------------------------------ procedure Finish (Doc : in out File_Document) is begin if Doc.State = IN_CODE or Doc.State = IN_CODE_SEPARATOR then Append_Line (Doc, "}}}"); Doc.State := IN_PARA; end if; end Finish; -- ------------------------------ -- Set the name associated with the document extract. -- ------------------------------ procedure Set_Name (Doc : in out File_Document; Name : in String) is S1 : String := Ada.Strings.Fixed.Trim (Name, Ada.Strings.Both); begin for I in S1'Range loop if S1 (I) = '.' or S1 (I) = '/' or S1 (I) = '\' then S1 (I) := '_'; end if; end loop; Doc.Name := Ada.Strings.Unbounded.To_Unbounded_String (S1); end Set_Name; -- ------------------------------ -- Set the title associated with the document extract. -- ------------------------------ procedure Set_Title (Doc : in out File_Document; Title : in String) is use Ada.Strings; Pos : Natural := Ada.Strings.Fixed.Index (Title, " -- "); begin if Pos = 0 then Pos := Title'First; else Pos := Pos + 4; end if; Doc.Title := Unbounded.To_Unbounded_String (Fixed.Trim (Title (Pos .. Title'Last), Both)); end Set_Title; -- ------------------------------ -- Read the Ada specification file and collect the useful documentation. -- To keep the implementation simple, we don't use the ASIS packages to scan and extract -- the documentation. We don't need to look at the Ada specification itself. Instead, -- we assume that the Ada source follows some Ada style guidelines. -- ------------------------------ procedure Read_Ada_File (Handler : in out Artifact; File : in String; Result : in out File_Document) is pragma Unreferenced (Handler); procedure Process (Line : in String); Done : Boolean := False; Doc_Block : Boolean := False; procedure Process (Line : in String) is begin Result.Line_Number := Result.Line_Number + 1; if Done then return; elsif Line'Length <= 1 then Doc_Block := False; elsif Line (Line'Last) = ASCII.CR then Result.Line_Number := Result.Line_Number - 1; Process (Line (Line'First .. Line'Last - 1)); elsif Line (Line'First) = '-' and Line (Line'First + 1) = '-' then if Doc_Block then if Line'Length < 4 then Append (Result, ""); elsif Line (Line'First + 2) = ' ' and Line (Line'First + 3) = ' ' then Append (Result, Line (Line'First + 4 .. Line'Last)); end if; elsif Line'Length >= 5 and then Line (Line'First .. Line'First + 4) = "-- =" then Doc_Block := True; Append (Result, Line (Line'First + 4 .. Line'Last)); elsif Result.Line_Number = 2 then Set_Title (Result, Line (Line'First + 2 .. Line'Last)); end if; else declare Pos : Natural := Ada.Strings.Fixed.Index (Line, "package"); Last : Natural; begin if Pos > 0 then Done := True; Pos := Ada.Strings.Fixed.Index (Line, " ", Pos); if Pos > 0 then Last := Ada.Strings.Fixed.Index (Line, " ", Pos + 1); Set_Name (Result, Line (Pos .. Last)); end if; end if; end; end if; end Process; begin Util.Files.Read_File (File, Process'Access); Finish (Result); end Read_Ada_File; -- ------------------------------ -- Read the XML file and extract the documentation. For this extraction we use -- an XSLT stylesheet and run the external tool <b>xstlproc</b>. -- ------------------------------ procedure Read_Xml_File (Handler : in out Artifact; File : in String; Result : in out File_Document) is Pipe : aliased Util.Streams.Pipes.Pipe_Stream; Reader : Util.Streams.Texts.Reader_Stream; Name : constant String := Ada.Directories.Base_Name (File); Command : constant String := Ada.Strings.Unbounded.To_String (Handler.Xslt_Command); Is_Empty : Boolean := True; begin Pipe.Open (Command & " " & File, Util.Processes.READ); Reader.Initialize (Pipe'Unchecked_Access); while not Reader.Is_Eof loop declare Line : Ada.Strings.Unbounded.Unbounded_String; begin Reader.Read_Line (Line, True); Log.Debug ("Doc: {0}", Line); if Ada.Strings.Unbounded.Length (Line) > 0 then Is_Empty := False; end if; Append_Line (Result, Ada.Strings.Fixed.Trim (Ada.Strings.Unbounded.To_String (Line), Spaces, Spaces)); end; end loop; Pipe.Close; Set_Title (Result, Name); Set_Name (Result, Name); if Pipe.Get_Exit_Status /= 0 then Log.Error ("Command {0} exited with status {1}", Command, Integer'Image (Pipe.Get_Exit_Status)); end if; if Is_Empty then Line_Vectors.Clear (Result.Lines); end if; exception when E : Util.Processes.Process_Error => Log.Error ("Command {0} failed: {1}", Command, Ada.Exceptions.Exception_Message (E)); end Read_Xml_File; end Gen.Artifacts.Docs;
----------------------------------------------------------------------- -- asf.server -- ASF Server -- 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 Ada.Finalization; with ASF.Requests; with ASF.Responses; with ASF.Servlets; package ASF.Server is type Container is tagged limited private; -- Register the application to serve requests procedure Register_Application (Server : in out Container; URI : in String; Context : in ASF.Servlets.Servlet_Registry_Access); -- Start the applications that have been registered. procedure Start (Server : in out Container); -- Receives standard HTTP requests from the public service method and dispatches -- them to the Do_XXX methods defined in this class. This method is an HTTP-specific -- version of the Servlet.service(Request, Response) method. There's no need -- to override this method. procedure Service (Server : in Container; Request : in out Requests.Request'Class; Response : in out Responses.Response'Class); -- Get the current registry associated with the current request being processed -- by the current thread. Returns null if there is no current request. function Current return ASF.Servlets.Servlet_Registry_Access; -- Give access to the current request and response object to the <b>Process</b> -- procedure. If there is no current request for the thread, do nothing. procedure Update_Context (Process : not null access procedure (Request : in out Requests.Request'Class; Response : in out Responses.Response'Class)); private -- Binding to record the ASF applications and bind them to URI prefixes. -- It is expected that the number of ASF applications is small (1-10 per server). type Binding is record Context : ASF.Servlets.Servlet_Registry_Access; Base_URI : access String; end record; type Binding_Array is array (Natural range <>) of Binding; type Binding_Array_Access is access all Binding_Array; type Container is new Ada.Finalization.Limited_Controlled with record Nb_Bindings : Natural := 0; Applications : Binding_Array_Access := null; Default : ASF.Servlets.Servlet_Registry; end record; type Request_Context is record Application : ASF.Servlets.Servlet_Registry_Access; Request : ASF.Requests.Request_Access; Response : ASF.Responses.Response_Access; end record; -- Set the current registry. This is called by <b>Service</b> once the -- registry is identified from the URI. procedure Set_Context (Context : in Request_Context); end ASF.Server;
with Ada.Text_IO; use Ada.Text_IO; procedure Hello is package Some_Interface is type The_Interface is limited interface; function f1(Self : The_Interface) return Integer is abstract; function f2(Self : The_Interface) return Integer is abstract; function f3(Self : The_Interface) return Integer is abstract; generic type Base is tagged limited private; package Mixin is type Derived is new Base and The_Interface with null record; overriding function f1(Self : Derived) return Integer; overriding function f2(Self : Derived) return Integer; overriding function f3(Self : Derived) return Integer; end Mixin; end Some_Interface; package body Some_Interface is package body Mixin is function f1(Self : Derived) return Integer is begin return 10; end f1; function f2(Self : Derived) return Integer is begin return 20; end f2; function f3(Self : Derived) return Integer is begin return Self.f1 + Self.f2; end f3; end Mixin; end Some_Interface; -- For examples using existing inheritance trees we need -- a base type type Third_Party_Base is tagged null record; package Examples is use Some_Interface; type Example_1 is limited new The_Interface with private; type Example_2 is new Third_Party_Base and The_Interface with private; private ----------------------------------------------- -- Packages ----------------------------------------------- -- For situations where you have no regular base class, -- this is needed for the Mixin contract type Secret_Base is tagged limited null record; package Example_1_Pkg is new Mixin(Base => Secret_Base); -- For situations where you already have a base class, the -- instantiation is simpler. package Example_2_Pkg is new Mixin(Base => Third_Party_Base); -- ****NOTE: You can chain multiple mixins to get defaults for -- various interfaces. For Example: -- package A_Pkg is new A_Mixin(Base => Some_Base); -- package B_Pkg is new B_Mixin(Base => A_Pkg.Derived); -- This will add both interfaces from A_Mixin and B_Mixin -- to the base type. ----------------------------------------------- -- Full Type Declarations ----------------------------------------------- type Example_1 is limited new Example_1_Pkg.Derived with null record; type Example_2 is new Example_2_Pkg.Derived with null record; end Examples; begin Put_Line("Hello, world!"); end Hello; -- ******************************************* -- -- However, note that the defaults follow the basic Ada rules. They don't -- redispatch unless you specify that (For example in f3 you would do things -- like The_Interface'Class(Self).f1 and so on). So you have to decide what -- you want those defaults really do. Redispatch is fairly dangerous to do -- in Ada since it is not the default for inherited programs. I would -- caution against it unless you have a real need and know what you are doing. -- And if you don't like the Mixin method, you can do something a bit closer to -- composition and Rust's model (though Ada doesn't support traits, so -- it has to be emulated by inheriting an interface instead): -- -- ******************************************* with Ada.Text_IO; use Ada.Text_IO; procedure Hello is package Some_Interface is type The_Interface is limited interface; function f1(Self : The_Interface) return Integer is abstract; function f2(Self : The_Interface) return Integer is abstract; function f3(Self : The_Interface) return Integer is abstract; type The_Default is new The_Interface with null record; overriding function f1(Self : The_Default) return Integer; overriding function f2(Self : The_Default) return Integer; overriding function f3(Self : The_Default) return Integer; end Some_Interface; package body Some_Interface is function f1(Self : The_Default) return Integer is begin return 10; end f1; function f2(Self : The_Default) return Integer is begin return 20; end f2; function f3(Self : The_Default) return Integer is begin return Self.f1 + Self.f2; end f3; end Some_Interface; -- For examples using existing inheritance trees we need -- a base type type Third_Party_Base is tagged null record; package Examples is use Some_Interface; type Example_1 is limited new The_Interface with private; overriding function f1(Self : Example_1) return Integer; overriding function f2(Self : Example_1) return Integer; overriding function f3(Self : Example_1) return Integer; type Example_2 is new Third_Party_Base and The_Interface with private; overriding function f1(Self : Example_2) return Integer; overriding function f2(Self : Example_2) return Integer; overriding function f3(Self : Example_2) return Integer; private ----------------------------------------------- -- Full Type Declarations ----------------------------------------------- type Example_1 is limited new The_Interface with record The_Interface_Impl : The_Default; end record; type Example_2 is new Third_Party_Base and The_Interface with record The_Interface_Impl : The_Default; end record; end Examples; package body Examples is function f1(Self : Example_1) return Integer is (Self.The_Interface_Impl.f1); function f2(Self : Example_1) return Integer is (Self.The_Interface_Impl.f2); function f3(Self : Example_1) return Integer is (Self.The_Interface_Impl.f3); function f1(Self : Example_2) return Integer is (Self.The_Interface_Impl.f1); function f2(Self : Example_2) return Integer is (Self.The_Interface_Impl.f2); function f3(Self : Example_2) return Integer is (Self.The_Interface_Impl.f3); end Examples; begin Put_Line("Hello, world!"); end Hello; -- ******************************************* -- -- This requires more footwork, but enforces that all -- implementors of the interface have to specify a body for all -- inherited abstract operations. generic type Base is interface ...; package Poor_Mans_Inheritance; type Instance is new Base with ...; overriding procedure Inherit_Me_Please (X : in out Instance); end Poor_Mans_Inheritance; type My_Type_I_Cannot_Use_Yet is new Base with ...; package Generic_Mess is new Poor_Mans_Inheritance (My_Type_I_Cannot_Use_Yet); type My_Type is new Generic_Mess.Instance with null record;
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with STM32.GPIO; with STM32.Device; with STM32_SVD.RCC; with STM32_SVD.SYSCFG; with STM32_SVD.Ethernet; use STM32_SVD.Ethernet; with Ada.Real_Time; -- SCz 2016-09-27: this is a stripped down version of stm32-eth.adb where the TX/RX -- ring initialization is removed as well as the interrupt handler with the Wait_Packet -- operation. The interrupt handler conflicts with the Net.Interfaces.STM32 driver. -- I've just re-used the MII initialization as well as the Ethernet descriptor types. package body STM32.Eth is --------------------- -- Initialize_RMII -- --------------------- procedure Initialize_RMII is use STM32.GPIO; use STM32.Device; use STM32_SVD.RCC; Configuration : GPIO_Port_Configuration; begin -- Enable GPIO clocks Enable_Clock (GPIO_A); Enable_Clock (GPIO_C); Enable_Clock (GPIO_G); -- Enable SYSCFG clock RCC_Periph.APB2ENR.SYSCFGEN := True; -- Select RMII (before enabling the clocks) STM32_SVD.SYSCFG.SYSCFG_Periph.PMC.MII_RMII_SEL := True; Configure_Alternate_Function (PA1, GPIO_AF_ETH_11); -- RMII_REF_CLK Configure_Alternate_Function (PA2, GPIO_AF_ETH_11); -- RMII_MDIO Configure_Alternate_Function (PA7, GPIO_AF_ETH_11); -- RMII_CRS_DV Configure_Alternate_Function (PC1, GPIO_AF_ETH_11); -- RMII_MDC Configure_Alternate_Function (PC4, GPIO_AF_ETH_11); -- RMII_RXD0 Configure_Alternate_Function (PC5, GPIO_AF_ETH_11); -- RMII_RXD1 Configure_Alternate_Function (PG2, GPIO_AF_ETH_11); -- RMII_RXER Configure_Alternate_Function (PG11, GPIO_AF_ETH_11); -- RMII_TX_EN Configure_Alternate_Function (PG13, GPIO_AF_ETH_11); -- RMII_TXD0 Configure_Alternate_Function (PG14, GPIO_AF_ETH_11); -- RMII_TXD1 Configuration := (Mode => Mode_AF, AF => GPIO_AF_ETH_11, AF_Speed => Speed_100MHz, AF_Output_Type => Push_Pull, Resistors => Floating); Configure_IO (PA1, Configuration); Configure_IO (PA2, Configuration); Configure_IO (PA7, Configuration); Configure_IO (PC1, Configuration); Configure_IO (PC4, Configuration); Configure_IO (PC5, Configuration); Configure_IO (PG2, Configuration); Configure_IO (PG11, Configuration); Configure_IO (PG13, Configuration); Configure_IO (PG14, Configuration); -- Enable clocks RCC_Periph.AHB1ENR.ETHMACEN := True; RCC_Periph.AHB1ENR.ETHMACTXEN := True; RCC_Periph.AHB1ENR.ETHMACRXEN := True; RCC_Periph.AHB1ENR.ETHMACPTPEN := True; -- Reset RCC_Periph.AHB1RSTR.ETHMACRST := True; RCC_Periph.AHB1RSTR.ETHMACRST := False; -- Software reset Ethernet_DMA_Periph.DMABMR.SR := True; while Ethernet_DMA_Periph.DMABMR.SR loop null; end loop; end Initialize_RMII; -------------- -- Read_MMI -- -------------- procedure Read_MMI (Reg : UInt5; Val : out Unsigned_16) is use Ada.Real_Time; Pa : constant UInt5 := 0; Cr : UInt3; begin case STM32.Device.System_Clock_Frequencies.HCLK is when 20e6 .. 35e6 - 1 => Cr := 2#010#; when 35e6 .. 60e6 - 1 => Cr := 2#011#; when 60e6 .. 100e6 - 1 => Cr := 2#000#; when 100e6 .. 150e6 - 1 => Cr := 2#001#; when 150e6 .. 216e6 => Cr := 2#100#; when others => raise Constraint_Error; end case; Ethernet_MAC_Periph.MACMIIAR := (PA => Pa, MR => Reg, CR => Cr, MW => False, MB => True, others => <>); loop exit when not Ethernet_MAC_Periph.MACMIIAR.MB; delay until Clock + Milliseconds (1); end loop; Val := Unsigned_16 (Ethernet_MAC_Periph.MACMIIDR.TD); end Read_MMI; end STM32.Eth;
with physics.Model, Physics, openGL.Model.terrain, openGL.IO, ada.unchecked_Deallocation, ada.unchecked_Conversion; package body gel.Terrain is type Heightfield_view is access all physics.Heightfield; type height_Map_view is access all opengl.height_Map; type height_map_Grid is array (math.Index range <>, math.Index range <>) of height_Map_view; function Width (Self : in opengl.height_Map) return math.Real is begin return math.Real (self'Length (2) - 1); end Width; function Depth (Self : in opengl.height_Map) return math.Real is begin return math.Real (self'Length (1) - 1); end Depth; function new_Terrain (World : in gel.World.view; heights_File : in String; texture_File : in String := ""; Scale : in math.Vector_3 := (1.0, 1.0, 1.0)) return access gel.Sprite.Grid is use Math; the_Pixels : opengl.IO.height_Map_view := opengl.IO.to_height_Map (openGL.to_Asset (heights_File)); tile_Width : constant Positive := 8 * 32 - 1; tile_Depth : constant Positive := 8 * 32 - 1; total_Width : constant Real := Real (the_Pixels'Length (2) - 1) * Scale (1); total_Depth : constant Real := Real (the_Pixels'Length (1) - 1) * Scale (3); base_Centre : constant Vector_3 := (0.0, 0.0, 0.0); function Grid_last (total_Size, tile_Size : in Positive) return math.Index is Last : constant math.Index := math.Index ( 1 + (total_Size - 1) / tile_Size); begin return Last; end Grid_last; the_heightmap_Grid : height_map_Grid (1 .. Grid_last (the_Pixels'Length (1), tile_Depth), 1 .. Grid_last (the_Pixels'Length (2), tile_Width)); the_Sprite_Grid : constant gel.Sprite.Grid_view := new gel.Sprite.Grid (the_heightmap_Grid'Range (1), the_heightmap_Grid'Range (2)); procedure free is new ada.unchecked_Deallocation (opengl.height_Map, opengl.IO.height_Map_view); procedure flip (Self : opengl.IO.height_Map_view) is use type opengl.Index_t; the_Map : opengl.IO.height_Map_view := new opengl.height_Map' (Self.all); begin for Row in Self'Range (1) loop for Col in Self'Range (2) loop Self (Row, Col) := the_Map (Self'Last (1) - Row + 1, Col); end loop; end loop; free (the_Map); end flip; begin flip (the_Pixels.all'unchecked_Access); -- Create each grid elements 'heightmap'. -- declare use openGL; row_First, row_Last, col_First, col_Last : math.Index; -- Row and col ranges for each sub-matrix. begin for Row in the_sprite_Grid'Range (1) loop row_First := math.Index (tile_Depth - 1) * (Row - 1) + 1; row_Last := math.Index'Min (row_First + math.Index (tile_Depth - 1), math.Index (the_Pixels'Last (1))); for Col in the_sprite_Grid'Range (2) loop col_First := math.Index (tile_Width - 1) * (Col - 1) + 1; col_Last := math.Index'Min (col_First + math.Index (tile_Width - 1), math.Index (the_Pixels'Last (2))); the_heightmap_Grid (Row, Col) := new opengl.height_Map' (Region (the_Pixels.all, (Index_t (row_First), Index_t (row_Last)), (Index_t (col_First), Index_t (col_Last)))); end loop; end loop; end; -- Create the Sprite for each grid element. -- declare site_X_offset, site_Z_offset : Real := 0.0; site_Y_Offset : Real; tile_X_Offset : Real := 0.0; tile_Z_Offset : Real := total_Depth; tile_X_Scale : Real; tile_Z_Scale : Real; begin for Row in the_sprite_Grid'Range (1) loop site_X_offset := 0.0; tile_X_Offset := 0.0; tile_Z_Offset := tile_Z_Offset - Depth (the_heightmap_Grid (Row, 1).all) * Scale (3); for Col in the_sprite_Grid'Range (2) loop tile_Z_Scale := Depth (the_heightmap_Grid (Row, 1).all) / total_Depth; tile_X_Scale := Width (the_heightmap_Grid (Row, Col).all) / total_Width; declare the_Region : constant height_Map_view := the_heightmap_Grid (Row, Col); the_height_Range : constant opengl.Vector_2 := openGL.height_Extent (the_Region.all); Tiling : constant opengl.texture_Transform_2d := (S => (opengl.Real (tile_X_Offset / total_Width) / opengl.Real (tile_X_Scale * Scale (1)), opengl.Real (tile_X_Scale * Scale (1))), T => (opengl.Real (tile_Z_Offset / total_Depth) / opengl.Real (tile_Z_Scale * Scale (3)), opengl.Real (tile_Z_Scale * Scale (3)))); the_ground_Model : constant access openGL.Model.terrain.item := openGL.Model.terrain.new_Terrain (heights_Asset => openGL.to_Asset (heights_File), Row => Row, Col => Col, Heights => the_Region.all'Access, color_Map => openGL.to_Asset (texture_File), Tiling => Tiling); function to_Physics is new ada.unchecked_Conversion (height_Map_view, Heightfield_view); the_ground_physics_Model : constant physics.Model.view := new physics.Model.item' (Id => physics.null_model_Id, -- Site => Origin_3d, Scale => Scale, shape_Info => (physics.Model.Heightfield, Heights => to_Physics (the_Region), height_range => (the_height_Range (1), the_height_Range (2))), Shape => null, Mass => 0.0, Friction => 0.5, Restitution => 0.5, is_Tangible => True); the_height_Extents : constant opengl.Vector_2 := opengl.height_Extent (the_Region.all); the_Sprite : gel.Sprite.view renames the_sprite_Grid (Row, Col); the_Site : vector_3; begin -- the_ground_Model.Scale := (Scale (1), -- Scale (2), -- Scale (3)); the_Site := (0.0, 0.0, 0.0); the_Sprite := gel.Sprite.Forge.new_Sprite ("Terrain" & Row'Image & Col'Image, sprite.World_view (World), the_Site, the_ground_Model, the_ground_physics_Model, owns_Graphics => True, owns_Physics => True); site_y_Offset := math.Real ( the_height_Extents (1) + (the_height_Extents (2) - the_height_Extents (1)) / 2.0); -- the_sprite_Grid (Row, Col).Site_is (the_Site + base_Centre); the_Sprite. Site_is (the_Site + base_Centre); the_Sprite.Scale_is (Scale); tile_X_Offset := tile_X_Offset + Width (the_heightmap_Grid (Row, Col).all) * Scale (1); if Col /= the_sprite_Grid'Last (2) then site_X_offset := site_X_offset + Width (the_heightmap_Grid (Row, Col ).all) * Scale (1) / 2.0 + Width (the_heightmap_Grid (Row, Col + 1).all) * Scale (1) / 2.0; end if; end; end loop; if Row /= the_sprite_Grid'Last (1) then site_Z_offset := site_Z_offset + Depth (the_heightmap_Grid (Row, 1).all) * Scale (3) / 2.0 + Depth (the_heightmap_Grid (Row + 1, 1).all) * Scale (3) / 2.0; end if; end loop; end; free (the_Pixels); return the_Sprite_Grid; end new_Terrain; end gel.Terrain;
-- REST API Validation -- API to validate -- -- The version of the OpenAPI document: 1.0.0 -- Contact: Stephane.Carrez@gmail.com -- -- NOTE: This package is auto generated by OpenAPI-Generator 5.2.1-SNAPSHOT. -- https://openapi-generator.tech -- Do not edit the class manually. with Swagger.Streams; with Ada.Containers.Vectors; package TestAPI.Models is pragma Style_Checks ("-mr"); -- ------------------------------ -- Information about a ticket -- ------------------------------ type Ticket_Type is record Id : Swagger.Long; Title : Swagger.UString; Description : Swagger.UString; Owner : Swagger.Nullable_UString; Create_Date : Swagger.Datetime; End_Date : Swagger.Nullable_Date; Update_Date : Swagger.Nullable_Date; Status : Swagger.UString; end record; package Ticket_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => Ticket_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Ticket_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Ticket_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Ticket_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Ticket_Type_Vectors.Vector); type StringsMap_Type is record Key : Swagger.Nullable_UString; end record; package StringsMap_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => StringsMap_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in StringsMap_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in StringsMap_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out StringsMap_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out StringsMap_Type_Vectors.Vector); type InlineObject3_Type is record Requested_Qo_S : TestAPI.Models.StringsMap_Type; Commands : TestAPI.Models.StringsMap_Type; end record; package InlineObject3_Type_Vectors is new Ada.Containers.Vectors (Index_Type => Positive, Element_Type => InlineObject3_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in InlineObject3_Type); procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in InlineObject3_Type_Vectors.Vector); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out InlineObject3_Type); procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out InlineObject3_Type_Vectors.Vector); end TestAPI.Models;
with Ada.Text_IO; with XML; procedure version is begin Ada.Text_IO.Put_Line (XML.Version); end version;
pragma License (Unrestricted); with Ada.Strings.Maps.Constants; private with Ada.Strings.Maps.Naked; private with Ada.Strings.Naked_Maps.Set_Constants; package Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants is pragma Preelaborate; -- extended -- There are sets of unicode category. function Unassigned_Set return Wide_Wide_Character_Set renames Maps.Constants.Unassigned_Set; function Uppercase_Letter_Set return Wide_Wide_Character_Set renames Maps.Constants.Uppercase_Letter_Set; function Lowercase_Letter_Set return Wide_Wide_Character_Set renames Maps.Constants.Lowercase_Letter_Set; function Titlecase_Letter_Set return Wide_Wide_Character_Set renames Maps.Constants.Titlecase_Letter_Set; function Modifier_Letter_Set return Wide_Wide_Character_Set renames Maps.Constants.Modifier_Letter_Set; function Other_Letter_Set return Wide_Wide_Character_Set renames Maps.Constants.Other_Letter_Set; function Decimal_Number_Set return Wide_Wide_Character_Set renames Maps.Constants.Decimal_Number_Set; function Letter_Number_Set return Wide_Wide_Character_Set renames Maps.Constants.Letter_Number_Set; function Other_Number_Set return Wide_Wide_Character_Set renames Maps.Constants.Other_Number_Set; function Line_Separator_Set return Wide_Wide_Character_Set renames Maps.Constants.Line_Separator_Set; function Paragraph_Separator_Set return Wide_Wide_Character_Set renames Maps.Constants.Paragraph_Separator_Set; function Control_Set return Wide_Wide_Character_Set renames Maps.Constants.Control_Set; function Format_Set return Wide_Wide_Character_Set renames Maps.Constants.Format_Set; function Private_Use_Set return Wide_Wide_Character_Set renames Maps.Constants.Private_Use_Set; function Surrogate_Set return Wide_Wide_Character_Set renames Maps.Constants.Surrogate_Set; -- extended function Base_Set return Wide_Wide_Character_Set renames Maps.Constants.Base_Set; -- Control_Set : constant Wide_Wide_Character_Set; -- Control_Set is declared as unicode category in above. -- Graphic_Set : constant Wide_Wide_Character_Set; function Graphic_Set return Wide_Wide_Character_Set renames Maps.Constants.Graphic_Set; -- Letter_Set : constant Wide_Wide_Character_Set; function Letter_Set return Wide_Wide_Character_Set renames Maps.Constants.Letter_Set; -- Lower_Set : constant Wide_Wide_Character_Set; function Lower_Set return Wide_Wide_Character_Set renames Lowercase_Letter_Set; -- Note: Lower_Set is extended for all unicode characters. -- Upper_Set : constant Wide_Wide_Character_Set; function Upper_Set return Wide_Wide_Character_Set renames Uppercase_Letter_Set; -- Note: Upper_Set is extended for all unicode characters. -- Basic_Set : constant Wide_Wide_Character_Set; function Basic_Set return Wide_Wide_Character_Set renames Maps.Constants.Basic_Set; -- Note: Basic_Set is extended for all unicode characters. -- Decimal_Digit_Set : constant Wide_Wide_Character_Set; function Decimal_Digit_Set return Wide_Wide_Character_Set renames Maps.Constants.Decimal_Digit_Set; -- Note: Decimal_Digit_Set is NOT extended for parsing. -- Hexadecimal_Digit_Set : constant Wide_Wide_Character_Set; function Hexadecimal_Digit_Set return Wide_Wide_Character_Set renames Maps.Constants.Hexadecimal_Digit_Set; -- Note: Hexadecimal_Digit_Set is NOT extended for parsing. -- Alphanumeric_Set : constant Wide_Wide_Character_Set; function Alphanumeric_Set return Wide_Wide_Character_Set renames Maps.Constants.Alphanumeric_Set; -- Special_Set : constant Wide_Wide_Character_Set; function Special_Set return Wide_Wide_Character_Set renames Maps.Constants.Special_Set; -- ISO_646_Set : constant Wide_Wide_Character_Set; function ISO_646_Set return Wide_Wide_Character_Set renames Maps.Constants.ISO_646_Set; -- Lower_Case_Map : constant Wide_Wide_Character_Mapping; function Lower_Case_Map return Wide_Wide_Character_Mapping renames Maps.Constants.Lower_Case_Map; -- Maps to lower case for letters, else identity -- Note: Lower_Case_Map is extended for all unicode characters. -- Upper_Case_Map : constant Wide_Wide_Character_Mapping; function Upper_Case_Map return Wide_Wide_Character_Mapping renames Maps.Constants.Upper_Case_Map; -- Maps to upper case for letters, else identity -- Note: Upper_Case_Map is extended for all unicode characters. -- extended from here function Case_Folding_Map return Wide_Wide_Character_Mapping renames Maps.Constants.Case_Folding_Map; -- to here -- Basic_Map : constant Wide_Wide_Character_Mapping; function Basic_Map return Wide_Wide_Character_Mapping renames Maps.Constants.Basic_Map; -- Maps to basic letter for letters, else identity -- Note: Basic_Map is extended for all unicode characters, and not -- limited to letters. -- RM A.4.8 -- Character_Set : constant Wide_Wide_Maps.Wide_Wide_Character_Set; function Character_Set return Wide_Wide_Character_Set renames ISO_646_Set; -- Contains each Wide_Wide_Character value WWC such that -- Characters.Conversions.Is_Character(WWC) is True -- Note: (16#7F# .. 16#FF#) is excluded from Character_Set. -- Wide_Character_Set : constant Wide_Wide_Maps.Wide_Wide_Character_Set; function Wide_Character_Set return Wide_Wide_Character_Set; -- Contains each Wide_Wide_Character value WWC such that -- Characters.Conversions.Is_Wide_Character(WWC) is True -- Note: The range of surrogate pair is excluded -- from Wide_Character_Set. pragma Inline (Wide_Character_Set); private function Wide_Character_Set_Body is new Maps.Naked.To_Set (Naked_Maps.Set_Constants.Wide_Character_Set); function Wide_Character_Set return Wide_Wide_Character_Set renames Wide_Character_Set_Body; end Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants;
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- S W I T C H - M -- -- -- -- S p e c -- -- -- -- Copyright (C) 2001-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package scans make switches. Note that the body of Usage must be -- coordinated with the switches that are recognized by this package. -- The Usage package also acts as the official documentation for the -- switches that are recognized. In addition, package Debug documents -- the otherwise undocumented debug switches that are also recognized. pragma Warnings (Off); -- This package is used also by gnatcoll with System.OS_Lib; use System.OS_Lib; pragma Warnings (On); package Switch.M is Subdirs : String_Ptr := null; -- The value after the equal sign in switch --subdirs=... -- Contains the relative subdirectory. procedure Scan_Make_Switches (Switch_Chars : String; Success : out Boolean); -- Scan a gnatmake switch and act accordingly. For switches that are -- recognized, Success is set to True. A switch that is not recognized and -- consists of one small letter causes a fatal error exit and control does -- not return. For all other not recognized switches, Success is set to -- False, so that the switch may be passed to the compiler. -- -- Project_Node_Tree is used to store tree-specific parameters like the -- project path. procedure Normalize_Compiler_Switches (Switch_Chars : String; Switches : in out Argument_List_Access; Last : out Natural); -- Takes a compiler switch which potentially is equivalent to more -- that one simple switches and returns the equivalent list of simple -- switches that are stored in an ALI file. Switches will be extended -- if initially null or too short. Last indicates the index in Switches -- of the last simple switch. Last is equal to zero, if it has been -- determined that Switch_Chars is ill-formed or does not contain any -- switch that should be stored in an ALI file. Otherwise, the list of -- simple switches is Switches (Switches'First .. Last). -- -- Example: if Switch_Chars is equal to "-gnatAwue", then the list of -- simple switches will have 3 components: -gnatA, -gnatwu, -gnatwe. -- -- The String_Access components of Switches should not be deallocated: -- they are shallow copies of components in a table in the body. function Normalize_Compiler_Switches (Switch_Chars : String) return Argument_List; -- Similar to the previous procedure. The return value is the list of -- simple switches. It may be an empty array if it has been determined -- that Switch_Chars is ill-formed or does not contain any switch that -- should be stored in an ALI file. The String_Access components of the -- returned value should not be deallocated. end Switch.M;
with Ada.Text_IO; use Ada.Text_IO; with issue; with wa1; with wa2; procedure run_gb_03 is B1 : wa1.Base; B2 : wa2.Base; BI : issue.Base; begin Put_Line("started main"); Put_Line("starting workaround 1"); B1.Set_Smth(1); Put_Line("workaround 1 done"); New_Line; Put_Line("starting workaround 2"); B2.Set_Smth(1); Put_Line("workaround 2 done"); New_Line; Put_Line("starting issue"); BI.Set_Smth(1); Put_Line("issue done"); end run_gb_03;
with Ada.Text_IO; package body Problem_68 is package IO renames Ada.Text_IO; -- They want 16 digit strings, so we know that every solution will -- have a 10 on the outside edge of one of the flanges, so we can -- always start there. subtype Digit is Positive range 1 .. 10; subtype Position is Positive range 1 .. 10; taken : Array (Digit) of Boolean := (10 => True, others => False); -- 1 + 2 + 3 -- 4 + 3 + 5 -- 6 + 5 + 7 -- 8 + 7 + 9 -- 10 + 9 + 2 values : Array (Position) of Digit; flanges : constant Array(1 .. 5) of Position := (1, 4, 6, 8, 10); output_order : constant Array (1 .. 15) of Positive := (1, 2, 3, 4, 3, 5, 6, 5, 7, 8, 7, 9, 10, 9, 2); result : String(1 .. 16); sum : Positive; procedure MakeResult is min : Position := 1; flange : Positive := 1; result_index : Positive := 1; new_result : String(1 .. 16); begin for i in flanges'Range loop if values(flanges(i)) < values(min) then flange := i; min := flanges(i); end if; end loop; flange := flange * 3; for i in flange .. output_order'Last loop if values(output_order(i)) = 10 then new_result(result_index) := '1'; new_result(result_index + 1) := '0'; result_index := result_index + 2; else new_result(result_index) := Character'Val(Character'Pos('0') + values(output_order(i))); result_index := result_index + 1; end if; end loop; for i in 1 .. flange - 1 loop if values(output_order(i)) = 10 then new_result(result_index) := '1'; new_result(result_index + 1) := '0'; result_index := result_index + 2; else new_result(result_index) := Character'Val(Character'Pos('0') + values(output_order(i))); result_index := result_index + 1; end if; end loop; if result < new_result then result := new_result; end if; end MakeResult; procedure SolveTenth is num : constant Integer := sum - values(9) - values(2); begin if (num > 0 and num < 10) and then not taken(num) then values(10) := num; taken(num) := True; MakeResult; taken(num) := False; end if; end SolveTenth; procedure SolveNinth is num : constant Integer := sum - values(8) - values(7); begin if (num > 0 and num < 10) and then not taken(num) then values(9) := num; taken(num) := True; SolveTenth; taken(num) := False; end if; end SolveNinth; procedure SolveEighth is begin for num in taken'Range loop if not taken(num) then values(8) := num; taken(num) := True; SolveNinth; taken(num) := False; end if; end loop; end SolveEighth; procedure SolveSeventh is num : constant Integer := sum - values(6) - values(5); begin if (num > 0 and num < 10) and then not taken(num) then values(7) := num; taken(num) := True; SolveEighth; taken(num) := False; end if; end SolveSeventh; procedure SolveSixth is begin for num in taken'Range loop if not taken(num) then values(6) := num; taken(num) := True; SolveSeventh; taken(num) := False; end if; end loop; end SolveSixth; procedure SolveFifth is num : constant Integer := sum - values(3) - values(4); begin if (num > 0 and num < 10) and then not taken(num) then values(5) := num; taken(num) := True; SolveSixth; taken(num) := False; end if; end SolveFifth; procedure SolveFourth is begin for num in taken'Range loop if not taken(num) then values(4) := num; taken(num) := True; SolveFifth; taken(num) := False; end if; end loop; end SolveFourth; procedure SolveThird is begin for num in taken'Range loop if not taken(num) then values(3) := num; taken(num) := True; sum := values(1) + values(2) + values(3); SolveFourth; taken(num) := False; end if; end loop; end SolveThird; procedure SolveSecond is begin for num in taken'Range loop if not taken(num) then values(2) := num; taken(num) := True; SolveThird; taken(num) := False; end if; end loop; end SolveSecond; procedure Solve is begin values(1) := 10; SolveSecond; IO.Put_Line(result); end Solve; end Problem_68;
with Interfaces; use Interfaces; package body Natools.Smaz_Test_Base_64_Hash is P : constant array (0 .. 3) of Natural := (1, 2, 3, 4); T1 : constant array (0 .. 3) of Unsigned_8 := (97, 46, 76, 56); T2 : constant array (0 .. 3) of Unsigned_8 := (81, 17, 92, 120); G : constant array (0 .. 120) of Unsigned_8 := (0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 9, 0, 42, 0, 0, 0, 2, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 14, 0, 52, 0, 39, 6, 6, 7, 18, 0, 24, 0, 36, 0, 17, 38, 44, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 11, 56, 0, 32, 0, 0, 0, 0, 0, 0, 25, 41, 6, 0, 47, 0, 27, 0, 33, 7, 0, 0, 33, 43, 36, 0, 28, 0, 39, 0, 39, 48, 41, 0, 0, 16, 18, 53, 9, 29, 43, 0, 0, 34, 49, 0, 0, 0, 5, 0, 47, 59, 53, 23, 0, 5, 22, 46, 29, 34, 28, 3, 4); function Hash (S : String) return Natural is F : constant Natural := S'First - 1; L : constant Natural := S'Length; F1, F2 : Natural := 0; J : Natural; begin for K in P'Range loop exit when L < P (K); J := Character'Pos (S (P (K) + F)); F1 := (F1 + Natural (T1 (K)) * J) mod 121; F2 := (F2 + Natural (T2 (K)) * J) mod 121; end loop; return (Natural (G (F1)) + Natural (G (F2))) mod 60; end Hash; end Natools.Smaz_Test_Base_64_Hash;
with Ada.Text_IO; procedure Euler17 is Word_Lengths : array(Natural range <>) of Natural := ( String'("")'Length, String'("one")'Length, String'("two")'Length, String'("three")'Length, String'("four")'Length, String'("five")'Length, String'("six")'Length, String'("seven")'Length, String'("eight")'Length, String'("nine")'Length, String'("ten")'Length, String'("eleven")'Length, String'("twelve")'Length, String'("thirteen")'Length, String'("fourteen")'Length, String'("fifteen")'Length, String'("sixteen")'Length, String'("seventeen")'Length, String'("eighteen")'Length, String'("nineteen")'Length); Word_Ty_Lengths : array(Natural range <>) of Natural := (String'("")'Length, String'("")'Length, String'("twenty")'Length, String'("thirty")'Length, String'("forty")'Length, String'("fifty")'Length, String'("sixty")'Length, String'("seventy")'Length, String'("eighty")'Length, String'("ninety")'Length); function Word_Length(N : Natural) return Natural is Sum : Natural; begin if N <= 19 then return Word_Lengths(N); elsif N <= 99 then return Word_Ty_Lengths(N / 10) + Word_Lengths(N mod 10); elsif N = 1000 then return String'("onethousand")'Length; else Sum := Word_Lengths(N / 100) + String'("hundred")'Length; if N mod 100 > 0 then Sum := Sum + String'("and")'Length + Word_Length(N mod 100); end if; return Sum; end if; end; Sum : Natural := 0; begin for X in 1 .. 1000 loop Sum := Sum + Word_Length(X); end loop; Ada.Text_IO.Put_Line(Integer'Image(Sum)); end;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . S T R I N G S . W I D E _ M A P S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; package body Ada.Strings.Wide_Maps is --------- -- "-" -- --------- function "-" (Left, Right : Wide_Character_Set) return Wide_Character_Set is LS : constant Wide_Character_Ranges_Access := Left.Set; RS : constant Wide_Character_Ranges_Access := Right.Set; Result : Wide_Character_Ranges (1 .. LS'Last + RS'Last); -- Each range on the right can generate at least one more range in -- the result, by splitting one of the left operand ranges. N : Natural := 0; R : Natural := 1; L : Natural := 1; Left_Low : Wide_Character; -- Left_Low is lowest character of the L'th range not yet dealt with begin if LS'Last = 0 or else RS'Last = 0 then return Left; end if; Left_Low := LS (L).Low; while R <= RS'Last loop -- If next right range is below current left range, skip it if RS (R).High < Left_Low then R := R + 1; -- If next right range above current left range, copy remainder -- of the left range to the result elsif RS (R).Low > LS (L).High then N := N + 1; Result (N).Low := Left_Low; Result (N).High := LS (L).High; L := L + 1; exit when L > LS'Last; Left_Low := LS (L).Low; else -- Next right range overlaps bottom of left range if RS (R).Low <= Left_Low then -- Case of right range complete overlaps left range if RS (R).High >= LS (L).High then L := L + 1; exit when L > LS'Last; Left_Low := LS (L).Low; -- Case of right range eats lower part of left range else Left_Low := Wide_Character'Succ (RS (R).High); R := R + 1; end if; -- Next right range overlaps some of left range, but not bottom else N := N + 1; Result (N).Low := Left_Low; Result (N).High := Wide_Character'Pred (RS (R).Low); -- Case of right range splits left range if RS (R).High < LS (L).High then Left_Low := Wide_Character'Succ (RS (R).High); R := R + 1; -- Case of right range overlaps top of left range else L := L + 1; exit when L > LS'Last; Left_Low := LS (L).Low; end if; end if; end if; end loop; -- Copy remainder of left ranges to result if L <= LS'Last then N := N + 1; Result (N).Low := Left_Low; Result (N).High := LS (L).High; loop L := L + 1; exit when L > LS'Last; N := N + 1; Result (N) := LS (L); end loop; end if; return (AF.Controlled with Set => new Wide_Character_Ranges'(Result (1 .. N))); end "-"; --------- -- "=" -- --------- -- The sorted, discontiguous form is canonical, so equality can be used function "=" (Left, Right : Wide_Character_Set) return Boolean is begin return Left.Set.all = Right.Set.all; end "="; ----------- -- "and" -- ----------- function "and" (Left, Right : Wide_Character_Set) return Wide_Character_Set is LS : constant Wide_Character_Ranges_Access := Left.Set; RS : constant Wide_Character_Ranges_Access := Right.Set; Result : Wide_Character_Ranges (1 .. LS'Last + RS'Last); N : Natural := 0; L, R : Natural := 1; begin -- Loop to search for overlapping character ranges while L <= LS'Last and then R <= RS'Last loop if LS (L).High < RS (R).Low then L := L + 1; elsif RS (R).High < LS (L).Low then R := R + 1; -- Here we have LS (L).High >= RS (R).Low -- and RS (R).High >= LS (L).Low -- so we have an overlapping range else N := N + 1; Result (N).Low := Wide_Character'Max (LS (L).Low, RS (R).Low); Result (N).High := Wide_Character'Min (LS (L).High, RS (R).High); if RS (R).High = LS (L).High then L := L + 1; R := R + 1; elsif RS (R).High < LS (L).High then R := R + 1; else L := L + 1; end if; end if; end loop; return (AF.Controlled with Set => new Wide_Character_Ranges'(Result (1 .. N))); end "and"; ----------- -- "not" -- ----------- function "not" (Right : Wide_Character_Set) return Wide_Character_Set is RS : constant Wide_Character_Ranges_Access := Right.Set; Result : Wide_Character_Ranges (1 .. RS'Last + 1); N : Natural := 0; begin if RS'Last = 0 then N := 1; Result (1) := (Low => Wide_Character'First, High => Wide_Character'Last); else if RS (1).Low /= Wide_Character'First then N := N + 1; Result (N).Low := Wide_Character'First; Result (N).High := Wide_Character'Pred (RS (1).Low); end if; for K in 1 .. RS'Last - 1 loop N := N + 1; Result (N).Low := Wide_Character'Succ (RS (K).High); Result (N).High := Wide_Character'Pred (RS (K + 1).Low); end loop; if RS (RS'Last).High /= Wide_Character'Last then N := N + 1; Result (N).Low := Wide_Character'Succ (RS (RS'Last).High); Result (N).High := Wide_Character'Last; end if; end if; return (AF.Controlled with Set => new Wide_Character_Ranges'(Result (1 .. N))); end "not"; ---------- -- "or" -- ---------- function "or" (Left, Right : Wide_Character_Set) return Wide_Character_Set is LS : constant Wide_Character_Ranges_Access := Left.Set; RS : constant Wide_Character_Ranges_Access := Right.Set; Result : Wide_Character_Ranges (1 .. LS'Last + RS'Last); N : Natural; L, R : Natural; begin N := 0; L := 1; R := 1; -- Loop through ranges in output file loop -- If no left ranges left, copy next right range if L > LS'Last then exit when R > RS'Last; N := N + 1; Result (N) := RS (R); R := R + 1; -- If no right ranges left, copy next left range elsif R > RS'Last then N := N + 1; Result (N) := LS (L); L := L + 1; else -- We have two ranges, choose lower one N := N + 1; if LS (L).Low <= RS (R).Low then Result (N) := LS (L); L := L + 1; else Result (N) := RS (R); R := R + 1; end if; -- Loop to collapse ranges into last range loop -- Collapse next length range into current result range -- if possible. if L <= LS'Last and then LS (L).Low <= Wide_Character'Succ (Result (N).High) then Result (N).High := Wide_Character'Max (Result (N).High, LS (L).High); L := L + 1; -- Collapse next right range into current result range -- if possible elsif R <= RS'Last and then RS (R).Low <= Wide_Character'Succ (Result (N).High) then Result (N).High := Wide_Character'Max (Result (N).High, RS (R).High); R := R + 1; -- If neither range collapses, then done with this range else exit; end if; end loop; end if; end loop; return (AF.Controlled with Set => new Wide_Character_Ranges'(Result (1 .. N))); end "or"; ----------- -- "xor" -- ----------- function "xor" (Left, Right : Wide_Character_Set) return Wide_Character_Set is begin return (Left or Right) - (Left and Right); end "xor"; ------------ -- Adjust -- ------------ procedure Adjust (Object : in out Wide_Character_Mapping) is begin Object.Map := new Wide_Character_Mapping_Values'(Object.Map.all); end Adjust; procedure Adjust (Object : in out Wide_Character_Set) is begin Object.Set := new Wide_Character_Ranges'(Object.Set.all); end Adjust; -------------- -- Finalize -- -------------- procedure Finalize (Object : in out Wide_Character_Mapping) is procedure Free is new Ada.Unchecked_Deallocation (Wide_Character_Mapping_Values, Wide_Character_Mapping_Values_Access); begin if Object.Map /= Null_Map'Unrestricted_Access then Free (Object.Map); end if; end Finalize; procedure Finalize (Object : in out Wide_Character_Set) is procedure Free is new Ada.Unchecked_Deallocation (Wide_Character_Ranges, Wide_Character_Ranges_Access); begin if Object.Set /= Null_Range'Unrestricted_Access then Free (Object.Set); end if; end Finalize; ---------------- -- Initialize -- ---------------- procedure Initialize (Object : in out Wide_Character_Mapping) is begin Object := Identity; end Initialize; procedure Initialize (Object : in out Wide_Character_Set) is begin Object := Null_Set; end Initialize; ----------- -- Is_In -- ----------- function Is_In (Element : Wide_Character; Set : Wide_Character_Set) return Boolean is L, R, M : Natural; SS : constant Wide_Character_Ranges_Access := Set.Set; begin L := 1; R := SS'Last; -- Binary search loop. The invariant is that if Element is in any of -- of the constituent ranges it is in one between Set (L) and Set (R). loop if L > R then return False; else M := (L + R) / 2; if Element > SS (M).High then L := M + 1; elsif Element < SS (M).Low then R := M - 1; else return True; end if; end if; end loop; end Is_In; --------------- -- Is_Subset -- --------------- function Is_Subset (Elements : Wide_Character_Set; Set : Wide_Character_Set) return Boolean is ES : constant Wide_Character_Ranges_Access := Elements.Set; SS : constant Wide_Character_Ranges_Access := Set.Set; S : Positive := 1; E : Positive := 1; begin loop -- If no more element ranges, done, and result is true if E > ES'Last then return True; -- If more element ranges, but no more set ranges, result is false elsif S > SS'Last then return False; -- Remove irrelevant set range elsif SS (S).High < ES (E).Low then S := S + 1; -- Get rid of element range that is properly covered by set elsif SS (S).Low <= ES (E).Low and then ES (E).High <= SS (S).High then E := E + 1; -- Otherwise we have a non-covered element range, result is false else return False; end if; end loop; end Is_Subset; --------------- -- To_Domain -- --------------- function To_Domain (Map : Wide_Character_Mapping) return Wide_Character_Sequence is begin return Map.Map.Domain; end To_Domain; ---------------- -- To_Mapping -- ---------------- function To_Mapping (From, To : Wide_Character_Sequence) return Wide_Character_Mapping is Domain : Wide_Character_Sequence (1 .. From'Length); Rangev : Wide_Character_Sequence (1 .. To'Length); N : Natural := 0; begin if From'Length /= To'Length then raise Translation_Error; else pragma Warnings (Off); -- apparent uninit use of Domain for J in From'Range loop for M in 1 .. N loop if From (J) = Domain (M) then raise Translation_Error; elsif From (J) < Domain (M) then Domain (M + 1 .. N + 1) := Domain (M .. N); Rangev (M + 1 .. N + 1) := Rangev (M .. N); Domain (M) := From (J); Rangev (M) := To (J); goto Continue; end if; end loop; Domain (N + 1) := From (J); Rangev (N + 1) := To (J); <<Continue>> N := N + 1; end loop; pragma Warnings (On); return (AF.Controlled with Map => new Wide_Character_Mapping_Values'( Length => N, Domain => Domain (1 .. N), Rangev => Rangev (1 .. N))); end if; end To_Mapping; -------------- -- To_Range -- -------------- function To_Range (Map : Wide_Character_Mapping) return Wide_Character_Sequence is begin return Map.Map.Rangev; end To_Range; --------------- -- To_Ranges -- --------------- function To_Ranges (Set : Wide_Character_Set) return Wide_Character_Ranges is begin return Set.Set.all; end To_Ranges; ----------------- -- To_Sequence -- ----------------- function To_Sequence (Set : Wide_Character_Set) return Wide_Character_Sequence is SS : constant Wide_Character_Ranges_Access := Set.Set; N : Natural := 0; Count : Natural := 0; begin for J in SS'Range loop Count := Count + (Wide_Character'Pos (SS (J).High) - Wide_Character'Pos (SS (J).Low) + 1); end loop; return Result : Wide_String (1 .. Count) do for J in SS'Range loop for K in SS (J).Low .. SS (J).High loop N := N + 1; Result (N) := K; end loop; end loop; end return; end To_Sequence; ------------ -- To_Set -- ------------ -- Case of multiple range input function To_Set (Ranges : Wide_Character_Ranges) return Wide_Character_Set is Result : Wide_Character_Ranges (Ranges'Range); N : Natural := 0; J : Natural; begin -- The output of To_Set is required to be sorted by increasing Low -- values, and discontiguous, so first we sort them as we enter them, -- using a simple insertion sort. pragma Warnings (Off); -- Kill bogus warning on Result being uninitialized for J in Ranges'Range loop for K in 1 .. N loop if Ranges (J).Low < Result (K).Low then Result (K + 1 .. N + 1) := Result (K .. N); Result (K) := Ranges (J); goto Continue; end if; end loop; Result (N + 1) := Ranges (J); <<Continue>> N := N + 1; end loop; pragma Warnings (On); -- Now collapse any contiguous or overlapping ranges J := 1; while J < N loop if Result (J).High < Result (J).Low then N := N - 1; Result (J .. N) := Result (J + 1 .. N + 1); elsif Wide_Character'Succ (Result (J).High) >= Result (J + 1).Low then Result (J).High := Wide_Character'Max (Result (J).High, Result (J + 1).High); N := N - 1; Result (J + 1 .. N) := Result (J + 2 .. N + 1); else J := J + 1; end if; end loop; if N > 0 and then Result (N).High < Result (N).Low then N := N - 1; end if; return (AF.Controlled with Set => new Wide_Character_Ranges'(Result (1 .. N))); end To_Set; -- Case of single range input function To_Set (Span : Wide_Character_Range) return Wide_Character_Set is begin if Span.Low > Span.High then return Null_Set; -- This is safe, because there is no procedure with parameter -- Wide_Character_Set of mode "out" or "in out". else return (AF.Controlled with Set => new Wide_Character_Ranges'(1 => Span)); end if; end To_Set; -- Case of wide string input function To_Set (Sequence : Wide_Character_Sequence) return Wide_Character_Set is R : Wide_Character_Ranges (1 .. Sequence'Length); begin for J in R'Range loop R (J) := (Sequence (J), Sequence (J)); end loop; return To_Set (R); end To_Set; -- Case of single wide character input function To_Set (Singleton : Wide_Character) return Wide_Character_Set is begin return (AF.Controlled with Set => new Wide_Character_Ranges'(1 => (Singleton, Singleton))); end To_Set; ----------- -- Value -- ----------- function Value (Map : Wide_Character_Mapping; Element : Wide_Character) return Wide_Character is L, R, M : Natural; MV : constant Wide_Character_Mapping_Values_Access := Map.Map; begin L := 1; R := MV.Domain'Last; -- Binary search loop loop -- If not found, identity if L > R then return Element; -- Otherwise do binary divide else M := (L + R) / 2; if Element < MV.Domain (M) then R := M - 1; elsif Element > MV.Domain (M) then L := M + 1; else -- Element = MV.Domain (M) then return MV.Rangev (M); end if; end if; end loop; end Value; end Ada.Strings.Wide_Maps;
------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . A R I T H _ 6 4 -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Interfaces; use Interfaces; with Ada.Unchecked_Conversion; package body System.Arith_64 is pragma Suppress (Overflow_Check); pragma Suppress (Range_Check); subtype Uns64 is Unsigned_64; function To_Uns is new Ada.Unchecked_Conversion (Int64, Uns64); function To_Int is new Ada.Unchecked_Conversion (Uns64, Int64); subtype Uns32 is Unsigned_32; ----------------------- -- Local Subprograms -- ----------------------- function "+" (A, B : Uns32) return Uns64 is (Uns64 (A) + Uns64 (B)); function "+" (A : Uns64; B : Uns32) return Uns64 is (A + Uns64 (B)); -- Length doubling additions function "*" (A, B : Uns32) return Uns64 is (Uns64 (A) * Uns64 (B)); -- Length doubling multiplication function "/" (A : Uns64; B : Uns32) return Uns64 is (A / Uns64 (B)); -- Length doubling division function "&" (Hi, Lo : Uns32) return Uns64 is (Shift_Left (Uns64 (Hi), 32) or Uns64 (Lo)); -- Concatenate hi, lo values to form 64-bit result function "abs" (X : Int64) return Uns64 is (if X = Int64'First then 2**63 else Uns64 (Int64'(abs X))); -- Convert absolute value of X to unsigned. Note that we can't just use -- the expression of the Else, because it overflows for X = Int64'First. function "rem" (A : Uns64; B : Uns32) return Uns64 is (A rem Uns64 (B)); -- Length doubling remainder function Le3 (X1, X2, X3 : Uns32; Y1, Y2, Y3 : Uns32) return Boolean; -- Determines if 96 bit value X1&X2&X3 <= Y1&Y2&Y3 function Lo (A : Uns64) return Uns32 is (Uns32 (A and 16#FFFF_FFFF#)); -- Low order half of 64-bit value function Hi (A : Uns64) return Uns32 is (Uns32 (Shift_Right (A, 32))); -- High order half of 64-bit value procedure Sub3 (X1, X2, X3 : in out Uns32; Y1, Y2, Y3 : Uns32); -- Computes X1&X2&X3 := X1&X2&X3 - Y1&Y1&Y3 with mod 2**96 wrap function To_Neg_Int (A : Uns64) return Int64 with Inline; -- Convert to negative integer equivalent. If the input is in the range -- 0 .. 2 ** 63, then the corresponding negative signed integer (obtained -- by negating the given value) is returned, otherwise constraint error -- is raised. function To_Pos_Int (A : Uns64) return Int64 with Inline; -- Convert to positive integer equivalent. If the input is in the range -- 0 .. 2 ** 63-1, then the corresponding non-negative signed integer is -- returned, otherwise constraint error is raised. procedure Raise_Error with Inline; pragma No_Return (Raise_Error); -- Raise constraint error with appropriate message -------------------------- -- Add_With_Ovflo_Check -- -------------------------- function Add_With_Ovflo_Check (X, Y : Int64) return Int64 is R : constant Int64 := To_Int (To_Uns (X) + To_Uns (Y)); begin if X >= 0 then if Y < 0 or else R >= 0 then return R; end if; else -- X < 0 if Y > 0 or else R < 0 then return R; end if; end if; Raise_Error; end Add_With_Ovflo_Check; ------------------- -- Double_Divide -- ------------------- procedure Double_Divide (X, Y, Z : Int64; Q, R : out Int64; Round : Boolean) is Xu : constant Uns64 := abs X; Yu : constant Uns64 := abs Y; Yhi : constant Uns32 := Hi (Yu); Ylo : constant Uns32 := Lo (Yu); Zu : constant Uns64 := abs Z; Zhi : constant Uns32 := Hi (Zu); Zlo : constant Uns32 := Lo (Zu); T1, T2 : Uns64; Du, Qu, Ru : Uns64; Den_Pos : Boolean; begin if Yu = 0 or else Zu = 0 then Raise_Error; end if; -- Compute Y * Z. Note that if the result overflows 64 bits unsigned, -- then the rounded result is clearly zero (since the dividend is at -- most 2**63 - 1, the extra bit of precision is nice here). if Yhi /= 0 then if Zhi /= 0 then Q := 0; R := X; return; else T2 := Yhi * Zlo; end if; else T2 := (if Zhi /= 0 then Ylo * Zhi else 0); end if; T1 := Ylo * Zlo; T2 := T2 + Hi (T1); if Hi (T2) /= 0 then Q := 0; R := X; return; end if; Du := Lo (T2) & Lo (T1); -- Set final signs (RM 4.5.5(27-30)) Den_Pos := (Y < 0) = (Z < 0); -- Check overflow case of largest negative number divided by 1 if X = Int64'First and then Du = 1 and then not Den_Pos then Raise_Error; end if; -- Perform the actual division Qu := Xu / Du; Ru := Xu rem Du; -- Deal with rounding case if Round and then Ru > (Du - Uns64'(1)) / Uns64'(2) then Qu := Qu + Uns64'(1); end if; -- Case of dividend (X) sign positive if X >= 0 then R := To_Int (Ru); Q := (if Den_Pos then To_Int (Qu) else -To_Int (Qu)); -- Case of dividend (X) sign negative else R := -To_Int (Ru); Q := (if Den_Pos then -To_Int (Qu) else To_Int (Qu)); end if; end Double_Divide; --------- -- Le3 -- --------- function Le3 (X1, X2, X3 : Uns32; Y1, Y2, Y3 : Uns32) return Boolean is begin if X1 < Y1 then return True; elsif X1 > Y1 then return False; elsif X2 < Y2 then return True; elsif X2 > Y2 then return False; else return X3 <= Y3; end if; end Le3; ------------------------------- -- Multiply_With_Ovflo_Check -- ------------------------------- function Multiply_With_Ovflo_Check (X, Y : Int64) return Int64 is Xu : constant Uns64 := abs X; Xhi : constant Uns32 := Hi (Xu); Xlo : constant Uns32 := Lo (Xu); Yu : constant Uns64 := abs Y; Yhi : constant Uns32 := Hi (Yu); Ylo : constant Uns32 := Lo (Yu); T1, T2 : Uns64; begin if Xhi /= 0 then if Yhi /= 0 then Raise_Error; else T2 := Xhi * Ylo; end if; elsif Yhi /= 0 then T2 := Xlo * Yhi; else -- Yhi = Xhi = 0 T2 := 0; end if; -- Here we have T2 set to the contribution to the upper half of the -- result from the upper halves of the input values. T1 := Xlo * Ylo; T2 := T2 + Hi (T1); if Hi (T2) /= 0 then Raise_Error; end if; T2 := Lo (T2) & Lo (T1); if X >= 0 then if Y >= 0 then return To_Pos_Int (T2); else return To_Neg_Int (T2); end if; else -- X < 0 if Y < 0 then return To_Pos_Int (T2); else return To_Neg_Int (T2); end if; end if; end Multiply_With_Ovflo_Check; ----------------- -- Raise_Error -- ----------------- procedure Raise_Error is begin raise Constraint_Error with "64-bit arithmetic overflow"; end Raise_Error; ------------------- -- Scaled_Divide -- ------------------- procedure Scaled_Divide (X, Y, Z : Int64; Q, R : out Int64; Round : Boolean) is Xu : constant Uns64 := abs X; Xhi : constant Uns32 := Hi (Xu); Xlo : constant Uns32 := Lo (Xu); Yu : constant Uns64 := abs Y; Yhi : constant Uns32 := Hi (Yu); Ylo : constant Uns32 := Lo (Yu); Zu : Uns64 := abs Z; Zhi : Uns32 := Hi (Zu); Zlo : Uns32 := Lo (Zu); D : array (1 .. 4) of Uns32; -- The dividend, four digits (D(1) is high order) Qd : array (1 .. 2) of Uns32; -- The quotient digits, two digits (Qd(1) is high order) S1, S2, S3 : Uns32; -- Value to subtract, three digits (S1 is high order) Qu : Uns64; Ru : Uns64; -- Unsigned quotient and remainder Scale : Natural; -- Scaling factor used for multiple-precision divide. Dividend and -- Divisor are multiplied by 2 ** Scale, and the final remainder is -- divided by the scaling factor. The reason for this scaling is to -- allow more accurate estimation of quotient digits. T1, T2, T3 : Uns64; -- Temporary values begin -- First do the multiplication, giving the four digit dividend T1 := Xlo * Ylo; D (4) := Lo (T1); D (3) := Hi (T1); if Yhi /= 0 then T1 := Xlo * Yhi; T2 := D (3) + Lo (T1); D (3) := Lo (T2); D (2) := Hi (T1) + Hi (T2); if Xhi /= 0 then T1 := Xhi * Ylo; T2 := D (3) + Lo (T1); D (3) := Lo (T2); T3 := D (2) + Hi (T1); T3 := T3 + Hi (T2); D (2) := Lo (T3); D (1) := Hi (T3); T1 := (D (1) & D (2)) + Uns64'(Xhi * Yhi); D (1) := Hi (T1); D (2) := Lo (T1); else D (1) := 0; end if; else if Xhi /= 0 then T1 := Xhi * Ylo; T2 := D (3) + Lo (T1); D (3) := Lo (T2); D (2) := Hi (T1) + Hi (T2); else D (2) := 0; end if; D (1) := 0; end if; -- Now it is time for the dreaded multiple precision division. First an -- easy case, check for the simple case of a one digit divisor. if Zhi = 0 then if D (1) /= 0 or else D (2) >= Zlo then Raise_Error; -- Here we are dividing at most three digits by one digit else T1 := D (2) & D (3); T2 := Lo (T1 rem Zlo) & D (4); Qu := Lo (T1 / Zlo) & Lo (T2 / Zlo); Ru := T2 rem Zlo; end if; -- If divisor is double digit and too large, raise error elsif (D (1) & D (2)) >= Zu then Raise_Error; -- This is the complex case where we definitely have a double digit -- divisor and a dividend of at least three digits. We use the classical -- multiple division algorithm (see section (4.3.1) of Knuth's "The Art -- of Computer Programming", Vol. 2 for a description (algorithm D). else -- First normalize the divisor so that it has the leading bit on. -- We do this by finding the appropriate left shift amount. Scale := 0; if (Zhi and 16#FFFF0000#) = 0 then Scale := 16; Zu := Shift_Left (Zu, 16); end if; if (Hi (Zu) and 16#FF00_0000#) = 0 then Scale := Scale + 8; Zu := Shift_Left (Zu, 8); end if; if (Hi (Zu) and 16#F000_0000#) = 0 then Scale := Scale + 4; Zu := Shift_Left (Zu, 4); end if; if (Hi (Zu) and 16#C000_0000#) = 0 then Scale := Scale + 2; Zu := Shift_Left (Zu, 2); end if; if (Hi (Zu) and 16#8000_0000#) = 0 then Scale := Scale + 1; Zu := Shift_Left (Zu, 1); end if; Zhi := Hi (Zu); Zlo := Lo (Zu); -- Note that when we scale up the dividend, it still fits in four -- digits, since we already tested for overflow, and scaling does -- not change the invariant that (D (1) & D (2)) >= Zu. T1 := Shift_Left (D (1) & D (2), Scale); D (1) := Hi (T1); T2 := Shift_Left (0 & D (3), Scale); D (2) := Lo (T1) or Hi (T2); T3 := Shift_Left (0 & D (4), Scale); D (3) := Lo (T2) or Hi (T3); D (4) := Lo (T3); -- Loop to compute quotient digits, runs twice for Qd(1) and Qd(2) for J in 0 .. 1 loop -- Compute next quotient digit. We have to divide three digits by -- two digits. We estimate the quotient by dividing the leading -- two digits by the leading digit. Given the scaling we did above -- which ensured the first bit of the divisor is set, this gives -- an estimate of the quotient that is at most two too high. Qd (J + 1) := (if D (J + 1) = Zhi then 2 ** 32 - 1 else Lo ((D (J + 1) & D (J + 2)) / Zhi)); -- Compute amount to subtract T1 := Qd (J + 1) * Zlo; T2 := Qd (J + 1) * Zhi; S3 := Lo (T1); T1 := Hi (T1) + Lo (T2); S2 := Lo (T1); S1 := Hi (T1) + Hi (T2); -- Adjust quotient digit if it was too high loop exit when Le3 (S1, S2, S3, D (J + 1), D (J + 2), D (J + 3)); Qd (J + 1) := Qd (J + 1) - 1; Sub3 (S1, S2, S3, 0, Zhi, Zlo); end loop; -- Now subtract S1&S2&S3 from D1&D2&D3 ready for next step Sub3 (D (J + 1), D (J + 2), D (J + 3), S1, S2, S3); end loop; -- The two quotient digits are now set, and the remainder of the -- scaled division is in D3&D4. To get the remainder for the -- original unscaled division, we rescale this dividend. -- We rescale the divisor as well, to make the proper comparison -- for rounding below. Qu := Qd (1) & Qd (2); Ru := Shift_Right (D (3) & D (4), Scale); Zu := Shift_Right (Zu, Scale); end if; -- Deal with rounding case if Round and then Ru > (Zu - Uns64'(1)) / Uns64'(2) then Qu := Qu + Uns64 (1); end if; -- Set final signs (RM 4.5.5(27-30)) -- Case of dividend (X * Y) sign positive if (X >= 0 and then Y >= 0) or else (X < 0 and then Y < 0) then R := To_Pos_Int (Ru); Q := (if Z > 0 then To_Pos_Int (Qu) else To_Neg_Int (Qu)); -- Case of dividend (X * Y) sign negative else R := To_Neg_Int (Ru); Q := (if Z > 0 then To_Neg_Int (Qu) else To_Pos_Int (Qu)); end if; end Scaled_Divide; ---------- -- Sub3 -- ---------- procedure Sub3 (X1, X2, X3 : in out Uns32; Y1, Y2, Y3 : Uns32) is begin if Y3 > X3 then if X2 = 0 then X1 := X1 - 1; end if; X2 := X2 - 1; end if; X3 := X3 - Y3; if Y2 > X2 then X1 := X1 - 1; end if; X2 := X2 - Y2; X1 := X1 - Y1; end Sub3; ------------------------------- -- Subtract_With_Ovflo_Check -- ------------------------------- function Subtract_With_Ovflo_Check (X, Y : Int64) return Int64 is R : constant Int64 := To_Int (To_Uns (X) - To_Uns (Y)); begin if X >= 0 then if Y > 0 or else R >= 0 then return R; end if; else -- X < 0 if Y <= 0 or else R < 0 then return R; end if; end if; Raise_Error; end Subtract_With_Ovflo_Check; ---------------- -- To_Neg_Int -- ---------------- function To_Neg_Int (A : Uns64) return Int64 is R : constant Int64 := (if A = 2**63 then Int64'First else -To_Int (A)); -- Note that we can't just use the expression of the Else, because it -- overflows for A = 2**63. begin if R <= 0 then return R; else Raise_Error; end if; end To_Neg_Int; ---------------- -- To_Pos_Int -- ---------------- function To_Pos_Int (A : Uns64) return Int64 is R : constant Int64 := To_Int (A); begin if R >= 0 then return R; else Raise_Error; end if; end To_Pos_Int; end System.Arith_64;
package gel_demo_Client -- -- Provides a client. -- is task Item is entry start; end Item; end gel_demo_Client;
with Ada.Command_Line; use Ada.Command_Line; with Ada.Text_IO; use Ada.Text_IO; with Ada.Exceptions; use Ada.Exceptions; with STL; use STL; with Parser_Svg; use Parser_Svg; with Normalisation; use Normalisation; with Courbes; use Courbes; with Interpolations_Lineaires; use Interpolations_Lineaires; with Vecteurs; use Vecteurs; with Helper; use Helper; procedure BezierToSTL is Courbes : Liste_Courbes.Liste; Segments : Liste_Points.Liste; Facettes : Liste_Facettes.Liste; -- Active l'affichage de la sortie Debug Activer_Debug : constant Boolean := True; -- Nombre de points à utiliser pour la discretisation Nombre_Points_Interpolation : constant Positive := 50; -- Faut il interpoler les droites -- ou laisser cette tâche à l'affichage ? -- WARNING: Ne pas activer avec De Casteljau -- Sinon risque de trop grand nombre de points -- rendant stlviewer inutilisable Interpoler_Droites : constant Boolean := false; -- Utiliser l'algorithme de De Casteljau -- pour interpoler les courbes de Bezier cubiques -- => Courbes plus jolies/lisses -- => Le nombre de point est ignoré pour les courbes concernées -- => car il est déterminé automatiquement -- WARNING: Ne pas activer avec Interpoler_Droites -- Sinon risque de trop grand nombre de points -- rendant stlviewer inutilisable Utiliser_DeCasteljau : constant Boolean := true; -- Tolérance utilisée si Utiliser_DeCasteljau -- Définit une tolérance pour -- savoir quand une courbe peut être -- considérée "droite" -- Plus petit = tolérance plus strict -- => Approximation plus précise -- et inversement. -- A valeur entre 0.01 et 1.0. Tolerance_DeCasteljau : constant Tolerance := 0.1; -- Permet de libérer la mémoire allouée pour -- toutes les courbes d'une liste procedure Liberer_Liste_Courbes is new Liste_Courbes.Parcourir(Liberer_Courbe); -- Nombre de facette à générer pendant la rotation Nombre_Facettes : constant Positive := 200; begin if Argument_Count /= 2 then Put_Line(Standard_Error, "usage : " & Command_Name & " fichier_entree.svg fichier_sortie.stl"); Set_Exit_Status(Failure); return; end if; Afficher_Debug (Activer_Debug); Put_Line("Chargement de la figure..."); -- On charge la figure contenue dans le SVG Charger_SVG(Argument(1), Courbes); Put_Line("Interpolation linéaire..."); -- Approximation des courbes par des segments Interpolation_Lineaire ( Courbes => Courbes, Segments => Segments, Nombre_Points => Nombre_Points_Interpolation, Interpoler_Droites => Interpoler_Droites, Utiliser_DeCasteljau => Utiliser_DeCasteljau, Tolerance_DeCasteljau => Tolerance_DeCasteljau); Put_Line("Normalisation..."); -- On normalise la figure -- (centrage en x, raccordage extremités) Normaliser(Segments); Put_Line("Projection en 3D..."); -- On convertit en facettes par rotation Creation(Segments, Facettes, Nombre_Facettes); Put_Line("Export..."); -- On sauvegarde le modele obtenu Sauvegarder(Argument(2), Facettes); -- Libère la mémoire allouée pour chaque courbe Liberer_Liste_Courbes (Courbes); -- Libère la mémoire allouée pour les listes Liste_Courbes.Vider(Courbes); Liste_Points.Vider(Segments); Liste_Facettes.Vider(Facettes); exception when Courbe_Abs => Put_Line (Standard_Error, "Le fichier source ne contenait pas de courbe."); Set_Exit_Status (Failure); when e: Courbe_Illisible => Put_Line (Standard_Error, "Le fichier source est mal formé: " & exception_message (e)); Set_Exit_Status (Failure); when e: Erreur_Lecture => Put_Line (Standard_Error, "Le fichier source est mal formé: " & exception_message (e)); Set_Exit_Status (Failure); when e: Name_Error => Put_Line (Standard_Error, "Le fichier n'a pas pu être ouvert: " & exception_message(e)); Set_Exit_Status (Failure); end;
pragma License (Unrestricted); -- implementation unit required by compiler package System.Val_Bool is pragma Pure; -- required for Boolean'Value by compiler (s-valboo.ads) function Value_Boolean (Str : String) return Boolean; end System.Val_Bool;