hexsha
stringlengths 40
40
| size
int64 3
1.05M
| ext
stringclasses 163
values | lang
stringclasses 53
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
112
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
sequencelengths 1
10
| max_stars_count
float64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
113
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
sequencelengths 1
10
| max_issues_count
float64 1
116k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
113
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
sequencelengths 1
10
| max_forks_count
float64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 3
1.05M
| avg_line_length
float64 1
966k
| max_line_length
int64 1
977k
| alphanum_fraction
float64 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dcff2a736843e223c9f7cc068b4b37ff111503c8 | 428 | ads | Ada | source/strings/a-swecin.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 33 | 2015-04-04T09:19:36.000Z | 2021-11-10T05:33:34.000Z | source/strings/a-swecin.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 8 | 2017-11-14T13:05:07.000Z | 2018-08-09T15:28:49.000Z | source/strings/a-swecin.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 9 | 2015-02-03T17:09:53.000Z | 2021-11-12T01:16:05.000Z | pragma License (Unrestricted);
-- Ada 2012
with Ada.Characters.Conversions;
with Ada.Strings.Generic_Equal_Case_Insensitive;
function Ada.Strings.Wide_Equal_Case_Insensitive is
new Generic_Equal_Case_Insensitive (
Wide_Character,
Wide_String,
Characters.Conversions.Get);
-- pragma Pure (Ada.Strings.Wide_Equal_Case_Insensitive);
pragma Preelaborate (Ada.Strings.Wide_Equal_Case_Insensitive); -- use maps
| 35.666667 | 74 | 0.799065 |
df8cdf2101c85c00b4ae1c07949c0ca4e9cf623c | 2,899 | adb | Ada | gcc-gcc-7_3_0-release/gcc/ada/s-fore.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/ada/s-fore.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/ada/s-fore.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . F O R E --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body System.Fore is
----------
-- Fore --
----------
function Fore (Lo, Hi : Long_Long_Float) return Natural is
T : Long_Long_Float := Long_Long_Float'Max (abs Lo, abs Hi);
R : Natural;
begin
-- Initial value of 2 allows for sign and mandatory single digit
R := 2;
-- Loop to increase Fore as needed to include full range of values
while T >= 10.0 loop
T := T / 10.0;
R := R + 1;
end loop;
return R;
end Fore;
end System.Fore;
| 50.859649 | 78 | 0.397033 |
0eb91f0074cd7ec3689dcd783f3c668d233174d3 | 1,112 | ads | Ada | src/data.ads | KissmyAsthma99/opp | 8cf8d1a6ed1de5704ec88a31ad15b1b249333e42 | [
"MIT"
] | null | null | null | src/data.ads | KissmyAsthma99/opp | 8cf8d1a6ed1de5704ec88a31ad15b1b249333e42 | [
"MIT"
] | null | null | null | src/data.ads | KissmyAsthma99/opp | 8cf8d1a6ed1de5704ec88a31ad15b1b249333e42 | [
"MIT"
] | 1 | 2020-11-02T10:11:32.000Z | 2020-11-02T10:11:32.000Z | generic
N: Integer;
package data is
type Vector is private;
type Matrix is private;
function Func1(A,B,C: in Vector; MA,ME: in Matrix) return Integer;
function Func2(MH,MK,ML: in Matrix) return Integer;
function Func3(P: out Vector; MR,MT: in Matrix) return Vector;
function Matrix_Multiplication(A,B: in Matrix) return Matrix;
function Sum_Vector(A,B: in Vector) return Vector;
function Vector_Matrix_Multiplication(A: in Vector; B: in Matrix) return Vector;
function Max_of_Vector(A: in Vector) return Integer;
function Max_of_Matrix(A: in Matrix) return Integer;
function Matrix_Sub(A,B: in Matrix) return Matrix;
procedure Vector_Sort(A: in out Vector);
procedure Vector_Fill_Ones(A: out Vector);
procedure Matrix_Fill_Ones(A: out Matrix);
procedure Vector_Input (A: out Vector); -- fills values of
procedure Vector_Output (A: in Vector); -- shows values of
procedure Matrix_Input (A: out Matrix);
procedure Matrix_Output (A: in Matrix);
private
type Vector is array(1..N) of Integer;
type Matrix is array(1..N) of Vector;
end data;
| 30.888889 | 83 | 0.72482 |
df2078d3c4d422906bfc6f9b18b1cff4c8de2c65 | 1,939 | adb | Ada | src/edc_client-alpha-common.adb | hgrodriguez/edc-client | 604711851d356014b653e2f50218ebcfe50f05a0 | [
"BSD-3-Clause"
] | null | null | null | src/edc_client-alpha-common.adb | hgrodriguez/edc-client | 604711851d356014b653e2f50218ebcfe50f05a0 | [
"BSD-3-Clause"
] | null | null | null | src/edc_client-alpha-common.adb | hgrodriguez/edc-client | 604711851d356014b653e2f50218ebcfe50f05a0 | [
"BSD-3-Clause"
] | null | null | null | --
-- Copyright 2021 (C) Holger Rodriguez
--
-- SPDX-License-Identifier: BSD-3-Clause
--
package body Edc_Client.Alpha.Common is
-- LUT for codes for possible single letter positions
SL_Position_Codes : constant array (1 .. 8) of
Character := (1 => '1',
2 => '2',
3 => '3',
4 => '4',
5 => '5',
6 => '6',
7 => '7',
8 => '8');
-- LUT for codes for possible double letter positions
DL_Position_Codes : constant array (1 .. 4) of
Character := (1 => '1',
2 => '2',
3 => '3',
4 => '4');
procedure Show_Single_Letter (Position : Integer;
Block : Character;
Value : String) is
Command : String := "ABNPC";
begin
Command (2) := Block;
Command (4) := SL_Position_Codes (Position);
Command (5) := Value (Value'First);
Transmitter (Command);
end Show_Single_Letter;
procedure Show_Double_Letters (Position : Integer;
Block : Character;
Value : String) is
Command : String := "ABBPCC";
begin
Command (2) := Block;
Command (4) := DL_Position_Codes (Position);
Command (5 .. 6) := Value (Value'First .. Value'First + 1);
Transmitter (Command);
end Show_Double_Letters;
procedure Show_Four_Letters (Position : Integer;
Block : Character;
Value : String) is
Command : String := "ABW1CCCC";
begin
Command (2) := Block;
Command (4) := DL_Position_Codes (Position);
Command (5 .. 8) := Value (Value'First .. Value'First + 3);
Transmitter (Command);
end Show_Four_Letters;
end Edc_Client.Alpha.Common;
| 32.316667 | 65 | 0.485817 |
23600887dd65d7d15132b13704083bf91fbb37e9 | 19,109 | ads | Ada | src/gen/sensors-libsensors-sensors_sensors_h.ads | Ada-bindings-project/a-lmsensors | 85b183a609c67c8173760d8c9b7c8ce72f9280e5 | [
"MIT"
] | null | null | null | src/gen/sensors-libsensors-sensors_sensors_h.ads | Ada-bindings-project/a-lmsensors | 85b183a609c67c8173760d8c9b7c8ce72f9280e5 | [
"MIT"
] | null | null | null | src/gen/sensors-libsensors-sensors_sensors_h.ads | Ada-bindings-project/a-lmsensors | 85b183a609c67c8173760d8c9b7c8ce72f9280e5 | [
"MIT"
] | null | null | null | pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with Interfaces.C_Streams;
package Sensors.libSensors.sensors_sensors_h is
SENSORS_API_VERSION : constant := 16#500#; -- /usr/include/sensors/sensors.h:34
-- unsupported macro: SENSORS_CHIP_NAME_PREFIX_ANY NULL
SENSORS_CHIP_NAME_ADDR_ANY : constant := (-1); -- /usr/include/sensors/sensors.h:37
SENSORS_BUS_TYPE_ANY : constant := (-1); -- /usr/include/sensors/sensors.h:39
SENSORS_BUS_TYPE_I2C : constant := 0; -- /usr/include/sensors/sensors.h:40
SENSORS_BUS_TYPE_ISA : constant := 1; -- /usr/include/sensors/sensors.h:41
SENSORS_BUS_TYPE_PCI : constant := 2; -- /usr/include/sensors/sensors.h:42
SENSORS_BUS_TYPE_SPI : constant := 3; -- /usr/include/sensors/sensors.h:43
SENSORS_BUS_TYPE_VIRTUAL : constant := 4; -- /usr/include/sensors/sensors.h:44
SENSORS_BUS_TYPE_ACPI : constant := 5; -- /usr/include/sensors/sensors.h:45
SENSORS_BUS_TYPE_HID : constant := 6; -- /usr/include/sensors/sensors.h:46
SENSORS_BUS_TYPE_MDIO : constant := 7; -- /usr/include/sensors/sensors.h:47
SENSORS_BUS_TYPE_SCSI : constant := 8; -- /usr/include/sensors/sensors.h:48
SENSORS_BUS_NR_ANY : constant := (-1); -- /usr/include/sensors/sensors.h:49
SENSORS_BUS_NR_IGNORE : constant := (-2); -- /usr/include/sensors/sensors.h:50
SENSORS_MODE_R : constant := 1; -- /usr/include/sensors/sensors.h:134
SENSORS_MODE_W : constant := 2; -- /usr/include/sensors/sensors.h:135
SENSORS_COMPUTE_MAPPING : constant := 4; -- /usr/include/sensors/sensors.h:136
-- sensors.h - Part of libsensors, a Linux library for reading sensor data.
-- Copyright (c) 1998, 1999 Frodo Looijaard <[email protected]>
-- Copyright (C) 2007-2014 Jean Delvare <[email protected]>
-- 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 General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-- MA 02110-1301 USA.
--
-- Publicly accessible library functions
-- libsensors API version define, first digit is the major version (changed
-- when the API or ABI breaks), the third digit is incremented to track small
-- API additions like new flags / enum values. The second digit is for tracking
-- larger additions like new methods.
libsensors_version : Interfaces.C.Strings.chars_ptr -- /usr/include/sensors/sensors.h:56
with Import => True,
Convention => C,
External_Name => "libsensors_version";
type sensors_bus_id is record
c_type : aliased short; -- /usr/include/sensors/sensors.h:59
nr : aliased short; -- /usr/include/sensors/sensors.h:60
end record
with Convention => C_Pass_By_Copy; -- /usr/include/sensors/sensors.h:58
-- A chip name is encoded in this structure
type sensors_chip_name is record
prefix : Interfaces.C.Strings.chars_ptr; -- /usr/include/sensors/sensors.h:65
bus : aliased sensors_bus_id; -- /usr/include/sensors/sensors.h:66
addr : aliased int; -- /usr/include/sensors/sensors.h:67
path : Interfaces.C.Strings.chars_ptr; -- /usr/include/sensors/sensors.h:68
end record
with Convention => C_Pass_By_Copy; -- /usr/include/sensors/sensors.h:64
-- Load the configuration file and the detected chips list. If this
-- returns a value unequal to zero, you are in trouble; you can not
-- assume anything will be initialized properly. If you want to
-- reload the configuration file, call sensors_cleanup() below before
-- calling sensors_init() again.
function sensors_init (input : Interfaces.C_Streams.FILEs) return int -- /usr/include/sensors/sensors.h:76
with Import => True,
Convention => C,
External_Name => "sensors_init";
-- Clean-up function: You can't access anything after
-- this, until the next sensors_init() call!
procedure sensors_cleanup -- /usr/include/sensors/sensors.h:80
with Import => True,
Convention => C,
External_Name => "sensors_cleanup";
-- Parse a chip name to the internal representation. Return 0 on success, <0
-- on error.
function sensors_parse_chip_name (orig_name : Interfaces.C.Strings.chars_ptr; res : access sensors_chip_name) return int -- /usr/include/sensors/sensors.h:84
with Import => True,
Convention => C,
External_Name => "sensors_parse_chip_name";
-- Free memory allocated for the internal representation of a chip name.
procedure sensors_free_chip_name (chip : access sensors_chip_name) -- /usr/include/sensors/sensors.h:87
with Import => True,
Convention => C,
External_Name => "sensors_free_chip_name";
-- Print a chip name from its internal representation. Note that chip should
-- not contain wildcard values! Return the number of characters printed on
-- success (same as snprintf), <0 on error.
function sensors_snprintf_chip_name
(str : Interfaces.C.Strings.chars_ptr;
size : size_t;
chip : access constant sensors_chip_name) return int -- /usr/include/sensors/sensors.h:92
with Import => True,
Convention => C,
External_Name => "sensors_snprintf_chip_name";
-- This function returns the adapter name of a bus,
-- as used within the sensors_chip_name structure. If it could not be found,
-- it returns NULL
function sensors_get_adapter_name (bus : access constant sensors_bus_id) return Interfaces.C.Strings.chars_ptr -- /usr/include/sensors/sensors.h:98
with Import => True,
Convention => C,
External_Name => "sensors_get_adapter_name";
type sensors_feature;
-- Look up the label for a given feature. Note that chip should not
-- contain wildcard values! The returned string is newly allocated (free it
-- yourself). On failure, NULL is returned.
-- If no label exists for this feature, its name is returned itself.
function sensors_get_label (name : access constant sensors_chip_name; feature : access constant sensors_feature) return Interfaces.C.Strings.chars_ptr -- /usr/include/sensors/sensors.h:106
with Import => True,
Convention => C,
External_Name => "sensors_get_label";
-- Read the value of a subfeature of a certain chip. Note that chip should not
-- contain wildcard values! This function will return 0 on success, and <0
-- on failure.
function sensors_get_value
(name : access constant sensors_chip_name;
subfeat_nr : int;
value : access double) return int -- /usr/include/sensors/sensors.h:112
with Import => True,
Convention => C,
External_Name => "sensors_get_value";
-- Set the value of a subfeature of a certain chip. Note that chip should not
-- contain wildcard values! This function will return 0 on success, and <0
-- on failure.
function sensors_set_value
(name : access constant sensors_chip_name;
subfeat_nr : int;
value : double) return int -- /usr/include/sensors/sensors.h:118
with Import => True,
Convention => C,
External_Name => "sensors_set_value";
-- Execute all set statements for this particular chip. The chip may contain
-- wildcards! This function will return 0 on success, and <0 on failure.
function sensors_do_chip_sets (name : access constant sensors_chip_name) return int -- /usr/include/sensors/sensors.h:123
with Import => True,
Convention => C,
External_Name => "sensors_do_chip_sets";
-- This function returns all detected chips that match a given chip name,
-- one by one. If no chip name is provided, all detected chips are returned.
-- To start at the beginning of the list, use 0 for nr; NULL is returned if
-- we are at the end of the list. Do not try to change these chip names, as
-- they point to internal structures!
function sensors_get_detected_chips (match : access constant sensors_chip_name; nr : access int) return access constant sensors_chip_name -- /usr/include/sensors/sensors.h:130
with Import => True,
Convention => C,
External_Name => "sensors_get_detected_chips";
-- These defines are used in the flags field of sensors_subfeature
subtype sensors_feature_type is unsigned;
SENSORS_FEATURE_IN : constant unsigned := 0;
SENSORS_FEATURE_FAN : constant unsigned := 1;
SENSORS_FEATURE_TEMP : constant unsigned := 2;
SENSORS_FEATURE_POWER : constant unsigned := 3;
SENSORS_FEATURE_ENERGY : constant unsigned := 4;
SENSORS_FEATURE_CURR : constant unsigned := 5;
SENSORS_FEATURE_HUMIDITY : constant unsigned := 6;
SENSORS_FEATURE_MAX_MAIN : constant unsigned := 7;
SENSORS_FEATURE_VID : constant unsigned := 16;
SENSORS_FEATURE_INTRUSION : constant unsigned := 17;
SENSORS_FEATURE_MAX_OTHER : constant unsigned := 18;
SENSORS_FEATURE_BEEP_ENABLE : constant unsigned := 24;
SENSORS_FEATURE_MAX : constant unsigned := 25;
SENSORS_FEATURE_UNKNOWN : constant unsigned := 2147483647; -- /usr/include/sensors/sensors.h:138
-- All the sensor types (in, fan, temp, vid) are a multiple of 0x100 apart,
-- and sensor subfeatures which have no compute mapping have bit 7 set.
subtype sensors_subfeature_type is unsigned;
SENSORS_SUBFEATURE_IN_INPUT : constant unsigned := 0;
SENSORS_SUBFEATURE_IN_MIN : constant unsigned := 1;
SENSORS_SUBFEATURE_IN_MAX : constant unsigned := 2;
SENSORS_SUBFEATURE_IN_LCRIT : constant unsigned := 3;
SENSORS_SUBFEATURE_IN_CRIT : constant unsigned := 4;
SENSORS_SUBFEATURE_IN_AVERAGE : constant unsigned := 5;
SENSORS_SUBFEATURE_IN_LOWEST : constant unsigned := 6;
SENSORS_SUBFEATURE_IN_HIGHEST : constant unsigned := 7;
SENSORS_SUBFEATURE_IN_ALARM : constant unsigned := 128;
SENSORS_SUBFEATURE_IN_MIN_ALARM : constant unsigned := 129;
SENSORS_SUBFEATURE_IN_MAX_ALARM : constant unsigned := 130;
SENSORS_SUBFEATURE_IN_BEEP : constant unsigned := 131;
SENSORS_SUBFEATURE_IN_LCRIT_ALARM : constant unsigned := 132;
SENSORS_SUBFEATURE_IN_CRIT_ALARM : constant unsigned := 133;
SENSORS_SUBFEATURE_FAN_INPUT : constant unsigned := 256;
SENSORS_SUBFEATURE_FAN_MIN : constant unsigned := 257;
SENSORS_SUBFEATURE_FAN_MAX : constant unsigned := 258;
SENSORS_SUBFEATURE_FAN_ALARM : constant unsigned := 384;
SENSORS_SUBFEATURE_FAN_FAULT : constant unsigned := 385;
SENSORS_SUBFEATURE_FAN_DIV : constant unsigned := 386;
SENSORS_SUBFEATURE_FAN_BEEP : constant unsigned := 387;
SENSORS_SUBFEATURE_FAN_PULSES : constant unsigned := 388;
SENSORS_SUBFEATURE_FAN_MIN_ALARM : constant unsigned := 389;
SENSORS_SUBFEATURE_FAN_MAX_ALARM : constant unsigned := 390;
SENSORS_SUBFEATURE_TEMP_INPUT : constant unsigned := 512;
SENSORS_SUBFEATURE_TEMP_MAX : constant unsigned := 513;
SENSORS_SUBFEATURE_TEMP_MAX_HYST : constant unsigned := 514;
SENSORS_SUBFEATURE_TEMP_MIN : constant unsigned := 515;
SENSORS_SUBFEATURE_TEMP_CRIT : constant unsigned := 516;
SENSORS_SUBFEATURE_TEMP_CRIT_HYST : constant unsigned := 517;
SENSORS_SUBFEATURE_TEMP_LCRIT : constant unsigned := 518;
SENSORS_SUBFEATURE_TEMP_EMERGENCY : constant unsigned := 519;
SENSORS_SUBFEATURE_TEMP_EMERGENCY_HYST : constant unsigned := 520;
SENSORS_SUBFEATURE_TEMP_LOWEST : constant unsigned := 521;
SENSORS_SUBFEATURE_TEMP_HIGHEST : constant unsigned := 522;
SENSORS_SUBFEATURE_TEMP_MIN_HYST : constant unsigned := 523;
SENSORS_SUBFEATURE_TEMP_LCRIT_HYST : constant unsigned := 524;
SENSORS_SUBFEATURE_TEMP_ALARM : constant unsigned := 640;
SENSORS_SUBFEATURE_TEMP_MAX_ALARM : constant unsigned := 641;
SENSORS_SUBFEATURE_TEMP_MIN_ALARM : constant unsigned := 642;
SENSORS_SUBFEATURE_TEMP_CRIT_ALARM : constant unsigned := 643;
SENSORS_SUBFEATURE_TEMP_FAULT : constant unsigned := 644;
SENSORS_SUBFEATURE_TEMP_TYPE : constant unsigned := 645;
SENSORS_SUBFEATURE_TEMP_OFFSET : constant unsigned := 646;
SENSORS_SUBFEATURE_TEMP_BEEP : constant unsigned := 647;
SENSORS_SUBFEATURE_TEMP_EMERGENCY_ALARM : constant unsigned := 648;
SENSORS_SUBFEATURE_TEMP_LCRIT_ALARM : constant unsigned := 649;
SENSORS_SUBFEATURE_POWER_AVERAGE : constant unsigned := 768;
SENSORS_SUBFEATURE_POWER_AVERAGE_HIGHEST : constant unsigned := 769;
SENSORS_SUBFEATURE_POWER_AVERAGE_LOWEST : constant unsigned := 770;
SENSORS_SUBFEATURE_POWER_INPUT : constant unsigned := 771;
SENSORS_SUBFEATURE_POWER_INPUT_HIGHEST : constant unsigned := 772;
SENSORS_SUBFEATURE_POWER_INPUT_LOWEST : constant unsigned := 773;
SENSORS_SUBFEATURE_POWER_CAP : constant unsigned := 774;
SENSORS_SUBFEATURE_POWER_CAP_HYST : constant unsigned := 775;
SENSORS_SUBFEATURE_POWER_MAX : constant unsigned := 776;
SENSORS_SUBFEATURE_POWER_CRIT : constant unsigned := 777;
SENSORS_SUBFEATURE_POWER_MIN : constant unsigned := 778;
SENSORS_SUBFEATURE_POWER_LCRIT : constant unsigned := 779;
SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL : constant unsigned := 896;
SENSORS_SUBFEATURE_POWER_ALARM : constant unsigned := 897;
SENSORS_SUBFEATURE_POWER_CAP_ALARM : constant unsigned := 898;
SENSORS_SUBFEATURE_POWER_MAX_ALARM : constant unsigned := 899;
SENSORS_SUBFEATURE_POWER_CRIT_ALARM : constant unsigned := 900;
SENSORS_SUBFEATURE_POWER_MIN_ALARM : constant unsigned := 901;
SENSORS_SUBFEATURE_POWER_LCRIT_ALARM : constant unsigned := 902;
SENSORS_SUBFEATURE_ENERGY_INPUT : constant unsigned := 1024;
SENSORS_SUBFEATURE_CURR_INPUT : constant unsigned := 1280;
SENSORS_SUBFEATURE_CURR_MIN : constant unsigned := 1281;
SENSORS_SUBFEATURE_CURR_MAX : constant unsigned := 1282;
SENSORS_SUBFEATURE_CURR_LCRIT : constant unsigned := 1283;
SENSORS_SUBFEATURE_CURR_CRIT : constant unsigned := 1284;
SENSORS_SUBFEATURE_CURR_AVERAGE : constant unsigned := 1285;
SENSORS_SUBFEATURE_CURR_LOWEST : constant unsigned := 1286;
SENSORS_SUBFEATURE_CURR_HIGHEST : constant unsigned := 1287;
SENSORS_SUBFEATURE_CURR_ALARM : constant unsigned := 1408;
SENSORS_SUBFEATURE_CURR_MIN_ALARM : constant unsigned := 1409;
SENSORS_SUBFEATURE_CURR_MAX_ALARM : constant unsigned := 1410;
SENSORS_SUBFEATURE_CURR_BEEP : constant unsigned := 1411;
SENSORS_SUBFEATURE_CURR_LCRIT_ALARM : constant unsigned := 1412;
SENSORS_SUBFEATURE_CURR_CRIT_ALARM : constant unsigned := 1413;
SENSORS_SUBFEATURE_HUMIDITY_INPUT : constant unsigned := 1536;
SENSORS_SUBFEATURE_VID : constant unsigned := 4096;
SENSORS_SUBFEATURE_INTRUSION_ALARM : constant unsigned := 4352;
SENSORS_SUBFEATURE_INTRUSION_BEEP : constant unsigned := 4353;
SENSORS_SUBFEATURE_BEEP_ENABLE : constant unsigned := 6144;
SENSORS_SUBFEATURE_UNKNOWN : constant unsigned := 2147483647; -- /usr/include/sensors/sensors.h:157
-- Data about a single chip feature (or category leader)
type sensors_feature is record
name : Interfaces.C.Strings.chars_ptr; -- /usr/include/sensors/sensors.h:259
number : aliased int; -- /usr/include/sensors/sensors.h:260
c_type : aliased sensors_feature_type; -- /usr/include/sensors/sensors.h:261
first_subfeature : aliased int; -- /usr/include/sensors/sensors.h:263
padding1 : aliased int; -- /usr/include/sensors/sensors.h:264
end record
with Convention => C_Pass_By_Copy; -- /usr/include/sensors/sensors.h:258
-- Members below are for libsensors internal use only
-- Data about a single chip subfeature:
-- name is the string name used to refer to this subfeature (in config files)
-- number is the internal subfeature number, used in many functions to refer
-- to this subfeature
-- type is the subfeature type
-- mapping is the number of a main feature this subfeature belongs to
-- (for example subfeatures fan1_input, fan1_min, fan1_div and fan1_alarm
-- are mapped to main feature fan1)
-- flags is a bitfield, its value is a combination of SENSORS_MODE_R (readable),
-- SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING (affected by the
-- computation rules of the main feature)
type sensors_subfeature is record
name : Interfaces.C.Strings.chars_ptr; -- /usr/include/sensors/sensors.h:279
number : aliased int; -- /usr/include/sensors/sensors.h:280
c_type : aliased sensors_subfeature_type; -- /usr/include/sensors/sensors.h:281
mapping : aliased int; -- /usr/include/sensors/sensors.h:282
flags : aliased unsigned; -- /usr/include/sensors/sensors.h:283
end record
with Convention => C_Pass_By_Copy; -- /usr/include/sensors/sensors.h:278
-- This returns all main features of a specific chip. nr is an internally
-- used variable. Set it to zero to start at the begin of the list. If no
-- more features are found NULL is returned.
-- Do not try to change the returned structure; you will corrupt internal
-- data structures.
function sensors_get_features (name : access constant sensors_chip_name; nr : access int) return access constant sensors_feature -- /usr/include/sensors/sensors.h:292
with Import => True,
Convention => C,
External_Name => "sensors_get_features";
-- This returns all subfeatures of a given main feature. nr is an internally
-- used variable. Set it to zero to start at the begin of the list. If no
-- more features are found NULL is returned.
-- Do not try to change the returned structure; you will corrupt internal
-- data structures.
function sensors_get_all_subfeatures
(name : access constant sensors_chip_name;
feature : access constant sensors_feature;
nr : access int) return access constant sensors_subfeature -- /usr/include/sensors/sensors.h:300
with Import => True,
Convention => C,
External_Name => "sensors_get_all_subfeatures";
-- This returns the subfeature of the given type for a given main feature,
-- if it exists, NULL otherwise.
-- Do not try to change the returned structure; you will corrupt internal
-- data structures.
function sensors_get_subfeature
(name : access constant sensors_chip_name;
feature : access constant sensors_feature;
c_type : sensors_subfeature_type) return access constant sensors_subfeature -- /usr/include/sensors/sensors.h:308
with Import => True,
Convention => C,
External_Name => "sensors_get_subfeature";
end Sensors.libSensors.sensors_sensors_h;
| 52.497253 | 192 | 0.730755 |
207ba65e8718b2e3272da31b1de841a2e2b36b6e | 2,124 | ads | Ada | source/units/program-units-bodies.ads | reznikmm/gela | 20134f1d154fb763812e73860c6f4b04f353df79 | [
"MIT"
] | null | null | null | source/units/program-units-bodies.ads | reznikmm/gela | 20134f1d154fb763812e73860c6f4b04f353df79 | [
"MIT"
] | null | null | null | source/units/program-units-bodies.ads | reznikmm/gela | 20134f1d154fb763812e73860c6f4b04f353df79 | [
"MIT"
] | 1 | 2019-10-16T09:05:27.000Z | 2019-10-16T09:05:27.000Z | -- SPDX-FileCopyrightText: 2019-2020 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
-- Trivial implementation of library bodies
with Program.Library_Unit_Bodies;
with Program.Library_Unit_Declarations;
with Program.Compilation_Unit_Vectors;
with Program.Units.Vectors;
package Program.Units.Bodies is
pragma Preelaborate;
type Unit_Body is new Unit
and Program.Library_Unit_Bodies.Library_Unit_Body with private;
procedure Initialize
(Self : in out Unit_Body;
Compilation : Program.Compilations.Compilation_Access;
Full_Name : Text;
Context_Clause : Program.Element_Vectors.Element_Vector_Access;
Unit_Declaration : not null Program.Elements.Element_Access;
Parent : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access;
Declaration : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access);
procedure Append_Subunit
(Self : in out Unit_Body;
Value : Program.Compilation_Units.Compilation_Unit_Access);
private
type Unit_Body is new Unit
and Program.Library_Unit_Bodies.Library_Unit_Body with
record
Parent : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access;
Declaration : Program.Library_Unit_Declarations
.Library_Unit_Declaration_Access;
Subunits : aliased Program.Units.Vectors.Unit_Vector;
end record;
overriding function Parent (Self : access Unit_Body)
return Program.Library_Unit_Declarations.Library_Unit_Declaration_Access;
overriding function Corresponding_Declaration (Self : access Unit_Body)
return Program.Library_Unit_Declarations.Library_Unit_Declaration_Access;
overriding function Subunits (Self : access Unit_Body)
return Program.Compilation_Unit_Vectors.Compilation_Unit_Vector_Access;
overriding function Is_Library_Unit_Body_Unit
(Self : Unit_Body) return Boolean;
end Program.Units.Bodies;
| 36 | 78 | 0.721281 |
4a55addd6c9e59046a5996d413a43ae2eea03dff | 3,653 | ads | Ada | source/amf/dd/amf-dg-holders-transforms.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/amf/dd/amf-dg-holders-transforms.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/amf/dd/amf-dg-holders-transforms.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
with League.Holders.Generic_Holders;
package AMF.DG.Holders.Transforms is
new League.Holders.Generic_Holders
(AMF.DG.DG_Transform);
pragma Preelaborate (AMF.DG.Holders.Transforms);
| 70.25 | 78 | 0.403778 |
209a5f40ed024dd6836addbfdbf96e1daf381459 | 9,481 | ads | Ada | src/open_weather_map.ads | Jellix/open_weather_map_api | fa3484b361411b9362500a25e36d63d4bb6dbca3 | [
"WTFPL"
] | 1 | 2020-09-04T18:31:05.000Z | 2020-09-04T18:31:05.000Z | src/open_weather_map.ads | Jellix/open_weather_map_api | fa3484b361411b9362500a25e36d63d4bb6dbca3 | [
"WTFPL"
] | 2 | 2020-03-22T16:28:32.000Z | 2020-03-22T16:31:51.000Z | src/open_weather_map.ads | HeisenbugLtd/open_weather_map_api | fa3484b361411b9362500a25e36d63d4bb6dbca3 | [
"WTFPL"
] | null | null | null | --------------------------------------------------------------------------------
-- Copyright (C) 2020 by Heisenbug Ltd. ([email protected])
--
-- 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);
limited with Ada.Calendar.Time_Zones;
limited with Ada.Containers.Vectors;
limited with Ada.Real_Time;
limited with Ada.Strings.Unbounded;
with Types;
private with Ada.Characters.Handling;
private with GNATCOLL.Traces;
--------------------------------------------------------------------------------
--% @summary
--% Top-level package of the implementation to access openweathermap.org's API.
--
--% @description
--% Provides basic types, restrictions, and information about the API, its
--% implementation, and limitations.
--------------------------------------------------------------------------------
package Open_Weather_Map is
-----------------------------------------------------------------------------
-- API restrictions as documented on their web page
-----------------------------------------------------------------------------
Default_Cache_Interval : constant Ada.Real_Time.Time_Span :=
Ada.Real_Time.Seconds (10);
--% Default value for the time the values of a query shall be retained before
--% we refresh the data from the server.
-- According to openweathermap.org/price the limit on API calls per minute
-- per account (regardless of API keys) is 60 calls even for the free model,
-- so we can in theory run at least one query each second. To be on the safe
-- side, we restrict it to a tenth of that, i.e. one query every ten
-- seconds. This leaves open the possibility to run a couple of queries in
-- parallel.
Default_Rate_Limit : constant Ada.Real_Time.Time_Span :=
Ada.Real_Time.Milliseconds (500);
--% Default value for the minimum temporal separation of queries sent to the
--% server over the same connection.
-- We limit the number of consecutive requests per HTTP connection to be at
-- least that apart.
subtype Max_Group_Size is Positive range 1 .. 20;
--% Maximum number of ids in a group query.
-- API limitation.
-----------------------------------------------------------------------------
-- API types
-----------------------------------------------------------------------------
subtype API_Key is String (1 .. 32) with
Dynamic_Predicate =>
(for all C of API_Key =>
Ada.Characters.Handling.Is_Hexadecimal_Digit (C)),
Predicate_Failure =>
(raise Constraint_Error with
"""" & API_Key & """ is not a 32 character hexadecimal string");
--% API key is a hexadecimal representation of a 128 bit value.
Invalid_API_Key : constant API_Key;
--% Denotes the all '0' key.
-- We're presuming that this key will be invalid for anyone.
type City_Id is range 1 .. 99_999_999;
--% City ids.
-- Not sure about the actual range, though.
-----------------------------------------------------------------------------
-- Support types
-----------------------------------------------------------------------------
type Group_List is array (Max_Group_Size range <>) of City_Id;
--% Type representing a list of ids (for a group query).
type Geo_Coordinates is
record
Latitude : Types.Latitude;
Longitude : Types.Longitude;
end record;
--% Type representing geographical 2-D coordinates.
--% @field Latitude
--% The latitude part of the coordinates.
--% @field Longitude
--% The longitude part of the coordinates.
type City_Data is
record
Location : Geo_Coordinates;
Temperature : Types.Kelvin;
Humidity : Types.Humidity;
Pressure : Types.Pressure;
Name : Ada.Strings.Unbounded.Unbounded_String;
Sunrise : Ada.Calendar.Time;
Sunset : Ada.Calendar.Time;
Time_Zone : Ada.Calendar.Time_Zones.Time_Offset;
Last_Update : Ada.Calendar.Time;
end record;
--% Type representing the set of data returned as per city/location.
-- May depend on the query issued, but that's the general idea.
--% @field Location
--% The geographical location of the city/location.
--% @field Temperature
--% The temperature at the location.
--% @field Humidity
--% The relative humidity at the location.
--% @field Pressure
--% The atmospheric pressure at the location.
--% @field Name
--% Name of the city (may be empty, if no city is associated with the
--% coordinates).
--% @field Sunrise
--% UTC of sunrise at that location.
--% @field Sunset
--% UTC of sunset at that location.
--% @field Time_Zone
--% Local time zone of the location.
--% @field Last_Update
--% UTC of when the data was last updated on the server.
package City_Lists is new Ada.Containers.Vectors (Index_Type => Positive,
Element_Type => City_Data);
--% @field Valid
--% Indicates if the object actually contains data.
--% @field Cities
--% List of cities in the data set.
type Data_Set (Valid : Boolean := False) is
record
case Valid is
when False =>
null;
when True =>
Cities : City_Lists.Vector;
end case;
end record;
-- TODO: This should become either a tagged type, or part of the query
-- objects with suitable accessor functions to cater for the dynamic
-- nature of the data being returned.
Invalid_Data_Set : constant Data_Set;
--% An empty (invalid) data set.
-----------------------------------------------------------------------------
-- Enumeration of (implemented) API services.
-----------------------------------------------------------------------------
type API_Services is
(Current_By_Id, -- "weather?id={city_id}"
Current_By_Coordinates, -- "weather?lat={latitude}&lon={longitude}"
Current_By_Group); -- "group?id={city_id}[,{city_id} ...]
--% List of implemented API services.
--% @value Current_By_Id
--% Current weather data for a city Id.
--% @value Current_By_Coordinates
--% Current weather data for a location.
--% @value Current_By_Group
--% Current weather data for a list of city ids.
--
-- Utility functions
--
-----------------------------------------------------------------------------
-- Application_Directory
-----------------------------------------------------------------------------
function Application_Directory return String with
Global => null;
--% Returns the (system-dependent) local directory where the application
--% expects the configuration and log files and such.
--% @return The directory where configuration and log files should be stored.
-- The underlying implementation uses a constant evaluated at elaboration
-- time, hence the Global aspect of null.
private
OWM_Debug : constant not null GNATCOLL.Traces.Trace_Handle :=
GNATCOLL.Traces.Create (Unit_Name => "Open_Weather_Map");
--% Debug trace for top level package.
API_Host : constant String := "http://api.openweathermap.org";
--% The actual server we're supposed to talk to.
API_Path : constant String := "/data/2.5/";
--% Query path to the currently implemented version of the API.
Invalid_API_Key : constant API_Key := API_Key'(others => '0');
Invalid_Data_Set : constant Data_Set := Data_Set'(Valid => False);
-----------------------------------------------------------------------------
-- Config_Names
--
-- Expected names of fields in the configuration file.
-- Nested package to improve readability when using these constants.
-----------------------------------------------------------------------------
package Config_Names is
-- Proxy configuration fields.
Env_Network_Address : constant String := "http_proxy";
Field_Network_Address : constant String := "proxy.url";
Field_User : constant String := "proxy.user";
Field_Password : constant String := "proxy.password";
-- Account configuration fields.
Field_API_Key : constant String := "api.key";
end Config_Names;
-----------------------------------------------------------------------------
-- To_Service_Name
-----------------------------------------------------------------------------
--% @param Service The service to be translated into an API URL.
--% @return The part of the API URL denoting the name of the service being
--% called.
function To_Service_Name (Service : in API_Services) return String with
Global => null;
-----------------------------------------------------------------------------
-- To_Service_Name
-----------------------------------------------------------------------------
function To_Service_Name (Service : in API_Services) return String is
(case Service is
when Current_By_Id
| Current_By_Coordinates => "weather",
when Current_By_Group => "group");
end Open_Weather_Map;
| 40.173729 | 80 | 0.551946 |
cb830327e8587d20528e2e74380fc1a436851674 | 2,100 | ads | Ada | ADL/src/full/adl_config.ads | JCGobbi/Nucleo-STM32G474RE | 8dc1c4948ffeb11841eed10f1c3708f00fa1d832 | [
"BSD-3-Clause"
] | null | null | null | ADL/src/full/adl_config.ads | JCGobbi/Nucleo-STM32G474RE | 8dc1c4948ffeb11841eed10f1c3708f00fa1d832 | [
"BSD-3-Clause"
] | null | null | null | ADL/src/full/adl_config.ads | JCGobbi/Nucleo-STM32G474RE | 8dc1c4948ffeb11841eed10f1c3708f00fa1d832 | [
"BSD-3-Clause"
] | null | null | null | -- This package was generated by the Ada_Drivers_Library project wizard script
package ADL_Config is
Board : constant String := "NUCLEO_G474RE"; -- From user input
Architecture : constant String := "ARM"; -- From board definition
Vendor : constant String := "STMicro"; -- From board definition
Device_Family : constant String := "STM32G4"; -- From board definition
Device_Name : constant String := "STM32G474xx"; -- From board definition
CPU_Core : constant String := "ARM Cortex-M4F"; -- From mcu definition
High_Speed_External_Clock : constant := 24_000_000; -- From board definition
Number_Of_Interrupts : constant := 102; -- From MCU definition
Has_ZFP_Runtime : constant String := "False"; -- From board definition
Has_Ravenscar_SFP_Runtime : constant String := "True"; -- From board definition
Has_Ravenscar_Full_Runtime : constant String := "True"; -- From board definition
Runtime_Profile : constant String := "full"; -- From user input
Runtime_Name_Suffix : constant String := "stm32g474"; -- From board definition
Runtime_Name : constant String := "full-stm32g474"; -- From user input
Use_Startup_Gen : constant Boolean := False; -- From user input
Has_Custom_Memory_Area_1 : constant Boolean := False; -- From user input
Boot_Memory : constant String := "flash"; -- From user input
Max_Path_Length : constant := 1024; -- From user input
Max_Mount_Points : constant := 2; -- From user input
Max_Mount_Name_Length : constant := 128; -- From user input
end ADL_Config;
| 87.5 | 101 | 0.530476 |
0e7a6f9a4ada785f9c2cebcb6d2b85a9b56f6aaa | 32,533 | adb | Ada | .emacs.d/elpa/ada-mode-5.3.1/gps_source/language.adb | caqg/linux-home | eed631aae6f5e59e4f46e14f1dff443abca5fa28 | [
"Linux-OpenIB"
] | null | null | null | .emacs.d/elpa/ada-mode-5.3.1/gps_source/language.adb | caqg/linux-home | eed631aae6f5e59e4f46e14f1dff443abca5fa28 | [
"Linux-OpenIB"
] | null | null | null | .emacs.d/elpa/ada-mode-5.3.1/gps_source/language.adb | caqg/linux-home | eed631aae6f5e59e4f46e14f1dff443abca5fa28 | [
"Linux-OpenIB"
] | null | null | null | ------------------------------------------------------------------------------
-- G P S --
-- --
-- Copyright (C) 2000-2016, AdaCore --
-- --
-- This 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. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY 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 this software; see file --
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
-- of the license. --
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Ada.Strings.Maps.Constants;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Wide_Wide_Characters.Unicode; use Ada.Wide_Wide_Characters.Unicode;
with Ada.Characters.Wide_Wide_Latin_1;
with GNAT.Expect; use GNAT.Expect;
with GNAT.Regpat; use GNAT.Regpat;
with GNATCOLL.Symbols; use GNATCOLL.Symbols;
with GNATCOLL.Utils; use GNATCOLL.Utils;
with String_Utils; use String_Utils;
with UTF8_Utils; use UTF8_Utils;
package body Language is
Default_Word_Character_Set : constant Character_Set :=
Constants.Letter_Set or Constants.Decimal_Digit_Set or To_Set ("_");
-- Default character set for keywords and indentifiers
procedure Looking_At
(Lang : access Language_Root;
Buffer : String;
First : Natural;
Entity : out Language_Entity;
Next_Char : out Positive;
Line : out Natural;
Column : out Natural);
-- Internal version of Looking_At, which also returns the Line and Column,
-- considering that Buffer (First) is at line 1 column 1.
-- Column is a byte index, not a character index.
---------------------------
-- Can_Tooltip_On_Entity --
---------------------------
function Can_Tooltip_On_Entity
(Lang : access Language_Root;
Entity : String) return Boolean
is
pragma Unreferenced (Lang, Entity);
begin
return True;
end Can_Tooltip_On_Entity;
---------------------
-- Scope_Separator --
---------------------
function Scope_Separator
(Lang : access Language_Root) return String
is
pragma Unreferenced (Lang);
begin
return ".";
end Scope_Separator;
----------------------
-- Explorer_Regexps --
----------------------
function Explorer_Regexps
(Lang : access Language_Root) return Explorer_Categories
is
pragma Unreferenced (Lang);
E : Explorer_Categories (1 .. 0);
begin
return E;
end Explorer_Regexps;
----------
-- Free --
----------
procedure Free (Context : in out Language_Context_Access) is
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Language_Context, Language_Context_Access);
Var : GNAT.Expect.Pattern_Matcher_Access :=
GNAT.Expect.Pattern_Matcher_Access
(Context.Syntax.New_Line_Comment_Start_Regexp);
begin
if Context /= null then
GNAT.Strings.Free (Context.Syntax.Comment_Start);
GNAT.Strings.Free (Context.Syntax.Comment_End);
Basic_Types.Unchecked_Free (Var);
GNAT.Strings.Free (Context.Syntax.New_Line_Comment_Start);
Unchecked_Free (Context);
end if;
end Free;
----------
-- Free --
----------
procedure Free (Lang : in out Language_Access) is
procedure Internal is new Ada.Unchecked_Deallocation
(Language_Root'Class, Language_Access);
begin
if Lang /= null then
Free (Lang.all);
Internal (Lang);
end if;
end Free;
procedure Free (List : in out Construct_List) is
Info, Tmp : Construct_Access;
procedure Free is new
Ada.Unchecked_Deallocation (Construct_Information, Construct_Access);
begin
Info := List.First;
loop
exit when Info = null;
GNAT.Strings.Free (Info.Profile);
Tmp := Info;
Info := Info.Next;
Free (Tmp);
end loop;
List.First := null;
List.Current := null;
List.Last := null;
end Free;
----------
-- Free --
----------
procedure Free (Category : in out Explorer_Category) is
begin
Basic_Types.Unchecked_Free (Category.Regexp);
end Free;
----------
-- Free --
----------
procedure Free (Categories : in out Explorer_Categories) is
begin
for C in Categories'Range loop
Free (Categories (C));
end loop;
end Free;
--------------------
-- Is_System_File --
--------------------
function Is_System_File
(Lang : access Language_Root;
File_Name : String) return Boolean
is
pragma Unreferenced (Lang, File_Name);
begin
return False;
end Is_System_File;
----------------
-- Looking_At --
----------------
procedure Looking_At
(Lang : access Language_Root;
Buffer : String;
First : Natural;
Entity : out Language_Entity;
Next_Char : out Positive)
is
Line, Column : Natural;
begin
Looking_At (Lang, Buffer, First, Entity, Next_Char, Line, Column);
end Looking_At;
procedure Looking_At
(Lang : access Language_Root;
Buffer : String;
First : Natural;
Entity : out Language_Entity;
Next_Char : out Positive;
Line : out Natural;
Column : out Natural)
is
Context : constant Language_Context_Access :=
Get_Language_Context (Language_Access (Lang));
Keys : constant GNAT.Expect.Pattern_Matcher_Access :=
Keywords (Language_Access (Lang));
Buffer_Length : constant Natural := Buffer'Last - First + 1;
Matched : Match_Array (0 .. 1);
C : Wide_Wide_Character;
Tmp : Natural;
Found : Boolean;
use GNAT.Strings;
begin
Line := 1;
Column := 1;
if Buffer (First) = ASCII.LF then
Next_Char := First + 1;
Line := Line + 1;
Column := 1;
Entity := Normal_Text;
return;
end if;
-- Do we have a comment ?
if Context.Syntax.Comment_Start /= null
and then Starts_With
(Buffer (First .. Buffer'Last), Context.Syntax.Comment_Start.all)
then
Entity := Comment_Text;
Next_Char := First + Context.Syntax.Comment_Start'Length;
Column := Column + Context.Syntax.Comment_Start'Length;
while Starts_With
(Buffer (Next_Char .. Buffer'Last), Context.Syntax.Comment_End.all)
loop
Tmp := UTF8_Next_Char (Buffer, Next_Char);
Column := Column + (Tmp - Next_Char);
Next_Char := Tmp;
if Next_Char <= Buffer'Last
and then Buffer (Next_Char) = ASCII.LF
then
Column := 1;
Line := Line + 1;
end if;
end loop;
Next_Char := Next_Char + Context.Syntax.Comment_End'Length;
Column := Column + Context.Syntax.Comment_End'Length;
return;
end if;
-- Do we have a comment that ends on newline ?
if Context.Syntax.New_Line_Comment_Start /= null then
Found := Starts_With
(Buffer (First .. Buffer'Last),
Context.Syntax.New_Line_Comment_Start.all);
elsif Context.Syntax.New_Line_Comment_Start_Regexp /= null then
Found := Match (Context.Syntax.New_Line_Comment_Start_Regexp.all,
Buffer (First .. Buffer'Last));
else
Found := False;
end if;
if Found then
Entity := Comment_Text;
Next_Char := UTF8_Next_Char (Buffer, First);
while Next_Char <= Buffer'Last
and then Buffer (Next_Char) /= ASCII.LF
loop
Tmp := UTF8_Next_Char (Buffer, Next_Char);
Column := Column + (Tmp - Next_Char);
Next_Char := Tmp;
end loop;
return;
end if;
-- Do we have a string ?
-- Note that we consider that strings never span over multiple lines...
if Buffer (First) = Context.String_Delimiter then
Entity := String_Text;
Next_Char := First;
if Next_Char < Buffer'Last
and then Buffer (Next_Char + 1) /= ASCII.LF
then
loop
Next_Char := UTF8_Next_Char (Buffer, Next_Char);
Column := Column + 1;
exit when Next_Char >= Buffer'Last
or else Buffer (Next_Char + 1) = ASCII.LF
or else
(Buffer (Next_Char) = Context.String_Delimiter
and then
(Context.Quote_Character = ASCII.NUL
or else
Buffer (Next_Char - 1) /= Context.Quote_Character));
end loop;
end if;
if Next_Char <= Buffer'Last then
Tmp := UTF8_Next_Char (Buffer, Next_Char);
Column := Column + (Tmp - Next_Char);
Next_Char := Tmp;
end if;
return;
end if;
-- A protected constant character
-- ??? The following test still does not handle cases such as
-- '\012' for instance, or multi-byte character constants.
if Buffer_Length > 4
and then Buffer (First) = Context.Constant_Character
and then Buffer (First + 1) = Context.Quote_Character
and then Buffer (First + 3) = Context.Constant_Character
then
Entity := Character_Text;
Next_Char := First + 4;
Column := Column + 4;
return;
end if;
-- A constant character
if Buffer_Length > 3
and then Buffer (First) = Context.Constant_Character
and then Buffer (First + 2) = Context.Constant_Character
then
Entity := Character_Text;
Next_Char := First + 3;
Column := Column + 3;
return;
end if;
-- Do we have a keyword ?
-- ??? It is assumed the regexp should check at the current char
-- only, not beyond for efficiency...
if Keys /= null then
Match (Keys.all, Buffer (First .. Buffer'Last), Matched);
if Matched (0) /= No_Match then
Next_Char := UTF8_Next_Char (Buffer, Matched (0).Last);
Column := Column + Matched (0).Last - Matched (0).First + 1;
Entity := Keyword_Text;
return;
end if;
end if;
-- Another special character, not part of a word: just skip it, before
-- doing some regexp matching
-- It is better to return a pointer to the newline, so that the icons
-- on the side might be displayed properly.
if not Is_Word_Char
(Language_Access (Lang),
UTF8_Get_Char (Buffer (First .. Buffer'Last)))
then
Entity := Normal_Text;
Next_Char := UTF8_Next_Char (Buffer, First);
Column := Column + (Next_Char - First);
while Next_Char <= Buffer'Last loop
C := UTF8_Get_Char (Buffer (Next_Char .. Buffer'Last));
exit when C = Ada.Characters.Wide_Wide_Latin_1.LF
or else not Is_Space (C);
Tmp := UTF8_Next_Char (Buffer, Next_Char);
Column := Column + (Tmp - Next_Char);
Next_Char := Tmp;
end loop;
return;
end if;
-- Skip to the next meaningful character. we know we are
-- starting with a letter
Next_Char := UTF8_Next_Char (Buffer, First);
Column := Column + (Next_Char - First);
Entity := Normal_Text;
if Buffer (Next_Char) = ASCII.LF then
return;
end if;
-- Skip the current word. We only take into account Is_Entity_Letter,
-- not the full set of chars supported by the language for its keywords
-- because of cases like "<foo>bar</foo>" in XML, which would otherwise
-- consider this as a single word when they are in fact several.
while Next_Char <= Buffer'Last
and then Is_Entity_Letter
(UTF8_Get_Char (Buffer (Next_Char .. Buffer'Last)))
loop
Tmp := UTF8_Next_Char (Buffer, Next_Char);
Column := Column + (Tmp - Next_Char);
Next_Char := Tmp;
end loop;
end Looking_At;
-------------------------------------
-- To_Simple_Construct_Information --
-------------------------------------
procedure To_Simple_Construct_Information
(Construct : Construct_Information;
Simple : out Simple_Construct_Information;
Full_Copy : Boolean)
is
pragma Unreferenced (Full_Copy);
begin
Simple :=
(Category => Construct.Category,
Is_Declaration => Construct.Is_Declaration,
Is_Generic_Spec => Construct.Is_Generic_Spec,
Visibility => Construct.Visibility,
Name => Construct.Name,
Sloc_Start => Construct.Sloc_Start,
Sloc_Entity => Construct.Sloc_Entity,
Sloc_End => Construct.Sloc_End,
Attributes => Construct.Attributes,
Profile_Cache => null);
end To_Simple_Construct_Information;
------------------
-- Comment_Line --
------------------
function Comment_Line
(Lang : access Language_Root;
Line : String;
Comment : Boolean := True;
Clean : Boolean := False) return String
is
pragma Unreferenced (Lang, Comment, Clean);
begin
return Line;
end Comment_Line;
------------------
-- Comment_Block --
------------------
function Comment_Block
(Lang : access Language_Root;
Block : String;
Comment : Boolean := True;
Clean : Boolean := False) return String
is
Start_Of_Line : Natural := Block'First;
End_Of_Line : Natural;
New_Block : Unbounded_String := Null_Unbounded_String;
begin
loop
End_Of_Line := Next_Line (Block, Start_Of_Line);
if End_Of_Line /= Block'Last and then End_Of_Line /= Block'First then
End_Of_Line := End_Of_Line - 1;
end if;
Append
(New_Block,
Comment_Line
(Language_Access (Lang),
Block (Start_Of_Line .. End_Of_Line),
Comment,
Clean));
Start_Of_Line := Next_Line (Block, Start_Of_Line);
exit when Start_Of_Line = Block'Last;
end loop;
return To_String (New_Block);
end Comment_Block;
----------------------
-- Parse_Constructs --
----------------------
procedure Parse_Constructs
(Lang : access Language_Root;
File : GNATCOLL.VFS.Virtual_File;
Buffer : UTF8_String;
Result : out Construct_List)
is
pragma Unreferenced (File);
Matches : Match_Array (0 .. 10);
Categories : constant Explorer_Categories :=
Explorer_Regexps (Language_Access (Lang));
First : Natural;
Line : Natural;
Line_Pos : Natural;
Sloc_Entity : Source_Location;
Sloc_Start : Source_Location;
Sloc_End : Source_Location;
Info : Construct_Access;
Match_Index : Natural;
End_Index : Natural;
procedure Forward
(Index : Natural;
Sloc : in out Source_Location);
-- Compute Line and Column fields in Sloc and update Line and Line_Pos
-------------
-- Forward --
-------------
procedure Forward
(Index : Natural;
Sloc : in out Source_Location) is
begin
for J in Index .. Sloc.Index loop
if Buffer (J) = ASCII.LF then
Line := Line + 1;
Line_Pos := J;
end if;
end loop;
Sloc.Line := Line;
Sloc.Column := Sloc.Index - Line_Pos;
end Forward;
begin
Result := (null, null, null, 0);
-- For each category, parse the buffer
for C in Categories'Range loop
First := Buffer'First;
Line := 1;
Line_Pos := 0;
loop
Match (Categories (C).Regexp.all,
Buffer (First .. Buffer'Last),
Matches);
exit when Matches (0) = No_Match;
Match_Index := Categories (C).Position_Index;
End_Index := Categories (C).End_Index;
if Matches (Match_Index) /= No_Match then
Sloc_Start.Index := Matches (0).First;
Sloc_Entity.Index := Matches (Match_Index).First;
Sloc_End.Index := Matches (End_Index).Last;
Forward (First, Sloc_Start);
Forward (Sloc_Start.Index + 1, Sloc_Entity);
Forward (Sloc_Entity.Index + 1, Sloc_End);
Info := Result.Current;
Result.Current := new Construct_Information;
if Result.First = null then
Result.First := Result.Current;
else
Result.Current.Prev := Info;
Result.Current.Next := Info.Next;
Info.Next := Result.Current;
end if;
Result.Last := Result.Current;
Result.Current.Category := Categories (C).Category;
Result.Current.Category_Name := Categories (C).Category_Name;
Result.Size := Result.Size + 1;
if Categories (C).Make_Entry /= null then
Result.Current.Name := Lang.Symbols.Find
(Categories (C).Make_Entry (Buffer, Matches));
else
Result.Current.Name := Lang.Symbols.Find
(Buffer (Matches (Match_Index).First ..
Matches (Match_Index).Last));
end if;
-- Result.Current.Profile := ???
Result.Current.Sloc_Entity := Sloc_Entity;
Result.Current.Sloc_Start := Sloc_Start;
Result.Current.Sloc_End := Sloc_End;
Result.Current.Is_Declaration := False;
end if;
First := Matches (End_Index).Last + 1;
end loop;
end loop;
end Parse_Constructs;
--------------------
-- Parse_Entities --
--------------------
procedure Parse_Entities
(Lang : access Language_Root;
Buffer : String;
Callback : Entity_Callback)
is
use type GNAT.Strings.String_Access;
Index : Natural := Buffer'First;
Next_Char : Natural;
End_Char : Natural;
Entity : Language_Entity;
Line : Natural;
Line_Inc : Natural;
Col : Natural;
Column : Natural;
Column_Inc : Natural;
begin
Line := 1;
Column := 1;
while Index < Buffer'Last loop
Looking_At
(Lang, Buffer, Index, Entity, Next_Char, Line_Inc, Column_Inc);
if Next_Char = Buffer'Last then
End_Char := Buffer'Last;
else
End_Char := Next_Char - 1;
end if;
-- If we are still on the same line, Column_Inc is an increment
-- compared to what we have initially, otherwise it is an absolute
-- column.
if Line_Inc = 1 then
Column_Inc := Column + Column_Inc - 1;
end if;
-- Looking_At goes always one character beyond characters and
-- strings, otherwise next call to Looking_At would start on
-- a string or character delimiter. Keywords are also set one
-- character beyond.
if Column_Inc > 1
and then (Entity = String_Text
or else Entity = Character_Text
or else Entity = Keyword_Text)
then
Col := Column_Inc - 1;
else
Col := Column_Inc;
end if;
exit when Callback
(Entity,
(Line, Column, Index),
(Line + Line_Inc - 1, Col, End_Char),
Get_Language_Context
(Language_Access (Lang)).Syntax.Comment_Start /= null
and then Entity = Comment_Text and then Next_Char > Buffer'Last);
Line := Line + Line_Inc - 1;
Column := Column_Inc;
Index := Next_Char;
end loop;
end Parse_Entities;
---------------------------
-- Get_Referenced_Entity --
---------------------------
procedure Get_Referenced_Entity
(Lang : access Language_Root;
Buffer : String;
Construct : Simple_Construct_Information;
Sloc_Start : out Source_Location;
Sloc_End : out Source_Location;
Success : out Boolean;
From_Index : Natural := 0)
is
pragma Unreferenced
(Lang, Buffer, Construct, Sloc_Start, Sloc_End, From_Index);
begin
Success := False;
end Get_Referenced_Entity;
-------------------
-- Format_Buffer --
-------------------
procedure Format_Buffer
(Lang : access Language_Root;
Buffer : String;
Replace : Replace_Text_Callback;
From, To : Natural := 0;
Indent_Params : Indent_Parameters := Default_Indent_Parameters;
Indent_Offset : Natural := 0;
Case_Exceptions : Case_Handling.Casing_Exceptions :=
Case_Handling.No_Casing_Exception;
Is_Optional_Keyword : access function (S : String)
return Boolean := null)
is
pragma Unreferenced
(Lang, Indent_Offset, Case_Exceptions, Is_Optional_Keyword);
Use_Tabs : Boolean renames Indent_Params.Use_Tabs;
Index : Natural;
Indent : Natural := 0;
Start_Of_Line : Natural;
Start_Prev_Line : Natural;
function Find_Line_Start
(Buffer : String; Index : Natural) return Natural;
-- Find the starting ASCII.LF character of the line positioned at
-- Buffer (Index).
---------------------
-- Find_Line_Start --
---------------------
function Find_Line_Start
(Buffer : String; Index : Natural) return Natural
is
Result : Natural := Index;
begin
while Result > Buffer'First
and then Buffer (Result) /= ASCII.LF
loop
Result := Result - 1;
end loop;
return Result;
end Find_Line_Start;
begin
if Buffer'Length <= 1 or else To > From + 1 then
return;
end if;
Start_Of_Line := Find_Line_Start (Buffer, Buffer'Last - 1);
Start_Prev_Line := Find_Line_Start (Buffer, Start_Of_Line - 1);
-- Compute the indentation level
for J in Start_Prev_Line + 1 .. Start_Of_Line - 1 loop
if Buffer (J) = ' ' then
Indent := Indent + 1;
elsif Buffer (J) = ASCII.HT then
Indent := Indent + Tab_Width - (Indent mod Tab_Width);
else
exit;
end if;
end loop;
-- Find the blank slice to replace
Index := Start_Of_Line + 1;
while Index < Buffer'Last
and then (Buffer (Index) = ' ' or else Buffer (Index) = ASCII.HT)
loop
Index := Index + 1;
end loop;
Replace
(To, 1, Index - Start_Of_Line,
Blank_Slice (Indent, Use_Tabs, Tab_Width));
end Format_Buffer;
-------------------
-- Category_Name --
-------------------
function Category_Name
(Category : Language.Language_Category;
Name : GNATCOLL.Symbols.Symbol := GNATCOLL.Symbols.No_Symbol)
return String
is
use type Strings.String_Access;
begin
if Name /= No_Symbol then
return Get (Name).all;
end if;
case Category is
when Cat_Unknown => return "";
when Cat_Custom => return "custom";
when Cat_Package => return "package";
when Cat_Namespace => return "namespace";
when Cat_Task => return "task";
when Cat_Procedure => return "subprogram";
when Cat_Function => return "subprogram";
when Cat_Method => return "method";
when Cat_Constructor => return "constructor";
when Cat_Destructor => return "destructor";
when Cat_Protected => return "protected";
when Cat_Entry => return "entry";
when Cat_Class => return "class";
when Cat_Structure => return "structure";
when Cat_Case_Inside_Record => return "structure variant part";
when Cat_Union => return "union";
when Cat_Type => return "type";
when Cat_Subtype => return "subtype";
when Cat_Variable => return "variable";
when Cat_Local_Variable => return "variable";
when Cat_Parameter => return "parameter";
when Cat_Discriminant => return "discriminant";
when Cat_Field => return "field";
when Cat_Literal => return "literal";
when Cat_Representation_Clause => return "representation clause";
when Cat_With => return "with";
when Cat_Use => return "use";
when Cat_Include => return "include";
when Construct_Category => return "";
when Cat_Exception_Handler => return "";
when Cat_Pragma => return "pragma";
when Cat_Aspect => return "aspect";
end case;
end Category_Name;
--------------------------------
-- Get_Indentation_Parameters --
--------------------------------
procedure Get_Indentation_Parameters
(Lang : access Language_Root;
Params : out Indent_Parameters;
Indent_Style : out Indentation_Kind) is
begin
Params := Lang.Indent_Params;
Indent_Style := Lang.Indent_Style;
end Get_Indentation_Parameters;
--------------------------------
-- Set_Indentation_Parameters --
--------------------------------
procedure Set_Indentation_Parameters
(Lang : access Language_Root;
Params : Indent_Parameters;
Indent_Style : Indentation_Kind) is
begin
Lang.Indent_Params := Params;
Lang.Indent_Style := Indent_Style;
end Set_Indentation_Parameters;
----------
-- Free --
----------
procedure Free (Fields : in out Project_Field_Array) is
begin
for F in Fields'Range loop
Strings.Free (Fields (F).Attribute_Name);
Strings.Free (Fields (F).Attribute_Index);
Strings.Free (Fields (F).Description);
end loop;
end Free;
------------------------
-- Word_Character_Set --
------------------------
function Word_Character_Set
(Lang : access Language_Root)
return Character_Set
is
pragma Unreferenced (Lang);
begin
return Default_Word_Character_Set;
end Word_Character_Set;
------------------
-- Is_Word_Char --
------------------
function Is_Word_Char
(Lang : access Language_Root; Char : Wide_Wide_Character) return Boolean
is
pragma Unreferenced (Lang);
begin
return Is_Entity_Letter (Char);
end Is_Word_Char;
---------
-- "=" --
---------
overriding function "=" (S1, S2 : Source_Location) return Boolean is
begin
if S1.Index > 0 and then S2.Index > 0 then
return S1.Index = S2.Index;
else
return S1.Line = S2.Line
and then S1.Column = S2.Column;
end if;
end "=";
---------
-- "<" --
---------
function "<" (S1, S2 : Source_Location) return Boolean is
begin
if S1.Index > 0 and then S2.Index > 0 then
return S1.Index < S2.Index;
elsif S1.Line = S2.Line then
return S1.Column < S2.Column;
else
return S1.Line < S2.Line;
end if;
end "<";
----------
-- "<=" --
----------
function "<=" (S1, S2 : Source_Location) return Boolean is
begin
return S1 = S2 or else S1 < S2;
end "<=";
---------
-- ">" --
---------
function ">" (S1, S2 : Source_Location) return Boolean is
begin
return S2 < S1;
end ">";
----------
-- ">=" --
----------
function ">=" (S1, S2 : Source_Location) return Boolean is
begin
return not (S1 < S2);
end ">=";
---------------------------
-- Parse_Tokens_Backward --
---------------------------
procedure Parse_Tokens_Backwards
(Lang : access Language_Root;
Buffer : UTF8_String;
Start_Offset : String_Index_Type;
End_Offset : String_Index_Type := 0;
-- ??? This analysis should be done when looking for comments !!!
Callback :
access procedure (Token : Token_Record;
Stop : in out Boolean))
is
pragma Unreferenced (Lang);
Lowest : constant String_Index_Type :=
String_Index_Type'Max (End_Offset, String_Index_Type (Buffer'First));
Index : String_Index_Type := Start_Offset;
Stop : Boolean := False;
begin
if Index not in Lowest .. String_Index_Type (Buffer'Last) then
return;
else
Skip_Word
(Buffer (Natural (Lowest) .. Natural (Index)),
Natural (Index),
Step => -1);
Callback
((Tok_Type => No_Token,
Token_First => Index + 1,
Token_Last => Start_Offset),
Stop);
end if;
end Parse_Tokens_Backwards;
------------------------------
-- Parse_Reference_Backward --
------------------------------
function Parse_Reference_Backwards
(Lang : access Language_Root;
Buffer : UTF8_String;
Start_Offset : String_Index_Type;
End_Offset : String_Index_Type := 0) return String
is
Buf_Start : Integer := 1;
Buf_End : Integer := 0;
procedure Callback
(Token : Token_Record;
Stop : in out Boolean);
procedure Callback
(Token : Token_Record;
Stop : in out Boolean)
is
begin
Buf_End := Integer (Token.Token_Last);
Buf_Start := Integer (Token.Token_First);
Stop := True;
end Callback;
begin
Lang.Parse_Tokens_Backwards
(Buffer => Buffer,
Start_Offset => Start_Offset,
End_Offset => End_Offset,
Callback => Callback'Access);
return Buffer (Buf_Start .. Buf_End);
end Parse_Reference_Backwards;
-----------------
-- Set_Symbols --
-----------------
procedure Set_Symbols
(Self : access Language_Root'Class;
Symbols : not null access GNATCOLL.Symbols.Symbol_Table_Record'Class) is
begin
Self.Symbols := Symbol_Table_Access (Symbols);
end Set_Symbols;
-------------
-- Symbols --
-------------
function Symbols
(Self : access Language_Root'Class)
return GNATCOLL.Symbols.Symbol_Table_Access is
begin
return Self.Symbols;
end Symbols;
----------------------
-- Entities_Indexed --
----------------------
function Entities_Indexed (Self : Language_Root) return Boolean is
pragma Unreferenced (Self);
begin
return False;
end Entities_Indexed;
end Language;
| 30.895537 | 79 | 0.539483 |
20467d1486fb5858a911a1a79ac0e5a90cdac91b | 848 | adb | Ada | gdb/testsuite/gdb.ada/ref_tick_size/pck.adb | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | 1 | 2020-10-14T03:24:35.000Z | 2020-10-14T03:24:35.000Z | gdb/testsuite/gdb.ada/ref_tick_size/pck.adb | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | null | null | null | gdb/testsuite/gdb.ada/ref_tick_size/pck.adb | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | null | null | null | -- Copyright 2008-2021 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System;
package body Pck is
procedure Do_Nothing (A : System.Address) is
begin
null;
end Do_Nothing;
end Pck;
| 32.615385 | 73 | 0.727594 |
df2d65f70aa03db6a2decc0fb0d7a98b95d9e24d | 4,368 | adb | Ada | src/data.adb | Rassol/AdaSem | 6452128691a65795fd115321391945f309d9759a | [
"Apache-2.0"
] | null | null | null | src/data.adb | Rassol/AdaSem | 6452128691a65795fd115321391945f309d9759a | [
"Apache-2.0"
] | null | null | null | src/data.adb | Rassol/AdaSem | 6452128691a65795fd115321391945f309d9759a | [
"Apache-2.0"
] | null | null | null | -- Implementation of class called data
with Text_IO, Ada.Integer_Text_IO;
use Text_IO, Ada.Integer_Text_IO;
package body Data is
procedure Find_Borders (s: out integer; f: out integer; num: in integer) is
begin
s:= 1+num*n/p;
f:= (num+1)*n/p;
end Find_Borders;
--Input Vector from keyboard
procedure Vector_Input (A: out Vector; S: in String) is
begin
for i in 1..n loop
Get(A(i));
Put(S);
Put("[");
Put(i);
Put("]= ");
Put(A(i));
Put(" inputed");
New_Line(1);
end loop;
end Vector_input;
--Fill Vector with numbers
procedure Vector_Fill (A: out Vector; B: in Integer) is
begin
for i in 1..n loop
A(i):=B;
end loop;
end Vector_Fill;
--Print Vector on screen
procedure Vector_Output(A: in Vector) is
begin
for i in 1..n loop
Put(A(i));
Put(" ");
end loop;
end Vector_Output;
--Input Matrix from keyboard
procedure Matrix_Input (A: out Matrix; S: in String) is
begin
for i in 1..n loop
for j in 1..n loop
Get(A(i)(j));
Put(S);
Put("[");
Put(i);
Put("][");
Put(j);
Put("]= ");
Put(A(i)(j));
Put(" inputed");
New_Line(1);
end loop;
end loop;
end Matrix_Input;
--Fill Matrix with numbers
procedure Matrix_Fill (A: out Matrix; B: in Integer) is
begin
for i in 1..n loop
for j in 1..n loop
A(i)(j):=B;
end loop;
end loop;
end Matrix_Fill;
--Print Matrix on screen
procedure Matrix_Output (A: in Matrix) is
begin
for i in 1..n loop
for j in 1..n loop
Put(A(i)(j));
Put(" ");
end loop;
New_Line(1);
end loop;
end Matrix_Output;
--Adds the vector A to the vector B
function Vector_Add (A,B: in Vector; num: in integer) return Vector is
C: Vector;
s, f: integer;
begin
Vector_Fill(C,0);
Find_Borders(s,f,num);
for i in s..f loop
C(i):=A(i)+B(i);
end loop;
return C;
end Vector_Add;
--Adds the matrix A to the matrix B
function Matrix_Add (A,B: in Matrix; num: in integer) return Matrix is
C: Matrix;
s, f: integer;
begin
Matrix_Fill(C,0);
Find_Borders(s,f,num);
for i in s..f loop
for j in 1..n loop
C(i)(j):= A(i)(j)+B(i)(j);
end loop;
end loop;
return C;
end Matrix_Add;
--Multiply Matrix
function Matrix_Multiply (A,B: in Matrix; num: in integer) return Matrix is
C: Matrix;
s, f: integer;
begin
Matrix_Fill(C,0);
Find_Borders(s,f,num);
for i in s..f loop
for j in 1..n loop
C(i)(j):=0;
for k in 1..n loop
C(i)(j):=C(i)(j)+A(i)(k)*B(k)(j);
end loop;
end loop;
end loop;
return C;
end Matrix_Multiply;
--Multiply Vector on Matrix
function Matrix_Vector_Multiply (A: in Matrix; B: in Vector; num: in integer) return Vector is
C: Vector;
s, f: integer;
begin
Vector_Fill(C,0);
Find_Borders(s,f,num);
for i in s..f loop
C(i):=0;
for j in 1..n loop
C(i):=C(i)+A(j)(i)*B(i);
end loop;
end loop;
return C;
end Matrix_Vector_Multiply;
--Multiply Matrix on Number
function Matrix_Number_Multiply (A: in Matrix; B,num: in integer) return Matrix is
C: Matrix;
s, f: integer;
begin
Matrix_Fill(C,0);
Find_Borders(s,f,num);
for i in s..f loop
for j in 1..n loop
C(i)(j):= A(i)(j)*B;
end loop;
end loop;
return C;
end Matrix_Number_Multiply;
--Calculating Func1
--d=((A+B)*(C*(MA*ME)))
procedure Func(A: out Vector; B,C: in Vector;MO,MK,MR: in Matrix; d: in Integer; num: in integer) is
Res: Vector;
s, f: integer;
begin
Find_Borders(s,f,num);
Res:= Matrix_Vector_Multiply(Matrix_Add(MO,Matrix_Number_Multiply(Matrix_Multiply(MK,MR,num),d,num),num),Vector_Add(B,C,num),num);
for i in s..f loop
A(i):= Res(i);
end loop;
end Func;
end Data;
| 24.539326 | 136 | 0.525641 |
235be1e59b6eca86e3ba177ce53dbe8192923d89 | 7,566 | adb | Ada | LISTA3/b__main.adb | druzzt/NIEZAWODNE_SYSTEMY_INFORMATYCZNE | 47cfb6792cec9ba86641df8b56b074b42e941ac5 | [
"MIT"
] | null | null | null | LISTA3/b__main.adb | druzzt/NIEZAWODNE_SYSTEMY_INFORMATYCZNE | 47cfb6792cec9ba86641df8b56b074b42e941ac5 | [
"MIT"
] | null | null | null | LISTA3/b__main.adb | druzzt/NIEZAWODNE_SYSTEMY_INFORMATYCZNE | 47cfb6792cec9ba86641df8b56b074b42e941ac5 | [
"MIT"
] | null | null | null | pragma Ada_95;
pragma Source_File_Name (ada_main, Spec_File_Name => "b__main.ads");
pragma Source_File_Name (ada_main, Body_File_Name => "b__main.adb");
pragma Suppress (Overflow_Check);
with Ada.Exceptions;
package body ada_main is
pragma Warnings (Off);
E72 : Short_Integer; pragma Import (Ada, E72, "system__os_lib_E");
E13 : Short_Integer; pragma Import (Ada, E13, "system__soft_links_E");
E23 : Short_Integer; pragma Import (Ada, E23, "system__exception_table_E");
E46 : Short_Integer; pragma Import (Ada, E46, "ada__io_exceptions_E");
E48 : Short_Integer; pragma Import (Ada, E48, "ada__tags_E");
E45 : Short_Integer; pragma Import (Ada, E45, "ada__streams_E");
E70 : Short_Integer; pragma Import (Ada, E70, "interfaces__c_E");
E25 : Short_Integer; pragma Import (Ada, E25, "system__exceptions_E");
E75 : Short_Integer; pragma Import (Ada, E75, "system__file_control_block_E");
E64 : Short_Integer; pragma Import (Ada, E64, "system__file_io_E");
E68 : Short_Integer; pragma Import (Ada, E68, "system__finalization_root_E");
E66 : Short_Integer; pragma Import (Ada, E66, "ada__finalization_E");
E17 : Short_Integer; pragma Import (Ada, E17, "system__secondary_stack_E");
E06 : Short_Integer; pragma Import (Ada, E06, "ada__text_io_E");
E77 : Short_Integer; pragma Import (Ada, E77, "railway_E");
Local_Priority_Specific_Dispatching : constant String := "";
Local_Interrupt_States : constant String := "";
Is_Elaborated : Boolean := False;
procedure finalize_library is
begin
E06 := E06 - 1;
declare
procedure F1;
pragma Import (Ada, F1, "ada__text_io__finalize_spec");
begin
F1;
end;
declare
procedure F2;
pragma Import (Ada, F2, "system__file_io__finalize_body");
begin
E64 := E64 - 1;
F2;
end;
declare
procedure Reraise_Library_Exception_If_Any;
pragma Import (Ada, Reraise_Library_Exception_If_Any, "__gnat_reraise_library_exception_if_any");
begin
Reraise_Library_Exception_If_Any;
end;
end finalize_library;
procedure adafinal is
procedure s_stalib_adafinal;
pragma Import (C, s_stalib_adafinal, "system__standard_library__adafinal");
procedure Runtime_Finalize;
pragma Import (C, Runtime_Finalize, "__gnat_runtime_finalize");
begin
if not Is_Elaborated then
return;
end if;
Is_Elaborated := False;
Runtime_Finalize;
s_stalib_adafinal;
end adafinal;
type No_Param_Proc is access procedure;
procedure adainit is
Main_Priority : Integer;
pragma Import (C, Main_Priority, "__gl_main_priority");
Time_Slice_Value : Integer;
pragma Import (C, Time_Slice_Value, "__gl_time_slice_val");
WC_Encoding : Character;
pragma Import (C, WC_Encoding, "__gl_wc_encoding");
Locking_Policy : Character;
pragma Import (C, Locking_Policy, "__gl_locking_policy");
Queuing_Policy : Character;
pragma Import (C, Queuing_Policy, "__gl_queuing_policy");
Task_Dispatching_Policy : Character;
pragma Import (C, Task_Dispatching_Policy, "__gl_task_dispatching_policy");
Priority_Specific_Dispatching : System.Address;
pragma Import (C, Priority_Specific_Dispatching, "__gl_priority_specific_dispatching");
Num_Specific_Dispatching : Integer;
pragma Import (C, Num_Specific_Dispatching, "__gl_num_specific_dispatching");
Main_CPU : Integer;
pragma Import (C, Main_CPU, "__gl_main_cpu");
Interrupt_States : System.Address;
pragma Import (C, Interrupt_States, "__gl_interrupt_states");
Num_Interrupt_States : Integer;
pragma Import (C, Num_Interrupt_States, "__gl_num_interrupt_states");
Unreserve_All_Interrupts : Integer;
pragma Import (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts");
Detect_Blocking : Integer;
pragma Import (C, Detect_Blocking, "__gl_detect_blocking");
Default_Stack_Size : Integer;
pragma Import (C, Default_Stack_Size, "__gl_default_stack_size");
Leap_Seconds_Support : Integer;
pragma Import (C, Leap_Seconds_Support, "__gl_leap_seconds_support");
procedure Runtime_Initialize (Install_Handler : Integer);
pragma Import (C, Runtime_Initialize, "__gnat_runtime_initialize");
Finalize_Library_Objects : No_Param_Proc;
pragma Import (C, Finalize_Library_Objects, "__gnat_finalize_library_objects");
begin
if Is_Elaborated then
return;
end if;
Is_Elaborated := True;
Main_Priority := -1;
Time_Slice_Value := -1;
WC_Encoding := 'b';
Locking_Policy := ' ';
Queuing_Policy := ' ';
Task_Dispatching_Policy := ' ';
Priority_Specific_Dispatching :=
Local_Priority_Specific_Dispatching'Address;
Num_Specific_Dispatching := 0;
Main_CPU := -1;
Interrupt_States := Local_Interrupt_States'Address;
Num_Interrupt_States := 0;
Unreserve_All_Interrupts := 0;
Detect_Blocking := 0;
Default_Stack_Size := -1;
Leap_Seconds_Support := 0;
Runtime_Initialize (1);
Finalize_Library_Objects := finalize_library'access;
System.Soft_Links'Elab_Spec;
System.Exception_Table'Elab_Body;
E23 := E23 + 1;
Ada.Io_Exceptions'Elab_Spec;
E46 := E46 + 1;
Ada.Tags'Elab_Spec;
Ada.Streams'Elab_Spec;
E45 := E45 + 1;
Interfaces.C'Elab_Spec;
System.Exceptions'Elab_Spec;
E25 := E25 + 1;
System.File_Control_Block'Elab_Spec;
E75 := E75 + 1;
System.Finalization_Root'Elab_Spec;
E68 := E68 + 1;
Ada.Finalization'Elab_Spec;
E66 := E66 + 1;
System.File_Io'Elab_Body;
E64 := E64 + 1;
E70 := E70 + 1;
Ada.Tags'Elab_Body;
E48 := E48 + 1;
System.Soft_Links'Elab_Body;
E13 := E13 + 1;
System.Os_Lib'Elab_Body;
E72 := E72 + 1;
System.Secondary_Stack'Elab_Body;
E17 := E17 + 1;
Ada.Text_Io'Elab_Spec;
Ada.Text_Io'Elab_Body;
E06 := E06 + 1;
E77 := E77 + 1;
end adainit;
procedure Ada_Main_Program;
pragma Import (Ada, Ada_Main_Program, "_ada_main");
function main
(argc : Integer;
argv : System.Address;
envp : System.Address)
return Integer
is
procedure Initialize (Addr : System.Address);
pragma Import (C, Initialize, "__gnat_initialize");
procedure Finalize;
pragma Import (C, Finalize, "__gnat_finalize");
SEH : aliased array (1 .. 2) of Integer;
Ensure_Reference : aliased System.Address := Ada_Main_Program_Name'Address;
pragma Volatile (Ensure_Reference);
begin
gnat_argc := argc;
gnat_argv := argv;
gnat_envp := envp;
Initialize (SEH'Address);
adainit;
Ada_Main_Program;
adafinal;
Finalize;
return (gnat_exit_status);
end;
-- BEGIN Object file/option list
-- /Users/arkadiuszlewandowski/Documents/ada_railway/NIEZAWODNE_SYSTEMY_INFORMATYCZNE/railway.o
-- /Users/arkadiuszlewandowski/Documents/ada_railway/NIEZAWODNE_SYSTEMY_INFORMATYCZNE/main.o
-- -L/Users/arkadiuszlewandowski/Documents/ada_railway/NIEZAWODNE_SYSTEMY_INFORMATYCZNE/
-- -L/Users/arkadiuszlewandowski/Documents/ada_railway/NIEZAWODNE_SYSTEMY_INFORMATYCZNE/
-- -L/usr/local/gnat/lib/gcc/x86_64-apple-darwin13.4.0/4.9.3/adalib/
-- -static
-- -lgnat
-- END Object file/option list
end ada_main;
| 35.521127 | 109 | 0.681998 |
23146a19567c2093f9f013194a77276df97187fa | 2,920 | adb | Ada | bb-runtimes/runtimes/zfp-stm32f3x4/gnat/g-io-put.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/runtimes/zfp-stm32f3x4/gnat/g-io-put.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/runtimes/zfp-stm32f3x4/gnat/g-io-put.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . I O . P U T --
-- --
-- B o d y --
-- --
-- Copyright (C) 2011-2021, AdaCore --
-- --
-- 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. --
-- --
-- --
-- --
-- --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- Implementation of Put (C : Character) based on System.Text_IO.
with System.Text_IO; use System.Text_IO;
separate (GNAT.IO)
procedure Put (C : Character) is
begin
if not Initialized then
Initialize;
end if;
-- GNAT.IO calls Put (ASCII.LF) for New_Line. Compensate.
if C = ASCII.LF and then Use_Cr_Lf_For_New_Line then
while not Is_Tx_Ready loop
null;
end loop;
System.Text_IO.Put (ASCII.CR);
end if;
while not Is_Tx_Ready loop
null;
end loop;
System.Text_IO.Put (C);
end Put;
| 50.344828 | 78 | 0.356164 |
df4f9f4f2625e5cdae61d4a780282a3f35ef056e | 4,252 | adb | Ada | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/a-synbar.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/a-synbar.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/a-synbar.adb | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S Y N C H R O N O U S _ B A R R I E R S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body Ada.Synchronous_Barriers with SPARK_Mode => Off is
protected body Synchronous_Barrier is
-- The condition "Wait'Count = Release_Threshold" opens the barrier when
-- the required number of tasks is reached. The condition "Keep_Open"
-- leaves the barrier open while there are queued tasks. While there are
-- tasks in the queue no new task will be queued (no new protected
-- action can be started on a protected object while another protected
-- action on the same protected object is underway, RM 9.5.1 (4)),
-- guaranteeing that the barrier will remain open only for those tasks
-- already inside the queue when the barrier was open.
entry Wait (Notified : out Boolean)
when Keep_Open or else Wait'Count = Release_Threshold
is
begin
-- If we are executing the entry it means that the required number of
-- tasks have been queued in the entry. Keep_Open barrier will remain
-- true until all queued tasks are out.
Keep_Open := Wait'Count > 0;
-- The last released task will close the barrier and get the Notified
-- token.
Notified := Wait'Count = 0;
end Wait;
end Synchronous_Barrier;
----------------------
-- Wait_For_Release --
----------------------
procedure Wait_For_Release
(The_Barrier : in out Synchronous_Barrier;
Notified : out Boolean)
is
begin
The_Barrier.Wait (Notified);
end Wait_For_Release;
end Ada.Synchronous_Barriers;
| 53.822785 | 79 | 0.487535 |
187df9a0ab0a47a16a230efd1184cfdd0a82bfa4 | 8,253 | ads | Ada | arch/ARM/STM32/svd/stm32wb55x/stm32_svd-lptim2.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 2 | 2018-05-16T03:56:39.000Z | 2019-07-31T13:53:56.000Z | arch/ARM/STM32/svd/stm32wb55x/stm32_svd-lptim2.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | arch/ARM/STM32/svd/stm32wb55x/stm32_svd-lptim2.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | -- 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.LPTIM2 is
pragma Preelaborate;
---------------
-- Registers --
---------------
type ISR_Register is record
CMPM : Boolean := False;
ARRM : Boolean := False;
EXTTRIG : Boolean := False;
CMPOK : Boolean := False;
ARROK : Boolean := False;
UP : Boolean := False;
DOWN : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ISR_Register use record
CMPM at 0 range 0 .. 0;
ARRM at 0 range 1 .. 1;
EXTTRIG at 0 range 2 .. 2;
CMPOK at 0 range 3 .. 3;
ARROK at 0 range 4 .. 4;
UP at 0 range 5 .. 5;
DOWN at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
type ICR_Register is record
CMPMCF : Boolean := False;
ARRMCF : Boolean := False;
EXTTRIGCF : Boolean := False;
CMPOKCF : Boolean := False;
ARROKCF : Boolean := False;
UPCF : Boolean := False;
DOWNCF : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ICR_Register use record
CMPMCF at 0 range 0 .. 0;
ARRMCF at 0 range 1 .. 1;
EXTTRIGCF at 0 range 2 .. 2;
CMPOKCF at 0 range 3 .. 3;
ARROKCF at 0 range 4 .. 4;
UPCF at 0 range 5 .. 5;
DOWNCF at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
type IER_Register is record
CMPMIE : Boolean := False;
ARRMIE : Boolean := False;
EXTTRIGIE : Boolean := False;
CMPOKIE : Boolean := False;
ARROKIE : Boolean := False;
UPIE : Boolean := False;
DOWNIE : Boolean := False;
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IER_Register use record
CMPMIE at 0 range 0 .. 0;
ARRMIE at 0 range 1 .. 1;
EXTTRIGIE at 0 range 2 .. 2;
CMPOKIE at 0 range 3 .. 3;
ARROKIE at 0 range 4 .. 4;
UPIE at 0 range 5 .. 5;
DOWNIE at 0 range 6 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
subtype CFGR_CKPOL_Field is HAL.UInt2;
subtype CFGR_CKFLT_Field is HAL.UInt2;
subtype CFGR_TRGFLT_Field is HAL.UInt2;
subtype CFGR_PRESC_Field is HAL.UInt3;
subtype CFGR_TRIGSEL_Field is HAL.UInt3;
subtype CFGR_TRIGEN_Field is HAL.UInt2;
type CFGR_Register is record
CKSEL : Boolean := False;
CKPOL : CFGR_CKPOL_Field := 16#0#;
CKFLT : CFGR_CKFLT_Field := 16#0#;
-- unspecified
Reserved_5_5 : HAL.Bit := 16#0#;
TRGFLT : CFGR_TRGFLT_Field := 16#0#;
-- unspecified
Reserved_8_8 : HAL.Bit := 16#0#;
PRESC : CFGR_PRESC_Field := 16#0#;
-- unspecified
Reserved_12_12 : HAL.Bit := 16#0#;
TRIGSEL : CFGR_TRIGSEL_Field := 16#0#;
-- unspecified
Reserved_16_16 : HAL.Bit := 16#0#;
TRIGEN : CFGR_TRIGEN_Field := 16#0#;
TIMOUT : Boolean := False;
WAVE : Boolean := False;
WAVEPOL : Boolean := False;
PRELOAD : Boolean := False;
COUNTMODE : Boolean := False;
ENC : Boolean := False;
-- unspecified
Reserved_25_31 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CFGR_Register use record
CKSEL at 0 range 0 .. 0;
CKPOL at 0 range 1 .. 2;
CKFLT at 0 range 3 .. 4;
Reserved_5_5 at 0 range 5 .. 5;
TRGFLT at 0 range 6 .. 7;
Reserved_8_8 at 0 range 8 .. 8;
PRESC at 0 range 9 .. 11;
Reserved_12_12 at 0 range 12 .. 12;
TRIGSEL at 0 range 13 .. 15;
Reserved_16_16 at 0 range 16 .. 16;
TRIGEN at 0 range 17 .. 18;
TIMOUT at 0 range 19 .. 19;
WAVE at 0 range 20 .. 20;
WAVEPOL at 0 range 21 .. 21;
PRELOAD at 0 range 22 .. 22;
COUNTMODE at 0 range 23 .. 23;
ENC at 0 range 24 .. 24;
Reserved_25_31 at 0 range 25 .. 31;
end record;
type CR_Register is record
ENABLE : Boolean := False;
SNGSTRT : Boolean := False;
CNTSTRT : Boolean := False;
COUNTRST : Boolean := False;
RSTARE : Boolean := False;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
ENABLE at 0 range 0 .. 0;
SNGSTRT at 0 range 1 .. 1;
CNTSTRT at 0 range 2 .. 2;
COUNTRST at 0 range 3 .. 3;
RSTARE at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
subtype CMP_CMP_Field is HAL.UInt16;
type CMP_Register is record
CMP : CMP_CMP_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CMP_Register use record
CMP at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype ARR_ARR_Field is HAL.UInt16;
type ARR_Register is record
ARR : ARR_ARR_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for ARR_Register use record
ARR at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
subtype CNT_CNT_Field is HAL.UInt16;
type CNT_Register is record
CNT : CNT_CNT_Field := 16#0#;
-- unspecified
Reserved_16_31 : HAL.UInt16 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CNT_Register use record
CNT at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
type OR_Register is record
OR_0 : Boolean := False;
OR_1 : Boolean := False;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for OR_Register use record
OR_0 at 0 range 0 .. 0;
OR_1 at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
type LPTIM2_Peripheral is record
ISR : aliased ISR_Register;
ICR : aliased ICR_Register;
IER : aliased IER_Register;
CFGR : aliased CFGR_Register;
CR : aliased CR_Register;
CMP : aliased CMP_Register;
ARR : aliased ARR_Register;
CNT : aliased CNT_Register;
OR_k : aliased OR_Register;
end record
with Volatile;
for LPTIM2_Peripheral use record
ISR at 16#0# range 0 .. 31;
ICR at 16#4# range 0 .. 31;
IER at 16#8# range 0 .. 31;
CFGR at 16#C# range 0 .. 31;
CR at 16#10# range 0 .. 31;
CMP at 16#14# range 0 .. 31;
ARR at 16#18# range 0 .. 31;
CNT at 16#1C# range 0 .. 31;
OR_k at 16#20# range 0 .. 31;
end record;
LPTIM2_Periph : aliased LPTIM2_Peripheral
with Import, Address => System'To_Address (16#40008000#);
end STM32_SVD.LPTIM2;
| 31.5 | 66 | 0.543439 |
183b8f9e43e0de107d17ad9a0a7b576c1c6cd7da | 4,166 | adb | Ada | llvm-gcc-4.2-2.9/gcc/ada/s-gloloc-mingw.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | 1 | 2016-04-09T02:58:13.000Z | 2016-04-09T02:58:13.000Z | llvm-gcc-4.2-2.9/gcc/ada/s-gloloc-mingw.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | llvm-gcc-4.2-2.9/gcc/ada/s-gloloc-mingw.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . G L O B A L _ L O C K S --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-2006, AdaCore --
-- --
-- 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 2, 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 COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This implementation is specific to NT
with GNAT.Task_Lock;
with Interfaces.C.Strings;
with System.OS_Interface;
package body System.Global_Locks is
package TSL renames GNAT.Task_Lock;
package OSI renames System.OS_Interface;
package ICS renames Interfaces.C.Strings;
subtype Lock_File_Entry is OSI.HANDLE;
Last_Lock : Lock_Type := Null_Lock;
Lock_Table : array (Lock_Type range 1 .. 15) of Lock_File_Entry;
-----------------
-- Create_Lock --
-----------------
procedure Create_Lock
(Lock : out Lock_Type;
Name : String)
is
L : Lock_Type;
begin
TSL.Lock;
Last_Lock := Last_Lock + 1;
L := Last_Lock;
TSL.Unlock;
if L > Lock_Table'Last then
raise Lock_Error;
end if;
Lock_Table (L) :=
OSI.CreateMutex (null, OSI.BOOL (False), ICS.New_String (Name));
Lock := L;
end Create_Lock;
------------------
-- Acquire_Lock --
------------------
procedure Acquire_Lock
(Lock : in out Lock_Type)
is
use type OSI.DWORD;
Res : OSI.DWORD;
begin
Res := OSI.WaitForSingleObject (Lock_Table (Lock), OSI.Wait_Infinite);
if Res = OSI.WAIT_FAILED then
raise Lock_Error;
end if;
end Acquire_Lock;
------------------
-- Release_Lock --
------------------
procedure Release_Lock
(Lock : in out Lock_Type)
is
use type OSI.BOOL;
Res : OSI.BOOL;
begin
Res := OSI.ReleaseMutex (Lock_Table (Lock));
if Res = OSI.False then
raise Lock_Error;
end if;
end Release_Lock;
end System.Global_Locks;
| 36.54386 | 78 | 0.473596 |
cb50c3c42f782dace6a767c90330a14351551b00 | 18,650 | adb | Ada | awa/src/awa-modules.adb | fuzzysloth/ada-awa | f9b921eeea29841667a028f2fc4528e4385d247a | [
"Apache-2.0"
] | null | null | null | awa/src/awa-modules.adb | fuzzysloth/ada-awa | f9b921eeea29841667a028f2fc4528e4385d247a | [
"Apache-2.0"
] | null | null | null | awa/src/awa-modules.adb | fuzzysloth/ada-awa | f9b921eeea29841667a028f2fc4528e4385d247a | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- awa -- Ada Web Application
-- Copyright (C) 2009, 2010, 2011, 2012, 2015, 2016, 2017 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Requests;
with ASF.Responses;
with ASF.Server;
with Ada.IO_Exceptions;
with Util.Files;
with Util.Properties;
with EL.Contexts.Default;
with AWA.Modules.Reader;
with AWA.Applications;
package body AWA.Modules is
-- ------------------------------
-- Get the module configuration property identified by the name.
-- If the configuration property does not exist, returns the default value.
-- ------------------------------
function Get_Config (Plugin : Module_Manager;
Name : String;
Default : String := "") return String is
begin
return Plugin.Module.all.Get_Config (Name, Default);
end Get_Config;
-- ------------------------------
-- Get the module configuration property identified by the <tt>Config</tt> parameter.
-- If the property does not exist, the default configuration value is returned.
-- ------------------------------
function Get_Config (Plugin : in Module_Manager;
Config : in ASF.Applications.Config_Param) return String is
begin
return Plugin.Module.all.Get_Config (Config);
end Get_Config;
-- ------------------------------
-- Get the module name
-- ------------------------------
function Get_Name (Plugin : in Module) return String is
begin
return To_String (Plugin.Name);
end Get_Name;
-- ------------------------------
-- Get the base URI for this module
-- ------------------------------
function Get_URI (Plugin : in Module) return String is
begin
return To_String (Plugin.URI);
end Get_URI;
-- ------------------------------
-- Get the application in which this module is registered.
-- ------------------------------
function Get_Application (Plugin : in Module) return Application_Access is
begin
return Plugin.App;
end Get_Application;
-- ------------------------------
-- Get the module configuration property identified by the name.
-- If the configuration property does not exist, returns the default value.
-- ------------------------------
function Get_Config (Plugin : Module;
Name : String;
Default : String := "") return String is
begin
return Plugin.Config.Get (Name, Default);
end Get_Config;
-- ------------------------------
-- Get the module configuration property identified by the name.
-- If the configuration property does not exist, returns the default value.
-- ------------------------------
function Get_Config (Plugin : in Module;
Name : in String;
Default : in Integer := -1) return Integer is
Value : constant String := Plugin.Config.Get (Name, Integer'Image (Default));
begin
return Integer'Value (Value);
exception
when Constraint_Error =>
return Default;
end Get_Config;
-- ------------------------------
-- Get the module configuration property identified by the name.
-- If the configuration property does not exist, returns the default value.
-- ------------------------------
function Get_Config (Plugin : in Module;
Name : in String;
Default : in Boolean := False) return Boolean is
Value : constant String := Plugin.Config.Get (Name, Boolean'Image (Default));
begin
if Value in "yes" | "true" | "1" then
return True;
else
return False;
end if;
exception
when Constraint_Error =>
return Default;
end Get_Config;
-- ------------------------------
-- Get the module configuration property identified by the <tt>Config</tt> parameter.
-- If the property does not exist, the default configuration value is returned.
-- ------------------------------
function Get_Config (Plugin : in Module;
Config : in ASF.Applications.Config_Param) return String is
begin
return Plugin.Config.Get (Config);
end Get_Config;
-- ------------------------------
-- Get the module configuration property identified by the <tt>Config</tt> parameter.
-- If the property does not exist, the default configuration value is returned.
-- ------------------------------
function Get_Config (Plugin : in Module;
Name : in String;
Default : in String := "")
return EL.Expressions.Expression is
type Event_ELResolver is new EL.Contexts.Default.Default_ELResolver with null record;
overriding
function Get_Value (Resolver : Event_ELResolver;
Context : EL.Contexts.ELContext'Class;
Base : access Util.Beans.Basic.Readonly_Bean'Class;
Name : Unbounded_String) return Util.Beans.Objects.Object;
-- ------------------------------
-- Get the value associated with a base object and a given property.
-- ------------------------------
overriding
function Get_Value (Resolver : Event_ELResolver;
Context : EL.Contexts.ELContext'Class;
Base : access Util.Beans.Basic.Readonly_Bean'Class;
Name : Unbounded_String) return Util.Beans.Objects.Object is
begin
if Base /= null then
return EL.Contexts.Default.Default_ELResolver (Resolver).Get_Value (Context, Base,
Name);
else
return Util.Beans.Objects.To_Object (Plugin.Get_Config (To_String (Name), ""));
end if;
end Get_Value;
Resolver : aliased Event_ELResolver;
Context : EL.Contexts.Default.Default_Context;
Value : constant String := Plugin.Get_Config (Name, Default);
begin
Context.Set_Resolver (Resolver'Unchecked_Access);
return EL.Expressions.Reduce_Expression (EL.Expressions.Create_Expression (Value, Context),
Context);
exception
when E : others =>
Log.Error ("Invalid parameter ", E, True);
return EL.Expressions.Create_Expression ("", Context);
end Get_Config;
-- ------------------------------
-- Send the event to the module
-- ------------------------------
procedure Send_Event (Plugin : in Module;
Content : in AWA.Events.Module_Event'Class) is
begin
Plugin.App.Send_Event (Content);
end Send_Event;
-- ------------------------------
-- Find the module with the given name
-- ------------------------------
function Find_Module (Plugin : Module;
Name : String) return Module_Access is
begin
if Plugin.Registry = null then
return null;
end if;
return Find_By_Name (Plugin.Registry.all, Name);
end Find_Module;
-- ------------------------------
-- Register under the given name a function to create the bean instance when
-- it is accessed for a first time. The scope defines the scope of the bean.
-- bean
-- ------------------------------
procedure Register (Plugin : in out Module;
Name : in String;
Bind : in ASF.Beans.Class_Binding_Access) is
begin
Plugin.App.Register_Class (Name, Bind);
end Register;
-- ------------------------------
-- Finalize the module.
-- ------------------------------
overriding
procedure Finalize (Plugin : in out Module) is
begin
null;
end Finalize;
procedure Initialize (Manager : in out Module_Manager;
Module : in AWA.Modules.Module'Class) is
begin
Manager.Module := Module.Self;
end Initialize;
function Get_Value (Manager : in Module_Manager;
Name : in String) return Util.Beans.Objects.Object is
pragma Unreferenced (Manager, Name);
begin
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- Module manager
--
-- ------------------------------
-- Get the database connection for reading
-- ------------------------------
function Get_Session (Manager : Module_Manager)
return ADO.Sessions.Session is
begin
return Manager.Module.Get_Session;
end Get_Session;
-- ------------------------------
-- Get the database connection for writing
-- ------------------------------
function Get_Master_Session (Manager : Module_Manager)
return ADO.Sessions.Master_Session is
begin
return Manager.Module.Get_Master_Session;
end Get_Master_Session;
-- ------------------------------
-- Send the event to the module. The module identified by <b>To</b> is
-- found and the event is posted on its event channel.
-- ------------------------------
procedure Send_Event (Manager : in Module_Manager;
Content : in AWA.Events.Module_Event'Class) is
begin
Manager.Module.Send_Event (Content);
end Send_Event;
procedure Initialize (Plugin : in out Module;
App : in Application_Access;
Props : in ASF.Applications.Config) is
pragma Unreferenced (Props);
begin
Plugin.Self := Plugin'Unchecked_Access;
Plugin.App := App;
end Initialize;
-- ------------------------------
-- Initialize the registry
-- ------------------------------
procedure Initialize (Registry : in out Module_Registry;
Config : in ASF.Applications.Config) is
begin
Registry.Config := Config;
end Initialize;
-- ------------------------------
-- Register the module in the registry.
-- ------------------------------
procedure Register (Registry : in Module_Registry_Access;
App : in Application_Access;
Plugin : in Module_Access;
Name : in String;
URI : in String) is
procedure Copy (Params : in Util.Properties.Manager'Class);
procedure Copy (Params : in Util.Properties.Manager'Class) is
begin
Plugin.Config.Copy (From => Params, Prefix => Name & ".", Strip => True);
end Copy;
Paths : constant String := Registry.Config.Get (Applications.P_Module_Dir.P);
begin
Log.Info ("Register module '{0}' under URI '{1}'", Name, URI);
if Plugin.Registry /= null then
Log.Error ("Module '{0}' is already attached to a registry", Name);
raise Program_Error with "Module '" & Name & "' already registered";
end if;
Plugin.App := App;
Plugin.Registry := Registry;
Plugin.Name := To_Unbounded_String (Name);
Plugin.URI := To_Unbounded_String (URI);
Plugin.Registry.Name_Map.Insert (Name, Plugin);
if URI /= "" then
Plugin.Registry.URI_Map.Insert (URI, Plugin);
end if;
-- Load the module configuration file
Log.Debug ("Module search path: {0}", Paths);
declare
Base : constant String := Name & ".properties";
Path : constant String := Util.Files.Find_File_Path (Base, Paths);
begin
Plugin.Config.Load_Properties (Path => Path, Prefix => Name & ".", Strip => True);
exception
when Ada.IO_Exceptions.Name_Error =>
Log.Info ("Module configuration file '{0}' does not exist", Path);
end;
Plugin.Initialize (App, Plugin.Config);
-- Read the module XML configuration file if there is one.
declare
Base : constant String := Plugin.Config.Get ("config", Name & ".xml");
Path : constant String := Util.Files.Find_File_Path (Base, Paths);
Ctx : aliased EL.Contexts.Default.Default_Context;
begin
AWA.Modules.Reader.Read_Configuration (Plugin.all, Path, Ctx'Unchecked_Access);
exception
when Ada.IO_Exceptions.Name_Error =>
Log.Warn ("Module configuration file '{0}' does not exist", Path);
end;
-- Override the module configuration with the application configuration
App.Get_Init_Parameters (Copy'Access);
Plugin.Configure (Plugin.Config);
exception
when Constraint_Error =>
Log.Error ("Another module is already registered "
& "under name '{0}' or URI '{1}'", Name, URI);
raise;
end Register;
-- ------------------------------
-- Find the module with the given name
-- ------------------------------
function Find_By_Name (Registry : Module_Registry;
Name : String) return Module_Access is
Pos : constant Module_Maps.Cursor := Module_Maps.Find (Registry.Name_Map, Name);
begin
if Module_Maps.Has_Element (Pos) then
return Module_Maps.Element (Pos);
end if;
return null;
end Find_By_Name;
-- ------------------------------
-- Find the module mapped to a given URI
-- ------------------------------
function Find_By_URI (Registry : Module_Registry;
URI : String) return Module_Access is
Pos : constant Module_Maps.Cursor := Module_Maps.Find (Registry.URI_Map, URI);
begin
if Module_Maps.Has_Element (Pos) then
return Module_Maps.Element (Pos);
end if;
return null;
end Find_By_URI;
-- ------------------------------
-- Iterate over the modules that have been registered and execute the <b>Process</b>
-- procedure on each of the module instance.
-- ------------------------------
procedure Iterate (Registry : in Module_Registry;
Process : access procedure (Plugin : in out Module'Class)) is
Iter : Module_Maps.Cursor := Registry.Name_Map.First;
begin
while Module_Maps.Has_Element (Iter) loop
Process (Module_Maps.Element (Iter).all);
Module_Maps.Next (Iter);
end loop;
end Iterate;
-- ------------------------------
-- Get the database connection for reading
-- ------------------------------
function Get_Session (Manager : Module)
return ADO.Sessions.Session is
begin
return Manager.App.Get_Session;
end Get_Session;
-- ------------------------------
-- Get the database connection for writing
-- ------------------------------
function Get_Master_Session (Manager : Module)
return ADO.Sessions.Master_Session is
begin
return Manager.App.Get_Master_Session;
end Get_Master_Session;
-- ------------------------------
-- Add a listener to the module listner list. The module will invoke the listner
-- depending on events or actions that occur in the module.
-- ------------------------------
procedure Add_Listener (Into : in out Module;
Item : in Util.Listeners.Listener_Access) is
begin
Util.Listeners.Add_Listener (Into.Listeners, Item);
end Add_Listener;
-- ------------------------------
-- Find the module with the given name in the application and add the listener to the
-- module listener list.
-- ------------------------------
procedure Add_Listener (Plugin : in Module;
Name : in String;
Item : in Util.Listeners.Listener_Access) is
M : constant Module_Access := Plugin.App.Find_Module (Name);
begin
if M = null then
Log.Error ("Cannot find module {0} to add a lifecycle listener", Name);
else
M.Add_Listener (Item);
end if;
end Add_Listener;
-- ------------------------------
-- Remove a listener from the module listener list.
-- ------------------------------
procedure Remove_Listener (Into : in out Module;
Item : in Util.Listeners.Listener_Access) is
begin
Util.Listeners.Remove_Listener (Into.Listeners, Item);
end Remove_Listener;
-- Get per request manager => look in Request
-- Get per session manager => look in Request.Get_Session
-- Get per application manager => look in Application
-- Get per pool manager => look in pool attached to Application
function Get_Manager return Manager_Type_Access is
procedure Process (Request : in out ASF.Requests.Request'Class;
Response : in out ASF.Responses.Response'Class);
Value : Util.Beans.Objects.Object;
procedure Process (Request : in out ASF.Requests.Request'Class;
Response : in out ASF.Responses.Response'Class) is
pragma Unreferenced (Response);
begin
Value := Request.Get_Attribute (Name);
if Util.Beans.Objects.Is_Null (Value) then
declare
M : constant Manager_Type_Access := new Manager_Type;
begin
Value := Util.Beans.Objects.To_Object (M.all'Unchecked_Access);
Request.Set_Attribute (Name, Value);
end;
end if;
end Process;
begin
ASF.Server.Update_Context (Process'Access);
if Util.Beans.Objects.Is_Null (Value) then
return null;
end if;
declare
B : constant access Util.Beans.Basic.Readonly_Bean'Class
:= Util.Beans.Objects.To_Bean (Value);
begin
if not (B.all in Manager_Type'Class) then
return null;
end if;
return Manager_Type'Class (B.all)'Unchecked_Access;
end;
end Get_Manager;
end AWA.Modules;
| 37.600806 | 97 | 0.550831 |
239dafd8fac347db71e553d7774a397d3fc8bb0b | 45,311 | ads | Ada | src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_gsttaglist_h.ads | persan/A-gst | 7a39693d105617adea52680424c862a1a08f7368 | [
"Apache-2.0"
] | 1 | 2018-01-18T00:51:00.000Z | 2018-01-18T00:51:00.000Z | src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_gsttaglist_h.ads | persan/A-gst | 7a39693d105617adea52680424c862a1a08f7368 | [
"Apache-2.0"
] | null | null | null | src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_gsttaglist_h.ads | persan/A-gst | 7a39693d105617adea52680424c862a1a08f7368 | [
"Apache-2.0"
] | null | null | null | pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h;
with glib;
with glib.Values;
with System;
with glib;
with System;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h is
-- arg-macro: function GST_TAG_MODE_IS_VALID (mode)
-- return ((mode) > GST_TAG_MERGE_UNDEFINED) and then ((mode) < GST_TAG_MERGE_COUNT);
-- arg-macro: function GST_TAG_FLAG_IS_VALID (flag)
-- return ((flag) > GST_TAG_FLAG_UNDEFINED) and then ((flag) < GST_TAG_FLAG_COUNT);
-- arg-macro: function GST_TAG_LIST (x)
-- return (GstTagList *) (x);
-- arg-macro: function GST_IS_TAG_LIST (x)
-- return (x) /= NULL and then gst_is_tag_list (GST_TAG_LIST (x));
-- unsupported macro: GST_TYPE_TAG_LIST (gst_tag_list_get_type ())
GST_TAG_TITLE : aliased constant String := "title" & ASCII.NUL; -- gst/gsttaglist.h:395
GST_TAG_TITLE_SORTNAME : aliased constant String := "title-sortname" & ASCII.NUL; -- gst/gsttaglist.h:405
GST_TAG_ARTIST : aliased constant String := "artist" & ASCII.NUL; -- gst/gsttaglist.h:414
GST_TAG_ARTIST_SORTNAME : aliased constant String := "musicbrainz-sortname" & ASCII.NUL; -- gst/gsttaglist.h:426
GST_TAG_ALBUM : aliased constant String := "album" & ASCII.NUL; -- gst/gsttaglist.h:434
GST_TAG_ALBUM_SORTNAME : aliased constant String := "album-sortname" & ASCII.NUL; -- gst/gsttaglist.h:444
GST_TAG_ALBUM_ARTIST : aliased constant String := "album-artist" & ASCII.NUL; -- gst/gsttaglist.h:452
GST_TAG_ALBUM_ARTIST_SORTNAME : aliased constant String := "album-artist-sortname" & ASCII.NUL; -- gst/gsttaglist.h:460
GST_TAG_COMPOSER : aliased constant String := "composer" & ASCII.NUL; -- gst/gsttaglist.h:468
GST_TAG_DATE : aliased constant String := "date" & ASCII.NUL; -- gst/gsttaglist.h:474
GST_TAG_DATE_TIME : aliased constant String := "datetime" & ASCII.NUL; -- gst/gsttaglist.h:482
GST_TAG_GENRE : aliased constant String := "genre" & ASCII.NUL; -- gst/gsttaglist.h:488
GST_TAG_COMMENT : aliased constant String := "comment" & ASCII.NUL; -- gst/gsttaglist.h:494
GST_TAG_EXTENDED_COMMENT : aliased constant String := "extended-comment" & ASCII.NUL; -- gst/gsttaglist.h:509
GST_TAG_TRACK_NUMBER : aliased constant String := "track-number" & ASCII.NUL; -- gst/gsttaglist.h:515
GST_TAG_TRACK_COUNT : aliased constant String := "track-count" & ASCII.NUL; -- gst/gsttaglist.h:521
GST_TAG_ALBUM_VOLUME_NUMBER : aliased constant String := "album-disc-number" & ASCII.NUL; -- gst/gsttaglist.h:527
GST_TAG_ALBUM_VOLUME_COUNT : aliased constant String := "album-disc-count" & ASCII.NUL; -- gst/gsttaglist.h:533
GST_TAG_LOCATION : aliased constant String := "location" & ASCII.NUL; -- gst/gsttaglist.h:540
GST_TAG_HOMEPAGE : aliased constant String := "homepage" & ASCII.NUL; -- gst/gsttaglist.h:548
GST_TAG_DESCRIPTION : aliased constant String := "description" & ASCII.NUL; -- gst/gsttaglist.h:554
GST_TAG_VERSION : aliased constant String := "version" & ASCII.NUL; -- gst/gsttaglist.h:560
GST_TAG_ISRC : aliased constant String := "isrc" & ASCII.NUL; -- gst/gsttaglist.h:566
GST_TAG_ORGANIZATION : aliased constant String := "organization" & ASCII.NUL; -- gst/gsttaglist.h:572
GST_TAG_COPYRIGHT : aliased constant String := "copyright" & ASCII.NUL; -- gst/gsttaglist.h:578
GST_TAG_COPYRIGHT_URI : aliased constant String := "copyright-uri" & ASCII.NUL; -- gst/gsttaglist.h:586
GST_TAG_ENCODED_BY : aliased constant String := "encoded-by" & ASCII.NUL; -- gst/gsttaglist.h:599
GST_TAG_CONTACT : aliased constant String := "contact" & ASCII.NUL; -- gst/gsttaglist.h:605
GST_TAG_LICENSE : aliased constant String := "license" & ASCII.NUL; -- gst/gsttaglist.h:611
GST_TAG_LICENSE_URI : aliased constant String := "license-uri" & ASCII.NUL; -- gst/gsttaglist.h:619
GST_TAG_PERFORMER : aliased constant String := "performer" & ASCII.NUL; -- gst/gsttaglist.h:625
GST_TAG_DURATION : aliased constant String := "duration" & ASCII.NUL; -- gst/gsttaglist.h:631
GST_TAG_CODEC : aliased constant String := "codec" & ASCII.NUL; -- gst/gsttaglist.h:637
GST_TAG_VIDEO_CODEC : aliased constant String := "video-codec" & ASCII.NUL; -- gst/gsttaglist.h:643
GST_TAG_AUDIO_CODEC : aliased constant String := "audio-codec" & ASCII.NUL; -- gst/gsttaglist.h:649
GST_TAG_SUBTITLE_CODEC : aliased constant String := "subtitle-codec" & ASCII.NUL; -- gst/gsttaglist.h:657
GST_TAG_CONTAINER_FORMAT : aliased constant String := "container-format" & ASCII.NUL; -- gst/gsttaglist.h:665
GST_TAG_BITRATE : aliased constant String := "bitrate" & ASCII.NUL; -- gst/gsttaglist.h:671
GST_TAG_NOMINAL_BITRATE : aliased constant String := "nominal-bitrate" & ASCII.NUL; -- gst/gsttaglist.h:678
GST_TAG_MINIMUM_BITRATE : aliased constant String := "minimum-bitrate" & ASCII.NUL; -- gst/gsttaglist.h:684
GST_TAG_MAXIMUM_BITRATE : aliased constant String := "maximum-bitrate" & ASCII.NUL; -- gst/gsttaglist.h:690
GST_TAG_SERIAL : aliased constant String := "serial" & ASCII.NUL; -- gst/gsttaglist.h:696
GST_TAG_ENCODER : aliased constant String := "encoder" & ASCII.NUL; -- gst/gsttaglist.h:702
GST_TAG_ENCODER_VERSION : aliased constant String := "encoder-version" & ASCII.NUL; -- gst/gsttaglist.h:708
GST_TAG_TRACK_GAIN : aliased constant String := "replaygain-track-gain" & ASCII.NUL; -- gst/gsttaglist.h:714
GST_TAG_TRACK_PEAK : aliased constant String := "replaygain-track-peak" & ASCII.NUL; -- gst/gsttaglist.h:720
GST_TAG_ALBUM_GAIN : aliased constant String := "replaygain-album-gain" & ASCII.NUL; -- gst/gsttaglist.h:726
GST_TAG_ALBUM_PEAK : aliased constant String := "replaygain-album-peak" & ASCII.NUL; -- gst/gsttaglist.h:732
GST_TAG_REFERENCE_LEVEL : aliased constant String := "replaygain-reference-level" & ASCII.NUL; -- gst/gsttaglist.h:740
GST_TAG_LANGUAGE_CODE : aliased constant String := "language-code" & ASCII.NUL; -- gst/gsttaglist.h:746
GST_TAG_IMAGE : aliased constant String := "image" & ASCII.NUL; -- gst/gsttaglist.h:755
GST_TAG_PREVIEW_IMAGE : aliased constant String := "preview-image" & ASCII.NUL; -- gst/gsttaglist.h:764
GST_TAG_ATTACHMENT : aliased constant String := "attachment" & ASCII.NUL; -- gst/gsttaglist.h:775
GST_TAG_BEATS_PER_MINUTE : aliased constant String := "beats-per-minute" & ASCII.NUL; -- gst/gsttaglist.h:784
GST_TAG_KEYWORDS : aliased constant String := "keywords" & ASCII.NUL; -- gst/gsttaglist.h:793
GST_TAG_GEO_LOCATION_NAME : aliased constant String := "geo-location-name" & ASCII.NUL; -- gst/gsttaglist.h:803
GST_TAG_GEO_LOCATION_LATITUDE : aliased constant String := "geo-location-latitude" & ASCII.NUL; -- gst/gsttaglist.h:814
GST_TAG_GEO_LOCATION_LONGITUDE : aliased constant String := "geo-location-longitude" & ASCII.NUL; -- gst/gsttaglist.h:825
GST_TAG_GEO_LOCATION_ELEVATION : aliased constant String := "geo-location-elevation" & ASCII.NUL; -- gst/gsttaglist.h:835
GST_TAG_GEO_LOCATION_COUNTRY : aliased constant String := "geo-location-country" & ASCII.NUL; -- gst/gsttaglist.h:843
GST_TAG_GEO_LOCATION_CITY : aliased constant String := "geo-location-city" & ASCII.NUL; -- gst/gsttaglist.h:851
GST_TAG_GEO_LOCATION_SUBLOCATION : aliased constant String := "geo-location-sublocation" & ASCII.NUL; -- gst/gsttaglist.h:863
GST_TAG_GEO_LOCATION_HORIZONTAL_ERROR : aliased constant String := "geo-location-horizontal-error" & ASCII.NUL; -- gst/gsttaglist.h:872
GST_TAG_GEO_LOCATION_MOVEMENT_SPEED : aliased constant String := "geo-location-movement-speed" & ASCII.NUL; -- gst/gsttaglist.h:883
GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION : aliased constant String := "geo-location-movement-direction" & ASCII.NUL; -- gst/gsttaglist.h:895
GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION : aliased constant String := "geo-location-capture-direction" & ASCII.NUL; -- gst/gsttaglist.h:907
GST_TAG_SHOW_NAME : aliased constant String := "show-name" & ASCII.NUL; -- gst/gsttaglist.h:915
GST_TAG_SHOW_SORTNAME : aliased constant String := "show-sortname" & ASCII.NUL; -- gst/gsttaglist.h:923
GST_TAG_SHOW_EPISODE_NUMBER : aliased constant String := "show-episode-number" & ASCII.NUL; -- gst/gsttaglist.h:931
GST_TAG_SHOW_SEASON_NUMBER : aliased constant String := "show-season-number" & ASCII.NUL; -- gst/gsttaglist.h:939
GST_TAG_LYRICS : aliased constant String := "lyrics" & ASCII.NUL; -- gst/gsttaglist.h:947
GST_TAG_COMPOSER_SORTNAME : aliased constant String := "composer-sortname" & ASCII.NUL; -- gst/gsttaglist.h:955
GST_TAG_GROUPING : aliased constant String := "grouping" & ASCII.NUL; -- gst/gsttaglist.h:964
GST_TAG_USER_RATING : aliased constant String := "user-rating" & ASCII.NUL; -- gst/gsttaglist.h:974
GST_TAG_DEVICE_MANUFACTURER : aliased constant String := "device-manufacturer" & ASCII.NUL; -- gst/gsttaglist.h:982
GST_TAG_DEVICE_MODEL : aliased constant String := "device-model" & ASCII.NUL; -- gst/gsttaglist.h:990
GST_TAG_APPLICATION_NAME : aliased constant String := "application-name" & ASCII.NUL; -- gst/gsttaglist.h:998
GST_TAG_APPLICATION_DATA : aliased constant String := "application-data" & ASCII.NUL; -- gst/gsttaglist.h:1009
GST_TAG_IMAGE_ORIENTATION : aliased constant String := "image-orientation" & ASCII.NUL; -- gst/gsttaglist.h:1035
-- GStreamer
-- * Copyright (C) 2003 Benjamin Otte <[email protected]>
-- *
-- * gsttaglist.h: Header for tag support
-- *
-- * 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 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library 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.
--
--*
-- * GstTagMergeMode:
-- * @GST_TAG_MERGE_UNDEFINED: undefined merge mode
-- * @GST_TAG_MERGE_REPLACE_ALL: replace all tags (clear list and append)
-- * @GST_TAG_MERGE_REPLACE: replace tags
-- * @GST_TAG_MERGE_APPEND: append tags
-- * @GST_TAG_MERGE_PREPEND: prepend tags
-- * @GST_TAG_MERGE_KEEP: keep existing tags
-- * @GST_TAG_MERGE_KEEP_ALL: keep all existing tags
-- * @GST_TAG_MERGE_COUNT: the number of merge modes
-- *
-- * The different tag merging modes are basically replace, overwrite and append,
-- * but they can be seen from two directions. Given two taglists: (A) the tags
-- * already in the element and (B) the ones that are supplied to the element (
-- * e.g. via gst_tag_setter_merge_tags() / gst_tag_setter_add_tags() or a
-- * %GST_EVENT_TAG), how are these tags merged?
-- * In the table below this is shown for the cases that a tag exists in the list
-- * (A) or does not exists (!A) and combinations thereof.
-- *
-- * <table frame="all" colsep="1" rowsep="1">
-- * <title>merge mode</title>
-- * <tgroup cols='5' align='left'>
-- * <thead>
-- * <row>
-- * <entry>merge mode</entry>
-- * <entry>A + B</entry>
-- * <entry>A + !B</entry>
-- * <entry>!A + B</entry>
-- * <entry>!A + !B</entry>
-- * </row>
-- * </thead>
-- * <tbody>
-- * <row>
-- * <entry>REPLACE_ALL</entry>
-- * <entry>B</entry>
-- * <entry>-</entry>
-- * <entry>B</entry>
-- * <entry>-</entry>
-- * </row>
-- * <row>
-- * <entry>REPLACE</entry>
-- * <entry>B</entry>
-- * <entry>A</entry>
-- * <entry>B</entry>
-- * <entry>-</entry>
-- * </row>
-- * <row>
-- * <entry>APPEND</entry>
-- * <entry>A, B</entry>
-- * <entry>A</entry>
-- * <entry>B</entry>
-- * <entry>-</entry>
-- * </row>
-- * <row>
-- * <entry>PREPEND</entry>
-- * <entry>B, A</entry>
-- * <entry>A</entry>
-- * <entry>B</entry>
-- * <entry>-</entry>
-- * </row>
-- * <row>
-- * <entry>KEEP</entry>
-- * <entry>A</entry>
-- * <entry>A</entry>
-- * <entry>B</entry>
-- * <entry>-</entry>
-- * </row>
-- * <row>
-- * <entry>KEEP_ALL</entry>
-- * <entry>A</entry>
-- * <entry>A</entry>
-- * <entry>-</entry>
-- * <entry>-</entry>
-- * </row>
-- * </tbody>
-- * </tgroup>
-- * </table>
--
-- add more
type GstTagMergeMode is
(GST_TAG_MERGE_UNDEFINED,
GST_TAG_MERGE_REPLACE_ALL,
GST_TAG_MERGE_REPLACE,
GST_TAG_MERGE_APPEND,
GST_TAG_MERGE_PREPEND,
GST_TAG_MERGE_KEEP,
GST_TAG_MERGE_KEEP_ALL,
GST_TAG_MERGE_COUNT);
pragma Convention (C, GstTagMergeMode); -- gst/gsttaglist.h:121
--*
-- * GstTagFlag:
-- * @GST_TAG_FLAG_UNDEFINED: undefined flag
-- * @GST_TAG_FLAG_META: tag is meta data
-- * @GST_TAG_FLAG_ENCODED: tag is encoded
-- * @GST_TAG_FLAG_DECODED: tag is decoded
-- * @GST_TAG_FLAG_COUNT: number of tag flags
-- *
-- * Extra tag flags used when registering tags.
--
type GstTagFlag is
(GST_TAG_FLAG_UNDEFINED,
GST_TAG_FLAG_META,
GST_TAG_FLAG_ENCODED,
GST_TAG_FLAG_DECODED,
GST_TAG_FLAG_COUNT);
pragma Convention (C, GstTagFlag); -- gst/gsttaglist.h:141
-- FIXME 0.11: Don't typedef GstTagList to be a GstStructure, they're
-- * internally the same but not from an API point of view.
-- * See bug #518934.
--
--*
-- * GstTagList:
-- *
-- * Opaque #GstTagList data structure.
--
type GstTagList is new GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure; -- gst/gsttaglist.h:160
--*
-- * GstTagForeachFunc:
-- * @list: the #GstTagList
-- * @tag: a name of a tag in @list
-- * @user_data: user data
-- *
-- * A function that will be called in gst_tag_list_foreach(). The function may
-- * not modify the tag list.
--
type GstTagForeachFunc is access procedure
(arg1 : access constant GstTagList;
arg2 : access GLIB.gchar;
arg3 : System.Address);
pragma Convention (C, GstTagForeachFunc); -- gst/gsttaglist.h:177
--*
-- * GstTagMergeFunc:
-- * @dest: the destination #GValue
-- * @src: the source #GValue
-- *
-- * A function for merging multiple values of a tag used when registering
-- * tags.
--
type GstTagMergeFunc is access procedure (arg1 : access Glib.Values.GValue; arg2 : access constant Glib.Values.GValue);
pragma Convention (C, GstTagMergeFunc); -- gst/gsttaglist.h:189
function gst_tag_list_get_type return GLIB.GType; -- gst/gsttaglist.h:191
pragma Import (C, gst_tag_list_get_type, "gst_tag_list_get_type");
-- tag registration
procedure gst_tag_register
(name : access GLIB.gchar;
flag : GstTagFlag;
c_type : GLIB.GType;
nick : access GLIB.gchar;
blurb : access GLIB.gchar;
func : GstTagMergeFunc); -- gst/gsttaglist.h:194
pragma Import (C, gst_tag_register, "gst_tag_register");
-- some default merging functions
procedure gst_tag_merge_use_first (dest : access Glib.Values.GValue; src : access constant Glib.Values.GValue); -- gst/gsttaglist.h:202
pragma Import (C, gst_tag_merge_use_first, "gst_tag_merge_use_first");
procedure gst_tag_merge_strings_with_comma (dest : access Glib.Values.GValue; src : access constant Glib.Values.GValue); -- gst/gsttaglist.h:203
pragma Import (C, gst_tag_merge_strings_with_comma, "gst_tag_merge_strings_with_comma");
-- basic tag support
function gst_tag_exists (tag : access GLIB.gchar) return GLIB.gboolean; -- gst/gsttaglist.h:206
pragma Import (C, gst_tag_exists, "gst_tag_exists");
function gst_tag_get_type (tag : access GLIB.gchar) return GLIB.GType; -- gst/gsttaglist.h:207
pragma Import (C, gst_tag_get_type, "gst_tag_get_type");
function gst_tag_get_nick (tag : access GLIB.gchar) return access GLIB.gchar; -- gst/gsttaglist.h:208
pragma Import (C, gst_tag_get_nick, "gst_tag_get_nick");
function gst_tag_get_description (tag : access GLIB.gchar) return access GLIB.gchar; -- gst/gsttaglist.h:209
pragma Import (C, gst_tag_get_description, "gst_tag_get_description");
function gst_tag_get_flag (tag : access GLIB.gchar) return GstTagFlag; -- gst/gsttaglist.h:210
pragma Import (C, gst_tag_get_flag, "gst_tag_get_flag");
function gst_tag_is_fixed (tag : access GLIB.gchar) return GLIB.gboolean; -- gst/gsttaglist.h:211
pragma Import (C, gst_tag_is_fixed, "gst_tag_is_fixed");
-- tag lists
function gst_tag_list_new return access GstTagList; -- gst/gsttaglist.h:214
pragma Import (C, gst_tag_list_new, "gst_tag_list_new");
function gst_tag_list_new_full (tag : access GLIB.gchar -- , ...
) return access GstTagList; -- gst/gsttaglist.h:215
pragma Import (C, gst_tag_list_new_full, "gst_tag_list_new_full");
function gst_tag_list_new_full_valist (var_args : access System.Address) return access GstTagList; -- gst/gsttaglist.h:216
pragma Import (C, gst_tag_list_new_full_valist, "gst_tag_list_new_full_valist");
function gst_tag_list_to_string (list : access constant GstTagList) return access GLIB.gchar; -- gst/gsttaglist.h:218
pragma Import (C, gst_tag_list_to_string, "gst_tag_list_to_string");
function gst_tag_list_new_from_string (str : access GLIB.gchar) return access GstTagList; -- gst/gsttaglist.h:219
pragma Import (C, gst_tag_list_new_from_string, "gst_tag_list_new_from_string");
function gst_is_tag_list (p : Interfaces.C.Extensions.void_ptr) return GLIB.gboolean; -- gst/gsttaglist.h:221
pragma Import (C, gst_is_tag_list, "gst_is_tag_list");
function gst_tag_list_copy (list : access constant GstTagList) return access GstTagList; -- gst/gsttaglist.h:222
pragma Import (C, gst_tag_list_copy, "gst_tag_list_copy");
function gst_tag_list_is_empty (list : access constant GstTagList) return GLIB.gboolean; -- gst/gsttaglist.h:223
pragma Import (C, gst_tag_list_is_empty, "gst_tag_list_is_empty");
function gst_tag_list_is_equal (list1 : access constant GstTagList; list2 : access constant GstTagList) return GLIB.gboolean; -- gst/gsttaglist.h:224
pragma Import (C, gst_tag_list_is_equal, "gst_tag_list_is_equal");
procedure gst_tag_list_insert
(into : access GstTagList;
from : access constant GstTagList;
mode : GstTagMergeMode); -- gst/gsttaglist.h:226
pragma Import (C, gst_tag_list_insert, "gst_tag_list_insert");
function gst_tag_list_merge
(list1 : access constant GstTagList;
list2 : access constant GstTagList;
mode : GstTagMergeMode) return access GstTagList; -- gst/gsttaglist.h:229
pragma Import (C, gst_tag_list_merge, "gst_tag_list_merge");
procedure gst_tag_list_free (list : access GstTagList); -- gst/gsttaglist.h:232
pragma Import (C, gst_tag_list_free, "gst_tag_list_free");
function gst_tag_list_get_tag_size (list : access constant GstTagList; tag : access GLIB.gchar) return GLIB.guint; -- gst/gsttaglist.h:233
pragma Import (C, gst_tag_list_get_tag_size, "gst_tag_list_get_tag_size");
procedure gst_tag_list_add
(list : access GstTagList;
mode : GstTagMergeMode;
tag : access GLIB.gchar -- , ...
); -- gst/gsttaglist.h:235
pragma Import (C, gst_tag_list_add, "gst_tag_list_add");
procedure gst_tag_list_add_values
(list : access GstTagList;
mode : GstTagMergeMode;
tag : access GLIB.gchar -- , ...
); -- gst/gsttaglist.h:239
pragma Import (C, gst_tag_list_add_values, "gst_tag_list_add_values");
procedure gst_tag_list_add_valist
(list : access GstTagList;
mode : GstTagMergeMode;
tag : access GLIB.gchar;
var_args : access System.Address); -- gst/gsttaglist.h:243
pragma Import (C, gst_tag_list_add_valist, "gst_tag_list_add_valist");
procedure gst_tag_list_add_valist_values
(list : access GstTagList;
mode : GstTagMergeMode;
tag : access GLIB.gchar;
var_args : access System.Address); -- gst/gsttaglist.h:247
pragma Import (C, gst_tag_list_add_valist_values, "gst_tag_list_add_valist_values");
procedure gst_tag_list_add_value
(list : access GstTagList;
mode : GstTagMergeMode;
tag : access GLIB.gchar;
value : access constant Glib.Values.GValue); -- gst/gsttaglist.h:251
pragma Import (C, gst_tag_list_add_value, "gst_tag_list_add_value");
procedure gst_tag_list_remove_tag (list : access GstTagList; tag : access GLIB.gchar); -- gst/gsttaglist.h:255
pragma Import (C, gst_tag_list_remove_tag, "gst_tag_list_remove_tag");
procedure gst_tag_list_foreach
(list : access constant GstTagList;
func : GstTagForeachFunc;
user_data : System.Address); -- gst/gsttaglist.h:257
pragma Import (C, gst_tag_list_foreach, "gst_tag_list_foreach");
function gst_tag_list_get_value_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint) return access constant Glib.Values.GValue; -- gst/gsttaglist.h:262
pragma Import (C, gst_tag_list_get_value_index, "gst_tag_list_get_value_index");
function gst_tag_list_copy_value
(dest : access Glib.Values.GValue;
list : access constant GstTagList;
tag : access GLIB.gchar) return GLIB.gboolean; -- gst/gsttaglist.h:265
pragma Import (C, gst_tag_list_copy_value, "gst_tag_list_copy_value");
-- simplifications (FIXME: do we want them?)
function gst_tag_list_get_char
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : access GLIB.gchar) return GLIB.gboolean; -- gst/gsttaglist.h:270
pragma Import (C, gst_tag_list_get_char, "gst_tag_list_get_char");
function gst_tag_list_get_char_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : access GLIB.gchar) return GLIB.gboolean; -- gst/gsttaglist.h:273
pragma Import (C, gst_tag_list_get_char_index, "gst_tag_list_get_char_index");
function gst_tag_list_get_uchar
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : access GLIB.guchar) return GLIB.gboolean; -- gst/gsttaglist.h:277
pragma Import (C, gst_tag_list_get_uchar, "gst_tag_list_get_uchar");
function gst_tag_list_get_uchar_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : access GLIB.guchar) return GLIB.gboolean; -- gst/gsttaglist.h:280
pragma Import (C, gst_tag_list_get_uchar_index, "gst_tag_list_get_uchar_index");
function gst_tag_list_get_boolean
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : access GLIB.gboolean) return GLIB.gboolean; -- gst/gsttaglist.h:284
pragma Import (C, gst_tag_list_get_boolean, "gst_tag_list_get_boolean");
function gst_tag_list_get_boolean_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : access GLIB.gboolean) return GLIB.gboolean; -- gst/gsttaglist.h:287
pragma Import (C, gst_tag_list_get_boolean_index, "gst_tag_list_get_boolean_index");
function gst_tag_list_get_int
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : access GLIB.gint) return GLIB.gboolean; -- gst/gsttaglist.h:291
pragma Import (C, gst_tag_list_get_int, "gst_tag_list_get_int");
function gst_tag_list_get_int_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : access GLIB.gint) return GLIB.gboolean; -- gst/gsttaglist.h:294
pragma Import (C, gst_tag_list_get_int_index, "gst_tag_list_get_int_index");
function gst_tag_list_get_uint
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : access GLIB.guint) return GLIB.gboolean; -- gst/gsttaglist.h:298
pragma Import (C, gst_tag_list_get_uint, "gst_tag_list_get_uint");
function gst_tag_list_get_uint_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : access GLIB.guint) return GLIB.gboolean; -- gst/gsttaglist.h:301
pragma Import (C, gst_tag_list_get_uint_index, "gst_tag_list_get_uint_index");
function gst_tag_list_get_long
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : access GLIB.glong) return GLIB.gboolean; -- gst/gsttaglist.h:305
pragma Import (C, gst_tag_list_get_long, "gst_tag_list_get_long");
function gst_tag_list_get_long_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : access GLIB.glong) return GLIB.gboolean; -- gst/gsttaglist.h:308
pragma Import (C, gst_tag_list_get_long_index, "gst_tag_list_get_long_index");
function gst_tag_list_get_ulong
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : access GLIB.gulong) return GLIB.gboolean; -- gst/gsttaglist.h:312
pragma Import (C, gst_tag_list_get_ulong, "gst_tag_list_get_ulong");
function gst_tag_list_get_ulong_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : access GLIB.gulong) return GLIB.gboolean; -- gst/gsttaglist.h:315
pragma Import (C, gst_tag_list_get_ulong_index, "gst_tag_list_get_ulong_index");
function gst_tag_list_get_int64
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : access GLIB.gint64) return GLIB.gboolean; -- gst/gsttaglist.h:319
pragma Import (C, gst_tag_list_get_int64, "gst_tag_list_get_int64");
function gst_tag_list_get_int64_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : access GLIB.gint64) return GLIB.gboolean; -- gst/gsttaglist.h:322
pragma Import (C, gst_tag_list_get_int64_index, "gst_tag_list_get_int64_index");
function gst_tag_list_get_uint64
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : access GLIB.guint64) return GLIB.gboolean; -- gst/gsttaglist.h:326
pragma Import (C, gst_tag_list_get_uint64, "gst_tag_list_get_uint64");
function gst_tag_list_get_uint64_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : access GLIB.guint64) return GLIB.gboolean; -- gst/gsttaglist.h:329
pragma Import (C, gst_tag_list_get_uint64_index, "gst_tag_list_get_uint64_index");
function gst_tag_list_get_float
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : access GLIB.gfloat) return GLIB.gboolean; -- gst/gsttaglist.h:333
pragma Import (C, gst_tag_list_get_float, "gst_tag_list_get_float");
function gst_tag_list_get_float_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : access GLIB.gfloat) return GLIB.gboolean; -- gst/gsttaglist.h:336
pragma Import (C, gst_tag_list_get_float_index, "gst_tag_list_get_float_index");
function gst_tag_list_get_double
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : access GLIB.gdouble) return GLIB.gboolean; -- gst/gsttaglist.h:340
pragma Import (C, gst_tag_list_get_double, "gst_tag_list_get_double");
function gst_tag_list_get_double_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : access GLIB.gdouble) return GLIB.gboolean; -- gst/gsttaglist.h:343
pragma Import (C, gst_tag_list_get_double_index, "gst_tag_list_get_double_index");
function gst_tag_list_get_string
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : System.Address) return GLIB.gboolean; -- gst/gsttaglist.h:347
pragma Import (C, gst_tag_list_get_string, "gst_tag_list_get_string");
function gst_tag_list_get_string_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : System.Address) return GLIB.gboolean; -- gst/gsttaglist.h:350
pragma Import (C, gst_tag_list_get_string_index, "gst_tag_list_get_string_index");
function gst_tag_list_peek_string_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : System.Address) return GLIB.gboolean; -- gst/gsttaglist.h:354
pragma Import (C, gst_tag_list_peek_string_index, "gst_tag_list_peek_string_index");
function gst_tag_list_get_pointer
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : System.Address) return GLIB.gboolean; -- gst/gsttaglist.h:358
pragma Import (C, gst_tag_list_get_pointer, "gst_tag_list_get_pointer");
function gst_tag_list_get_pointer_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : System.Address) return GLIB.gboolean; -- gst/gsttaglist.h:361
pragma Import (C, gst_tag_list_get_pointer_index, "gst_tag_list_get_pointer_index");
function gst_tag_list_get_date
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : System.Address) return GLIB.gboolean; -- gst/gsttaglist.h:365
pragma Import (C, gst_tag_list_get_date, "gst_tag_list_get_date");
function gst_tag_list_get_date_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : System.Address) return GLIB.gboolean; -- gst/gsttaglist.h:368
pragma Import (C, gst_tag_list_get_date_index, "gst_tag_list_get_date_index");
function gst_tag_list_get_date_time
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : System.Address) return GLIB.gboolean; -- gst/gsttaglist.h:372
pragma Import (C, gst_tag_list_get_date_time, "gst_tag_list_get_date_time");
function gst_tag_list_get_date_time_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : System.Address) return GLIB.gboolean; -- gst/gsttaglist.h:375
pragma Import (C, gst_tag_list_get_date_time_index, "gst_tag_list_get_date_time_index");
function gst_tag_list_get_buffer
(list : access constant GstTagList;
tag : access GLIB.gchar;
value : System.Address) return GLIB.gboolean; -- gst/gsttaglist.h:379
pragma Import (C, gst_tag_list_get_buffer, "gst_tag_list_get_buffer");
function gst_tag_list_get_buffer_index
(list : access constant GstTagList;
tag : access GLIB.gchar;
index : GLIB.guint;
value : System.Address) return GLIB.gboolean; -- gst/gsttaglist.h:382
pragma Import (C, gst_tag_list_get_buffer_index, "gst_tag_list_get_buffer_index");
-- GStreamer core tags
--*
-- * GST_TAG_TITLE:
-- *
-- * commonly used title (string)
-- *
-- * The title as it should be displayed, e.g. 'The Doll House'
--
--*
-- * GST_TAG_TITLE_SORTNAME:
-- *
-- * commonly used title, as used for sorting (string)
-- *
-- * The title as it should be sorted, e.g. 'Doll House, The'
-- *
-- * Since: 0.10.15
--
--*
-- * GST_TAG_ARTIST:
-- *
-- * person(s) responsible for the recording (string)
-- *
-- * The artist name as it should be displayed, e.g. 'Jimi Hendrix' or
-- * 'The Guitar Heroes'
--
--*
-- * GST_TAG_ARTIST_SORTNAME:
-- *
-- * person(s) responsible for the recording, as used for sorting (string)
-- *
-- * The artist name as it should be sorted, e.g. 'Hendrix, Jimi' or
-- * 'Guitar Heroes, The'
-- *
-- * Since: 0.10.15
--
-- FIXME 0.11: change to "artist-sortname"
--*
-- * GST_TAG_ALBUM:
-- *
-- * album containing this data (string)
-- *
-- * The album name as it should be displayed, e.g. 'The Jazz Guitar'
--
--*
-- * GST_TAG_ALBUM_SORTNAME:
-- *
-- * album containing this data, as used for sorting (string)
-- *
-- * The album name as it should be sorted, e.g. 'Jazz Guitar, The'
-- *
-- * Since: 0.10.15
--
--*
-- * GST_TAG_ALBUM_ARTIST:
-- *
-- * The artist of the entire album, as it should be displayed.
-- *
-- * Since: 0.10.25
--
--*
-- * GST_TAG_ALBUM_ARTIST_SORTNAME:
-- *
-- * The artist of the entire album, as it should be sorted.
-- *
-- * Since: 0.10.25
--
--*
-- * GST_TAG_COMPOSER:
-- *
-- * person(s) who composed the recording (string)
-- *
-- * Since: 0.10.15
--
--*
-- * GST_TAG_DATE:
-- *
-- * date the data was created (#GDate structure)
--
--*
-- * GST_TAG_DATE_TIME:
-- *
-- * date and time the data was created (#GstDateTime structure)
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_GENRE:
-- *
-- * genre this data belongs to (string)
--
--*
-- * GST_TAG_COMMENT:
-- *
-- * free text commenting the data (string)
--
--*
-- * GST_TAG_EXTENDED_COMMENT:
-- *
-- * key/value text commenting the data (string)
-- *
-- * Must be in the form of 'key=comment' or
-- * 'key[lc]=comment' where 'lc' is an ISO-639
-- * language code.
-- *
-- * This tag is used for unknown Vorbis comment tags,
-- * unknown APE tags and certain ID3v2 comment fields.
-- *
-- * Since: 0.10.10
--
--*
-- * GST_TAG_TRACK_NUMBER:
-- *
-- * track number inside a collection (unsigned integer)
--
--*
-- * GST_TAG_TRACK_COUNT:
-- *
-- * count of tracks inside collection this track belongs to (unsigned integer)
--
--*
-- * GST_TAG_ALBUM_VOLUME_NUMBER:
-- *
-- * disc number inside a collection (unsigned integer)
--
--*
-- * GST_TAG_ALBUM_VOLUME_COUNT:
-- *
-- * count of discs inside collection this disc belongs to (unsigned integer)
--
--*
-- * GST_TAG_LOCATION:
-- *
-- * Origin of media as a URI (location, where the original of the file or stream
-- * is hosted) (string)
--
--*
-- * GST_TAG_HOMEPAGE:
-- *
-- * Homepage for this media (i.e. artist or movie homepage) (string)
-- *
-- * Since: 0.10.23
--
--*
-- * GST_TAG_DESCRIPTION:
-- *
-- * short text describing the content of the data (string)
--
--*
-- * GST_TAG_VERSION:
-- *
-- * version of this data (string)
--
--*
-- * GST_TAG_ISRC:
-- *
-- * International Standard Recording Code - see http://www.ifpi.org/isrc/ (string)
--
--*
-- * GST_TAG_ORGANIZATION:
-- *
-- * organization (string)
--
--*
-- * GST_TAG_COPYRIGHT:
-- *
-- * copyright notice of the data (string)
--
--*
-- * GST_TAG_COPYRIGHT_URI:
-- *
-- * URI to location where copyright details can be found (string)
-- *
-- * Since: 0.10.14
--
--*
-- * GST_TAG_ENCODED_BY:
-- *
-- * name of the person or organisation that encoded the file. May contain a
-- * copyright message if the person or organisation also holds the copyright
-- * (string)
-- *
-- * Note: do not use this field to describe the encoding application. Use
-- * #GST_TAG_APPLICATION_NAME or #GST_TAG_COMMENT for that.
-- *
-- * Since: 0.10.33
--
--*
-- * GST_TAG_CONTACT:
-- *
-- * contact information (string)
--
--*
-- * GST_TAG_LICENSE:
-- *
-- * license of data (string)
--
--*
-- * GST_TAG_LICENSE_URI:
-- *
-- * URI to location where license details can be found (string)
-- *
-- * Since: 0.10.14
--
--*
-- * GST_TAG_PERFORMER:
-- *
-- * person(s) performing (string)
--
--*
-- * GST_TAG_DURATION:
-- *
-- * length in GStreamer time units (nanoseconds) (unsigned 64-bit integer)
--
--*
-- * GST_TAG_CODEC:
-- *
-- * codec the data is stored in (string)
--
--*
-- * GST_TAG_VIDEO_CODEC:
-- *
-- * codec the video data is stored in (string)
--
--*
-- * GST_TAG_AUDIO_CODEC:
-- *
-- * codec the audio data is stored in (string)
--
--*
-- * GST_TAG_SUBTITLE_CODEC:
-- *
-- * codec/format the subtitle data is stored in (string)
-- *
-- * Since: 0.10.23
--
--*
-- * GST_TAG_CONTAINER_FORMAT:
-- *
-- * container format the data is stored in (string)
-- *
-- * Since: 0.10.24
--
--*
-- * GST_TAG_BITRATE:
-- *
-- * exact or average bitrate in bits/s (unsigned integer)
--
--*
-- * GST_TAG_NOMINAL_BITRATE:
-- *
-- * nominal bitrate in bits/s (unsigned integer). The actual bitrate might be
-- * different from this target bitrate.
--
--*
-- * GST_TAG_MINIMUM_BITRATE:
-- *
-- * minimum bitrate in bits/s (unsigned integer)
--
--*
-- * GST_TAG_MAXIMUM_BITRATE:
-- *
-- * maximum bitrate in bits/s (unsigned integer)
--
--*
-- * GST_TAG_SERIAL:
-- *
-- * serial number of track (unsigned integer)
--
--*
-- * GST_TAG_ENCODER:
-- *
-- * encoder used to encode this stream (string)
--
--*
-- * GST_TAG_ENCODER_VERSION:
-- *
-- * version of the encoder used to encode this stream (unsigned integer)
--
--*
-- * GST_TAG_TRACK_GAIN:
-- *
-- * track gain in db (double)
--
--*
-- * GST_TAG_TRACK_PEAK:
-- *
-- * peak of the track (double)
--
--*
-- * GST_TAG_ALBUM_GAIN:
-- *
-- * album gain in db (double)
--
--*
-- * GST_TAG_ALBUM_PEAK:
-- *
-- * peak of the album (double)
--
--*
-- * GST_TAG_REFERENCE_LEVEL:
-- *
-- * reference level of track and album gain values (double)
-- *
-- * Since: 0.10.12
--
--*
-- * GST_TAG_LANGUAGE_CODE:
-- *
-- * Language code (ISO-639-1) (string) of the content
--
--*
-- * GST_TAG_IMAGE:
-- *
-- * image (buffer) (buffer caps should specify the content type and preferably
-- * also set "image-type" field as #GstTagImageType)
-- *
-- * Since: 0.10.6
--
--*
-- * GST_TAG_PREVIEW_IMAGE:
-- *
-- * image that is meant for preview purposes, e.g. small icon-sized version
-- * (buffer) (buffer caps should specify the content type)
-- *
-- * Since: 0.10.7
--
--*
-- * GST_TAG_ATTACHMENT:
-- *
-- * generic file attachment (buffer) (buffer caps should specify the content
-- * type and if possible set "filename" to the file name of the
-- * attachment)
-- *
-- * Since: 0.10.21
--
--*
-- * GST_TAG_BEATS_PER_MINUTE:
-- *
-- * number of beats per minute in audio (double)
-- *
-- * Since: 0.10.12
--
--*
-- * GST_TAG_KEYWORDS:
-- *
-- * comma separated keywords describing the content (string).
-- *
-- * Since: 0.10.21
--
--*
-- * GST_TAG_GEO_LOCATION_NAME:
-- *
-- * human readable descriptive location of where the media has been recorded or
-- * produced. (string).
-- *
-- * Since: 0.10.21
--
--*
-- * GST_TAG_GEO_LOCATION_LATITUDE:
-- *
-- * geo latitude location of where the media has been recorded or produced in
-- * degrees according to WGS84 (zero at the equator, negative values for southern
-- * latitudes) (double).
-- *
-- * Since: 0.10.21
--
--*
-- * GST_TAG_GEO_LOCATION_LONGITUDE:
-- *
-- * geo longitude location of where the media has been recorded or produced in
-- * degrees according to WGS84 (zero at the prime meridian in Greenwich/UK,
-- * negative values for western longitudes). (double).
-- *
-- * Since: 0.10.21
--
--*
-- * GST_TAG_GEO_LOCATION_ELEVATION:
-- *
-- * geo elevation of where the media has been recorded or produced in meters
-- * according to WGS84 (zero is average sea level) (double).
-- *
-- * Since: 0.10.21
--
--*
-- * GST_TAG_GEO_LOCATION_COUNTRY:
-- *
-- * The country (english name) where the media has been produced (string).
-- *
-- * Since: 0.10.29
--
--*
-- * GST_TAG_GEO_LOCATION_CITY:
-- *
-- * The city (english name) where the media has been produced (string).
-- *
-- * Since: 0.10.29
--
--*
-- * GST_TAG_GEO_LOCATION_SUBLOCATION:
-- *
-- * A location 'smaller' than GST_TAG_GEO_LOCATION_CITY that specifies better
-- * where the media has been produced. (e.g. the neighborhood) (string).
-- *
-- * This tag has been added as this is how it is handled/named in XMP's
-- * Iptc4xmpcore schema.
-- *
-- * Since: 0.10.29
--
--*
-- * GST_TAG_GEO_LOCATION_HORIZONTAL_ERROR:
-- *
-- * Represents the expected error on the horizontal positioning in
-- * meters (double).
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_GEO_LOCATION_MOVEMENT_SPEED:
-- *
-- * Speed of the capturing device when performing the capture.
-- * Represented in m/s. (double)
-- *
-- * See also #GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION
-- *
-- * Since 0.10.30
--
--*
-- * GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION:
-- *
-- * Indicates the movement direction of the device performing the capture
-- * of a media. It is represented as degrees in floating point representation,
-- * 0 means the geographic north, and increases clockwise (double from 0 to 360)
-- *
-- * See also #GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION
-- *
-- * Since: 0.10.30
--
--*
-- * GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION:
-- *
-- * Indicates the direction the device is pointing to when capturing
-- * a media. It is represented as degrees in floating point representation,
-- * 0 means the geographic north, and increases clockwise (double from 0 to 360)
-- *
-- * See also #GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION
-- *
-- * Since: 0.10.30
--
--*
-- * GST_TAG_SHOW_NAME:
-- *
-- * Name of the show, used for displaying (string)
-- *
-- * Since: 0.10.26
--
--*
-- * GST_TAG_SHOW_SORTNAME:
-- *
-- * Name of the show, used for sorting (string)
-- *
-- * Since: 0.10.26
--
--*
-- * GST_TAG_SHOW_EPISODE_NUMBER:
-- *
-- * Number of the episode within a season/show (unsigned integer)
-- *
-- * Since: 0.10.26
--
--*
-- * GST_TAG_SHOW_SEASON_NUMBER:
-- *
-- * Number of the season of a show/series (unsigned integer)
-- *
-- * Since: 0.10.26
--
--*
-- * GST_TAG_LYRICS:
-- *
-- * The lyrics of the media (string)
-- *
-- * Since: 0.10.26
--
--*
-- * GST_TAG_COMPOSER_SORTNAME:
-- *
-- * The composer's name, used for sorting (string)
-- *
-- * Since: 0.10.26
--
--*
-- * GST_TAG_GROUPING:
-- *
-- * Groups together media that are related and spans multiple tracks. An
-- * example are multiple pieces of a concerto. (string)
-- *
-- * Since: 0.10.26
--
--*
-- * GST_TAG_USER_RATING:
-- *
-- * Rating attributed by a person (likely the application user).
-- * The higher the value, the more the user likes this media
-- * (unsigned int from 0 to 100)
-- *
-- * Since: 0.10.29
--
--*
-- * GST_TAG_DEVICE_MANUFACTURER:
-- *
-- * Manufacturer of the device used to create the media (string)
-- *
-- * Since: 0.10.30
--
--*
-- * GST_TAG_DEVICE_MODEL:
-- *
-- * Model of the device used to create the media (string)
-- *
-- * Since: 0.10.30
--
--*
-- * GST_TAG_APPLICATION_NAME:
-- *
-- * Name of the application used to create the media (string)
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_APPLICATION_DATA:
-- *
-- * Arbitrary application data (buffer)
-- *
-- * Some formats allow application's to add their own arbitrary data
-- * into files. This data is application's dependent.
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_IMAGE_ORIENTATION:
-- *
-- * Represents the 'Orientation' tag from EXIF. Defines how the image
-- * should be rotated and mirrored for display. (string)
-- *
-- * This tag has a predefined set of allowed values:
-- * "rotate-0"
-- * "rotate-90"
-- * "rotate-180"
-- * "rotate-270"
-- * "flip-rotate-0"
-- * "flip-rotate-90"
-- * "flip-rotate-180"
-- * "flip-rotate-270"
-- *
-- * The naming is adopted according to a possible transformation to perform
-- * on the image to fix its orientation, obviously equivalent operations will
-- * yield the same result.
-- *
-- * Rotations indicated by the values are in clockwise direction and
-- * 'flip' means an horizontal mirroring.
-- *
-- * Since: 0.10.30
--
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h;
| 33.415192 | 153 | 0.661274 |
dca4c2ba680b7287abf9dc2f31b8743a051bfdb7 | 4,807 | ada | Ada | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3413c.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3413c.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3413c.ada | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | -- CE3413C.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 PAGE OPERATES ON THE CURRENT DEFAULT OUTPUT FILE WHEN
-- NO FILE IS SPECIFIED. CHECK THAT PAGE CAN OPERATE ON FILES OF
-- MODES IN_FILE AND OUT_FILE, INCLUDING THE CURRENT DEFAULT
-- INPUT_FILE.
-- APPLICABILITY CRITERIA:
-- THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH SUPPORT
-- TEXT FILES.
-- HISTORY:
-- SPS 09/29/82
-- JBG 08/30/83
-- RJW 11/04/86 REVISED TEST TO OUTPUT A NOT_APPLICABLE
-- RESULT WHEN FILES ARE NOT SUPPORTED.
-- JLH 09/04/87 REMOVED DEPENDENCE ON RESET, CORRECTED EXCEPTION
-- HANDLING, AND CHECKED FOR USE_ERROR ON DELETE.
WITH REPORT;
USE REPORT;
WITH TEXT_IO;
USE TEXT_IO;
PROCEDURE CE3413C IS
INCOMPLETE : EXCEPTION;
BEGIN
TEST ("CE3413C", "CHECK THAT PAGE OPERATES ON DEFAULT IN_FILE " &
"AND OUT_FILE FILES");
DECLARE
F1, F2 : FILE_TYPE;
C : POSITIVE_COUNT;
X : CHARACTER;
BEGIN
BEGIN
CREATE (F1, OUT_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED ON TEXT CREATE " &
"WITH OUT_FILE MODE");
RAISE INCOMPLETE;
WHEN NAME_ERROR =>
NOT_APPLICABLE ("NAME_ERROR RAISED ON TEXT " &
"CREATE WITH OUT_FILE MODE");
RAISE INCOMPLETE;
WHEN OTHERS =>
FAILED ("UNEXPECTED EXCEPTION RAISED ON " &
"TEXT CREATE");
RAISE INCOMPLETE;
END;
BEGIN
CREATE (F2, OUT_FILE);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED ON TEXT CREATE " &
"FOR TEMPORARY FILES WITH " &
"OUT_FILE MODE");
RAISE INCOMPLETE;
END;
SET_OUTPUT (F2);
IF PAGE (F2) /= 1 AND PAGE (STANDARD_OUTPUT) /= 1 THEN
FAILED ("PAGE INCORRECT SUBTEST - 1");
END IF;
FOR I IN 1 .. 3 LOOP
PUT (F1, "STRING");
NEW_PAGE (F1);
END LOOP;
IF PAGE (F1) /= 4 THEN
FAILED ("PAGE INCORRECT SUBTEST - 2");
END IF;
SET_LINE_LENGTH (F2, 3);
SET_PAGE_LENGTH (F2, 1);
PUT ("OUTPUT STRING");
IF PAGE /= PAGE(F2) THEN
FAILED ("PAGE INCORRECT SUBTEST - 3");
END IF;
CLOSE (F1);
BEGIN
OPEN (F1, IN_FILE, LEGAL_FILE_NAME);
EXCEPTION
WHEN USE_ERROR =>
NOT_APPLICABLE ("USE_ERROR RAISED ON TEXT OPEN " &
"IN_FILE MODE");
RAISE INCOMPLETE;
END;
SET_INPUT (F1);
IF PAGE (F1) /= 1 THEN
FAILED ("PAGE INCORRECT SUBTEST - 4");
END IF;
SKIP_PAGE(F1);
SKIP_PAGE(F1);
IF PAGE (F1) /= PAGE (CURRENT_INPUT) THEN
FAILED ("PAGE INCORRECT SUBTEST - 5");
END IF;
BEGIN
DELETE (F1);
EXCEPTION
WHEN USE_ERROR =>
NULL;
END;
CLOSE (F2);
EXCEPTION
WHEN INCOMPLETE =>
NULL;
END;
RESULT;
END CE3413C;
| 31.418301 | 79 | 0.528604 |
18873f2eb60b5bc316ae36ba90bbd5e0e7d9c591 | 2,983 | ads | Ada | tools/scitools/conf/understand/ada/ada12/s-pack13.ads | brucegua/moocos | 575c161cfa35e220f10d042e2e5ca18773691695 | [
"Apache-2.0"
] | 1 | 2020-01-20T21:26:46.000Z | 2020-01-20T21:26:46.000Z | tools/scitools/conf/understand/ada/ada12/s-pack13.ads | brucegua/moocos | 575c161cfa35e220f10d042e2e5ca18773691695 | [
"Apache-2.0"
] | null | null | null | tools/scitools/conf/understand/ada/ada12/s-pack13.ads | brucegua/moocos | 575c161cfa35e220f10d042e2e5ca18773691695 | [
"Apache-2.0"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . P A C K _ 1 3 --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2009, 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. --
-- --
-- --
-- --
-- --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
-- Handling of packed arrays with Component_Size = 13
package System.Pack_13 is
pragma Preelaborate;
Bits : constant := 13;
type Bits_13 is mod 2 ** Bits;
for Bits_13'Size use Bits;
function Get_13 (Arr : System.Address; N : Natural) return Bits_13;
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is extracted and returned.
procedure Set_13 (Arr : System.Address; N : Natural; E : Bits_13);
-- Arr is the address of the packed array, N is the zero-based
-- subscript. This element is set to the given value.
end System.Pack_13;
| 58.490196 | 78 | 0.376802 |
180d4a4391a527821f49dd12e8cc9fd2392d98d0 | 2,740 | ads | Ada | gcc-gcc-7_3_0-release/gcc/ada/a-suhcin.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/ada/a-suhcin.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/ada/a-suhcin.ads | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.STRINGS.UNBOUNDED.HASH_CASE_INSENSITIVE --
-- --
-- S p e c --
-- --
-- Copyright (C) 2011, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
with Ada.Containers;
function Ada.Strings.Unbounded.Hash_Case_Insensitive
(Key : Unbounded.Unbounded_String)
return Containers.Hash_Type;
pragma Preelaborate (Ada.Strings.Unbounded.Hash_Case_Insensitive);
| 66.829268 | 78 | 0.428102 |
df02eb56f7661ccfaf516669a3414b5d59640d36 | 18,409 | ads | Ada | arch/ARM/STM32/svd/stm32l4x6/stm32_svd-exti.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | 2 | 2018-05-16T03:56:39.000Z | 2019-07-31T13:53:56.000Z | arch/ARM/STM32/svd/stm32l4x6/stm32_svd-exti.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | arch/ARM/STM32/svd/stm32l4x6/stm32_svd-exti.ads | morbos/Ada_Drivers_Library | a4ab26799be60997c38735f4056160c4af597ef7 | [
"BSD-3-Clause"
] | null | null | null | -- This spec has been automatically generated from STM32L4x6.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.EXTI is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- IMR1_MR array
type IMR1_MR_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Interrupt mask register
type IMR1_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : HAL.UInt32;
when True =>
-- MR as an array
Arr : IMR1_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for IMR1_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- EMR1_MR array
type EMR1_MR_Field_Array is array (0 .. 31) of Boolean
with Component_Size => 1, Size => 32;
-- Event mask register
type EMR1_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : HAL.UInt32;
when True =>
-- MR as an array
Arr : EMR1_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access,
Bit_Order => System.Low_Order_First;
for EMR1_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
-- RTSR1_TR array
type RTSR1_TR_Field_Array is array (0 .. 16) of Boolean
with Component_Size => 1, Size => 17;
-- Type definition for RTSR1_TR
type RTSR1_TR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : HAL.UInt17;
when True =>
-- TR as an array
Arr : RTSR1_TR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 17;
for RTSR1_TR_Field use record
Val at 0 range 0 .. 16;
Arr at 0 range 0 .. 16;
end record;
-- RTSR1_TR array
type RTSR1_TR_Field_Array_1 is array (18 .. 22) of Boolean
with Component_Size => 1, Size => 5;
-- Type definition for RTSR1_TR
type RTSR1_TR_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : HAL.UInt5;
when True =>
-- TR as an array
Arr : RTSR1_TR_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 5;
for RTSR1_TR_Field_1 use record
Val at 0 range 0 .. 4;
Arr at 0 range 0 .. 4;
end record;
-- Rising Trigger selection register
type RTSR1_Register is record
-- Rising trigger event configuration of line 0
TR : RTSR1_TR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
-- Rising trigger event configuration of line 18
TR_1 : RTSR1_TR_Field_1 := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTSR1_Register use record
TR at 0 range 0 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
TR_1 at 0 range 18 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- FTSR1_TR array
type FTSR1_TR_Field_Array is array (0 .. 16) of Boolean
with Component_Size => 1, Size => 17;
-- Type definition for FTSR1_TR
type FTSR1_TR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : HAL.UInt17;
when True =>
-- TR as an array
Arr : FTSR1_TR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 17;
for FTSR1_TR_Field use record
Val at 0 range 0 .. 16;
Arr at 0 range 0 .. 16;
end record;
-- FTSR1_TR array
type FTSR1_TR_Field_Array_1 is array (18 .. 22) of Boolean
with Component_Size => 1, Size => 5;
-- Type definition for FTSR1_TR
type FTSR1_TR_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- TR as a value
Val : HAL.UInt5;
when True =>
-- TR as an array
Arr : FTSR1_TR_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 5;
for FTSR1_TR_Field_1 use record
Val at 0 range 0 .. 4;
Arr at 0 range 0 .. 4;
end record;
-- Falling Trigger selection register
type FTSR1_Register is record
-- Falling trigger event configuration of line 0
TR : FTSR1_TR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
-- Falling trigger event configuration of line 18
TR_1 : FTSR1_TR_Field_1 := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FTSR1_Register use record
TR at 0 range 0 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
TR_1 at 0 range 18 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- SWIER1_SWIER array
type SWIER1_SWIER_Field_Array is array (0 .. 16) of Boolean
with Component_Size => 1, Size => 17;
-- Type definition for SWIER1_SWIER
type SWIER1_SWIER_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- SWIER as a value
Val : HAL.UInt17;
when True =>
-- SWIER as an array
Arr : SWIER1_SWIER_Field_Array;
end case;
end record
with Unchecked_Union, Size => 17;
for SWIER1_SWIER_Field use record
Val at 0 range 0 .. 16;
Arr at 0 range 0 .. 16;
end record;
-- SWIER1_SWIER array
type SWIER1_SWIER_Field_Array_1 is array (18 .. 22) of Boolean
with Component_Size => 1, Size => 5;
-- Type definition for SWIER1_SWIER
type SWIER1_SWIER_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- SWIER as a value
Val : HAL.UInt5;
when True =>
-- SWIER as an array
Arr : SWIER1_SWIER_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 5;
for SWIER1_SWIER_Field_1 use record
Val at 0 range 0 .. 4;
Arr at 0 range 0 .. 4;
end record;
-- Software interrupt event register
type SWIER1_Register is record
-- Software Interrupt on line 0
SWIER : SWIER1_SWIER_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
-- Software Interrupt on line 18
SWIER_1 : SWIER1_SWIER_Field_1 :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SWIER1_Register use record
SWIER at 0 range 0 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
SWIER_1 at 0 range 18 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- PR1_PR array
type PR1_PR_Field_Array is array (0 .. 16) of Boolean
with Component_Size => 1, Size => 17;
-- Type definition for PR1_PR
type PR1_PR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PR as a value
Val : HAL.UInt17;
when True =>
-- PR as an array
Arr : PR1_PR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 17;
for PR1_PR_Field use record
Val at 0 range 0 .. 16;
Arr at 0 range 0 .. 16;
end record;
-- PR1_PR array
type PR1_PR_Field_Array_1 is array (18 .. 22) of Boolean
with Component_Size => 1, Size => 5;
-- Type definition for PR1_PR
type PR1_PR_Field_1
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PR as a value
Val : HAL.UInt5;
when True =>
-- PR as an array
Arr : PR1_PR_Field_Array_1;
end case;
end record
with Unchecked_Union, Size => 5;
for PR1_PR_Field_1 use record
Val at 0 range 0 .. 4;
Arr at 0 range 0 .. 4;
end record;
-- Pending register
type PR1_Register is record
-- Pending bit 0
PR : PR1_PR_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_17_17 : HAL.Bit := 16#0#;
-- Pending bit 18
PR_1 : PR1_PR_Field_1 := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_23_31 : HAL.UInt9 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PR1_Register use record
PR at 0 range 0 .. 16;
Reserved_17_17 at 0 range 17 .. 17;
PR_1 at 0 range 18 .. 22;
Reserved_23_31 at 0 range 23 .. 31;
end record;
-- IMR2_MR array
type IMR2_MR_Field_Array is array (32 .. 39) of Boolean
with Component_Size => 1, Size => 8;
-- Type definition for IMR2_MR
type IMR2_MR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : HAL.UInt8;
when True =>
-- MR as an array
Arr : IMR2_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8;
for IMR2_MR_Field use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- Interrupt mask register
type IMR2_Register is record
-- Interrupt Mask on external/internal line 32
MR : IMR2_MR_Field := (As_Array => False, Val => 16#1#);
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#FFFFFF#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IMR2_Register use record
MR at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- EMR2_MR array
type EMR2_MR_Field_Array is array (32 .. 39) of Boolean
with Component_Size => 1, Size => 8;
-- Type definition for EMR2_MR
type EMR2_MR_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- MR as a value
Val : HAL.UInt8;
when True =>
-- MR as an array
Arr : EMR2_MR_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8;
for EMR2_MR_Field use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- Event mask register
type EMR2_Register is record
-- Event mask on external/internal line 32
MR : EMR2_MR_Field := (As_Array => False, Val => 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 EMR2_Register use record
MR at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- RTSR2_RT array
type RTSR2_RT_Field_Array is array (35 .. 38) of Boolean
with Component_Size => 1, Size => 4;
-- Type definition for RTSR2_RT
type RTSR2_RT_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- RT as a value
Val : HAL.UInt4;
when True =>
-- RT as an array
Arr : RTSR2_RT_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for RTSR2_RT_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Rising Trigger selection register
type RTSR2_Register is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#0#;
-- Rising trigger event configuration bit of line 35
RT : RTSR2_RT_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTSR2_Register use record
Reserved_0_2 at 0 range 0 .. 2;
RT at 0 range 3 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- FTSR2_FT array
type FTSR2_FT_Field_Array is array (35 .. 38) of Boolean
with Component_Size => 1, Size => 4;
-- Type definition for FTSR2_FT
type FTSR2_FT_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- FT as a value
Val : HAL.UInt4;
when True =>
-- FT as an array
Arr : FTSR2_FT_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for FTSR2_FT_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Falling Trigger selection register
type FTSR2_Register is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#0#;
-- Falling trigger event configuration bit of line 35
FT : FTSR2_FT_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FTSR2_Register use record
Reserved_0_2 at 0 range 0 .. 2;
FT at 0 range 3 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- SWIER2_SWI array
type SWIER2_SWI_Field_Array is array (35 .. 38) of Boolean
with Component_Size => 1, Size => 4;
-- Type definition for SWIER2_SWI
type SWIER2_SWI_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- SWI as a value
Val : HAL.UInt4;
when True =>
-- SWI as an array
Arr : SWIER2_SWI_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for SWIER2_SWI_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Software interrupt event register
type SWIER2_Register is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#0#;
-- Software interrupt on line 35
SWI : SWIER2_SWI_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for SWIER2_Register use record
Reserved_0_2 at 0 range 0 .. 2;
SWI at 0 range 3 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-- PR2_PIF array
type PR2_PIF_Field_Array is array (35 .. 38) of Boolean
with Component_Size => 1, Size => 4;
-- Type definition for PR2_PIF
type PR2_PIF_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- PIF as a value
Val : HAL.UInt4;
when True =>
-- PIF as an array
Arr : PR2_PIF_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for PR2_PIF_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Pending register
type PR2_Register is record
-- unspecified
Reserved_0_2 : HAL.UInt3 := 16#0#;
-- Pending interrupt flag on line 35
PIF : PR2_PIF_Field := (As_Array => False, Val => 16#0#);
-- unspecified
Reserved_7_31 : HAL.UInt25 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for PR2_Register use record
Reserved_0_2 at 0 range 0 .. 2;
PIF at 0 range 3 .. 6;
Reserved_7_31 at 0 range 7 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- External interrupt/event controller
type EXTI_Peripheral is record
-- Interrupt mask register
IMR1 : aliased IMR1_Register;
-- Event mask register
EMR1 : aliased EMR1_Register;
-- Rising Trigger selection register
RTSR1 : aliased RTSR1_Register;
-- Falling Trigger selection register
FTSR1 : aliased FTSR1_Register;
-- Software interrupt event register
SWIER1 : aliased SWIER1_Register;
-- Pending register
PR1 : aliased PR1_Register;
-- Interrupt mask register
IMR2 : aliased IMR2_Register;
-- Event mask register
EMR2 : aliased EMR2_Register;
-- Rising Trigger selection register
RTSR2 : aliased RTSR2_Register;
-- Falling Trigger selection register
FTSR2 : aliased FTSR2_Register;
-- Software interrupt event register
SWIER2 : aliased SWIER2_Register;
-- Pending register
PR2 : aliased PR2_Register;
end record
with Volatile;
for EXTI_Peripheral use record
IMR1 at 16#0# range 0 .. 31;
EMR1 at 16#4# range 0 .. 31;
RTSR1 at 16#8# range 0 .. 31;
FTSR1 at 16#C# range 0 .. 31;
SWIER1 at 16#10# range 0 .. 31;
PR1 at 16#14# range 0 .. 31;
IMR2 at 16#20# range 0 .. 31;
EMR2 at 16#24# range 0 .. 31;
RTSR2 at 16#28# range 0 .. 31;
FTSR2 at 16#2C# range 0 .. 31;
SWIER2 at 16#30# range 0 .. 31;
PR2 at 16#34# range 0 .. 31;
end record;
-- External interrupt/event controller
EXTI_Periph : aliased EXTI_Peripheral
with Import, Address => System'To_Address (16#40010400#);
end STM32_SVD.EXTI;
| 28.585404 | 77 | 0.57624 |
d04d482c62436bd549820ba948019268195b631b | 77,064 | ads | Ada | src/JEWL/jewl-windows.ads | leomlr/sudoku_ada-jewl | db5f87d41657e17d4e3cffe138a0c0527652c9ec | [
"MIT"
] | null | null | null | src/JEWL/jewl-windows.ads | leomlr/sudoku_ada-jewl | db5f87d41657e17d4e3cffe138a0c0527652c9ec | [
"MIT"
] | null | null | null | src/JEWL/jewl-windows.ads | leomlr/sudoku_ada-jewl | db5f87d41657e17d4e3cffe138a0c0527652c9ec | [
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- J E W L . W I N D O W S --
-- --
-- A package for developing GUI-based programs for beginners. --
-- --
-- This is a large package, but splitting it into child packages would --
-- require multiple generic instantiations in order to use it. --
-- --
-- Copyright (C) John English 2000. Contact address: [email protected] --
-- This software is released under the terms of the GNU General Public --
-- License and is intended primarily for educational use. Please contact --
-- the author to report bugs, suggestions and modifications. --
-- --
------------------------------------------------------------------------------
-- $Id: jewl-windows.ads 1.7 2007/01/08 17:00:00 JE Exp $
------------------------------------------------------------------------------
--
-- $Log: jewl-windows.ads $
-- Revision 1.7 2007/01/08 17:00:00 JE
-- * Fixed linker options in JEWL.Win32_Interface to accommodate changes to GNAT
-- GPL 2006 compiler (thanks to John McCormick for this)
-- * Added delay in message loop to avoid the appearance of hogging 100% of CPU
-- time
--
-- Revision 1.6 2001/11/02 16:00:00 JE
-- * Fixed canvas bug when saving an empty canvas
-- * Restore with no prior save now acts as erase
-- * Removed redundant variable declaration in Image function
--
-- Revision 1.5 2001/08/22 15:00:00 JE
-- * Minor bugfix to Get_Text for combo boxes
-- * Minor changes to documentation (including new example involving dialogs)
--
-- Revision 1.4 2001/01/25 09:00:00 je
-- Changes visible to the user:
--
-- * Added support for drawing bitmaps on canvases (Draw_Image operations
-- and new type Image_Type)
-- * Added Play_Sound
-- * Added several new operations on all windows: Get_Origin, Get_Width,
-- Get_Height, Set_Origin, Set_Size and Focus
-- * Added several functions giving screen and window dimensions: Screen_Width,
-- Screen_Height, Frame_Width, Frame_Height, Dialog_Width, Dialog_Height and
-- Menu_Height
-- * Canvases can now handle keyboard events: new constructor and Key_Code added
-- * Added procedure Play_Sound
-- * Operations "+" and "-" added for Point_Type
-- * Pens can now be zero pixels wide
-- * The absolute origin of a frame can now have be specified when the frame
-- is created
-- * Added new File_Dialog operations Add_Filter and Set_Directory
-- * Added Get_Line renames to JEWL.IO for compatibility with Ada.Text_IO
-- * Added all the Get(File,Item) operations mentioned in documentation but
-- unaccountably missing :-(
-- * Documentation updated to reflect the above changes
-- * HTML versions of public package specifications added with links from
-- main documentation pages
--
-- Other internal changes:
--
-- * Canvas fonts, pens etc. now use JEWL.Reference_Counted_Type rather than
-- reinventing this particular wheel, as do images
-- * Various minor code formatting changes: some code reordered for clarity,
-- some comments added or amended,
-- * Changes introduced in 1.2 to support GNAT 3.10 have been reversed, since
-- GNAT 3.10 still couldn't compile this code correctly... ;-(
--
-- Outstanding issues:
--
-- * Optimisation breaks the code (workaround: don't optimise)
--
-- Revision 1.3 2000/07/07 12:00:00 je
-- * JEWL.Simple_Windows added; JEWL.IO modified to use JEWL.Simple_Windows.
-- * JEWL.IO bug fix: Put_Line to file wrote newline to standard output
-- instead of to the file (thanks to Jeff Carter for pointing this out).
-- * Panels fixed so that mouse clicks are passed on correctly to subwindows.
-- * Memos fixed so that tabs are handled properly.
-- * Password feature added to editboxes.
-- * Minor typos fixed in comments within the package sources.
-- * Documentation corrected and updated following comments from Moti Ben-Ari
-- and Don Overheu.
--
-- Revision 1.2 2000/04/18 20:00:00 je
-- * Minor code changes to enable compilation by GNAT 3.10
-- * Minor documentation errors corrected
-- * Some redundant "with" clauses removed
--
-- Revision 1.1 2000/04/09 21:00:00 je
-- Initial revision
--
------------------------------------------------------------------------------
generic -- This is a generic package which must be
type Command_Type is (<>); -- instantiated with a list of possible
-- command values to be generated whenever
package JEWL.Windows is -- a window is closed, a button is clicked
-- or a menu item is selected.
----------------------------------------------------------------------------
-- Miscellaneous operations
----------------------------------------------------------------------------
procedure Show_Error (Text : in String; -- an error message
Title : in String := "Error");
function Show_Query (Text : in String; -- a yes/no query
Title : in String := "Query")
return Boolean;
procedure Show_Message (Text : in String; -- an information message
Title : in String := "Message");
procedure Play_Sound (Sound : in String); -- play a sound file
function Screen_Width return Natural; -- width of display screen
function Screen_Height return Natural; -- height of display screen
----------------------------------------------------------------------------
--
-- S U P P O R T T Y P E S
--
-- Except for Alignment_Type, these types are defined in the top-level
-- package JEWL and are renamed here for convenience:
--
-- Alignment_Type : used to specify text alignment with a window.
-- Angle_Type : an angle specified as an integral number of
-- degrees (0 to 359)
-- Colour_Type : a colour specified as an RGB value.
-- Font_Type : a font specified by a name, point size and bold
-- and italic style options.
-- Point_Type : a pair of (X,Y) coordinates within a window.
-- Point_List : an array of (X,Y) coordinate pairs.
--
----------------------------------------------------------------------------
type Alignment_Type is (Left, Centre, Right);
subtype Angle_Type is JEWL.Angle_Type;
subtype Colour_Range is JEWL.Colour_Range;
subtype Colour_Type is JEWL.Colour_Type;
subtype Font_Type is JEWL.Font_Type;
type Image_Type is private;
subtype Point_Type is JEWL.Point_Type;
subtype Point_List is JEWL.Point_List;
----------------------------------------------------------------------------
-- Renamings for our transatlantic cousins, in the hope that some day
-- they'll repay the favour/favor... ;-)
----------------------------------------------------------------------------
subtype Color_Range is Colour_Range;
subtype Color_Type is Colour_Type;
function Center return Alignment_Type renames Centre;
----------------------------------------------------------------------------
--
-- O P E R A T I O N S O N S U P P O R T T Y P E S
--
-- These are renamings of the operations defined in the parent package
-- provided for convenience.
--
-- Colour operations:
-- Light : Generate a lightened version of a colour, e.g. Light(Red).
-- Dark : Generate a darkened version of a colour, e.g. Dark(Green).
--
-- Font operations:
-- Font : Generate a font with the specified properties.
-- Name : Get the name of the font typeface.
-- Size : Get the font size in points.
-- Bold : Test if the font is bold.
-- Italic : Test if the font is italic.
--
-- Image operations:
-- Image : Load an image from a bitmap file.
-- Valid : Test if an image is valid.
-- Width : Get the width of an image.
-- Height : Get the height of an image.
--
-- Point operations:
-- Endpoint : Calculate the endpoint of a line from a starting point,
-- length and angle
-- Inside : Test if a specified point is inside a specified rectangle
-- (defined by the coordinates of two diagonally opposite
-- corners).
-- P1 + P2 : Add two points (P1.X+P2.X, P1.Y+P2.Y).
-- P1 - P2 : Subtract two points (P1.X-P2.X, P1.Y-P2.Y).
--
----------------------------------------------------------------------------
function Light (Colour : JEWL.Colour_Type) return JEWL.Colour_Type
renames JEWL.Light;
function Dark (Colour : JEWL.Colour_Type) return JEWL.Colour_Type
renames JEWL.Dark;
function Font (Name : String;
Size : Positive;
Bold : Boolean := False;
Italic : Boolean := False) return JEWL.Font_Type
renames JEWL.Font;
function Name (Font : Font_Type) return String
renames JEWL.Name;
function Size (Font : Font_Type) return Natural
renames JEWL.Size;
function Bold (Font : Font_Type) return Boolean
renames JEWL.Bold;
function Italic (Font : Font_Type) return Boolean
renames JEWL.Italic;
function Image (Name : String) return Image_Type;
function Valid (Image : Image_Type) return Boolean;
function Width (Image : Image_Type) return Natural;
function Height (Image : Image_Type) return Natural;
function Endpoint (From : JEWL.Point_Type;
Length : Positive;
Angle : JEWL.Angle_Type) return JEWL.Point_Type
renames JEWL.Endpoint;
function Inside (Point : JEWL.Point_Type;
From : JEWL.Point_Type;
To : JEWL.Point_Type) return Boolean
renames JEWL.Inside;
function "+" (P1, P2 : Point_Type) return Point_Type
renames JEWL."+";
function "-" (P1, P2 : Point_Type) return Point_Type
renames JEWL."-";
----------------------------------------------------------------------------
--
-- S U P P O R T T Y P E C O N S T A N T S
--
-- Angles : North, South, East and West
-- Colours : Black, White, Red, Green, Blue, etc.
-- Fonts : Default_Font (the default font for top-level windows) and
-- Parent_Font (the same font as a window's parent uses)
--
----------------------------------------------------------------------------
North : constant Angle_Type := 0;
South : constant Angle_Type := 180;
East : constant Angle_Type := 90;
West : constant Angle_Type := 270;
Black : constant Colour_Type := ( 0, 0, 0);
White : constant Colour_Type := (255,255,255);
Red : constant Colour_Type := (255, 0, 0);
Green : constant Colour_Type := ( 0,255, 0);
Blue : constant Colour_Type := ( 0, 0,255);
Gray : constant Colour_Type := (128,128,128);
Yellow : constant Colour_Type := (255,255, 0);
Cyan : constant Colour_Type := ( 0,255,255);
Magenta : constant Colour_Type := (255, 0,255);
Default_Font : constant Font_Type := Font("Arial",9);
Parent_Font : constant Font_Type := Font("",1);
----------------------------------------------------------------------------
--
-- W I N D O W _ T Y P E
--
-- An abstract class providing basic behaviour which all windows share.
--
----------------------------------------------------------------------------
type Window_Type is abstract tagged private;
Invalid_Window : exception; -- raised if an attempt is made to use an
-- invalid (non-open) window
----------------------------------------------------------------------------
--
-- Window operations (common to all windows):
--
-- Show (Window, -- make the window visible or invisible depending
-- Visible) -- on the value of Visible (default: True).
-- Hide (Window) -- make the window invisible.
-- Focus (Window) -- give the window the input focus.
-- Visible (Window) -- return True if the window is visible.
-- Get_Origin (Window) -- get the origin (top left point) of the
-- -- specified window.
-- Get_Width (Window) -- get the width of the specified window.
-- Get_Height (Window) -- get the height of the specified window.
-- Set_Origin (Window, -- set the origin (top left point) of the
-- Origin) -- specified window to this value.
-- Set_Size (Window, -- set the size of the specified window
-- Width, -- to this width (optional)
-- Height) -- and this height (optional).
-- Get_Font (Window) -- get the font for the specified window.
-- Set_Font (Window, -- set the font for the specified window
-- Font) -- to this one.
--
----------------------------------------------------------------------------
procedure Show (Window : in Window_Type;
Visible : in Boolean := True);
procedure Hide (Window : in Window_Type);
procedure Focus (Window : in Window_Type);
function Visible (Window : Window_Type) return Boolean;
function Get_Origin (Window : Window_Type) return Point_Type;
function Get_Width (Window : Window_Type) return Natural;
function Get_Height (Window : Window_Type) return Natural;
procedure Set_Origin (Window : in Window_Type;
Origin : in Point_Type);
procedure Set_Size (Window : in Window_Type;
Width : in Natural := 0;
Height : in Natural := 0);
function Get_Font (Window : Window_Type) return Font_Type;
procedure Set_Font (Window : in Window_Type;
Font : in Font_Type);
----------------------------------------------------------------------------
--
-- W I N D O W S U B C L A S S E S
--
-- The primary window subclasses are containers and controls. They
-- share the behaviour common to all windows (above) and provide extra
-- behaviour as well.
--
-- Container_Type : the abstract base type for all containers.
-- Control_Type : the abstract base type for all controls.
--
----------------------------------------------------------------------------
type Container_Type is abstract new Window_Type with private;
type Control_Type is abstract new Window_Type with private;
----------------------------------------------------------------------------
--
-- C O N T A I N E R S
--
-- Containers are windows which can contain other windows. All windows
-- except frames and dialogs (see below) must be contained within some
-- other container window. There are some restrictions on the types of
-- container that a window can be attached to (for example, a menu item
-- must be attached to a menu).
--
-- Most windows specify an origin, a width and a height whose coordinates
-- are taken relative to the enclosing container. Positive widths and
-- heights are absolute values, but zero and negative widths and heights
-- are interpreted as being relative to the width and height of the
-- enclosing container (so a width of 0 means the width of the enclosing
-- container, a height of -10 means 10 pixels less than the height of the
-- enclosing container).
--
-- The types of container windows available are as follows:
--
-- Frame_Type : a main window with a title bar, system menu, minimise
-- and maximise buttons, and a close button.
-- Dialog_Type : a top level window which is used for modal interaction,
-- disabling other windows while the interaction takes
-- place.
-- Panel_Type : a plain window which is used as a container for other
-- subwindows.
-- Menu_Type : a menu which can contain menu items and submenus.
--
----------------------------------------------------------------------------
type Frame_Type is new Container_Type with private;
type Dialog_Type is new Container_Type with private;
type Panel_Type is new Container_Type with private;
type Menu_Type is new Container_Type with private;
----------------------------------------------------------------------------
--
-- F R A M E S
--
-- A frame is a top level window with a title bar, system menu, minimise
-- and maximise buttons, and a close button. Closing a frame generates a
-- command. Frames are normally visible, but can be hidden if required.
-- A frame should be used as the main window for an application.
--
-- Frame operations:
--
-- Frame (Origin, -- create a frame at the specified position
-- Width, -- with the specified width
-- Height, -- and height in pixels,
-- Title, -- with the specified title in the title bar,
-- Command, -- generating this command when it is closed,
-- Font) -- using this font (default: Default_Font).
-- Frame (Width, -- create a frame with the specified width
-- Height, -- and height in pixels, placed randomly,
-- Title, -- with the specified title in the title bar,
-- Command, -- generating this command when it is closed,
-- Font) -- using this font (default: Default_Font).
--
-- Close (Frame) -- close the frame.
-- Valid (Frame) -- true until the frame is closed.
--
-- Frame_Width -- return the width of the frame border.
-- Frame_Height -- return the height of the frame border.
--
-- Next_Command -- return the next command generated by any
-- -- control in any existing frame.
-- Command_Ready -- test if there is a command pending
--
----------------------------------------------------------------------------
function Frame (Origin : Point_Type;
Width : Positive;
Height : Positive;
Title : String;
Command : Command_Type;
Font : Font_Type := Default_Font) return Frame_Type;
function Frame (Width : Positive;
Height : Positive;
Title : String;
Command : Command_Type;
Font : Font_Type := Default_Font) return Frame_Type;
procedure Close (Frame : in Frame_Type);
function Valid (Frame : Frame_Type) return Boolean;
function Frame_Width return Natural;
function Frame_Height return Natural;
function Next_Command return Command_Type;
function Command_Ready return Boolean;
----------------------------------------------------------------------------
--
-- D I A L O G S
--
-- A dialog is a top level window like a frame, but it only has a close
-- button on its title bar. Dialogs are intended for user interaction.
-- When a dialog is executed it becomes visible and all other windows
-- are disabled. Execution of a dialog continues until a command is
-- generated by closing the dialog window or by clicking on a button
-- attached to the dialog. Dialog windows do not have a menu bar.
--
-- Dialog operations:
--
-- Dialog (Width, -- create a dialog with the given width and
-- Height, -- and height in pixels,
-- Title, -- with the specified title in the title bar,
-- Command, -- generating this command when it is closed,
-- Font) -- using this font (default: Default_Font).
--
-- Execute (Dialog) -- execute a dialog and return the command code
-- -- used to exit from it.
--
-- Dialog_Width -- return the width of the dialog border.
-- Dialog_Height -- return the height of the dialog border.
--
----------------------------------------------------------------------------
function Dialog (Width : Positive;
Height : Positive;
Title : String;
Command : Command_Type;
Font : Font_Type := Default_Font) return Dialog_Type;
function Execute (Dialog : in Dialog_Type) return Command_Type;
function Dialog_Width return Natural;
function Dialog_Height return Natural;
----------------------------------------------------------------------------
--
-- P A N E L S
--
--
-- Panel operations:
--
-- Panel (Parent, -- create a panel inside a parent container, with
-- Origin, -- top left coordinates relative to the parent,
-- Width, -- with the specified width
-- Height, -- and the specified height, and
-- Title, -- with this title on the border (default: none)
-- Font) -- using this font (default: same as Parent).
--
----------------------------------------------------------------------------
function Panel (Parent : Container_Type'Class;
Origin : Point_Type;
Width : Integer;
Height : Integer;
Title : String := "";
Font : Font_Type := Parent_Font) return Panel_Type;
----------------------------------------------------------------------------
--
-- M E N U S
--
-- A menu is a pull-down list of items attached to a frame's menu bar.
-- The items on a menu are either menuitems (which generate a command
-- when they are selected, submenus (which display another menu when
-- selected) or separators (horizontal bars used to separate a menu
-- into subsections.
--
-- If the text label for a menu contains the character "&", the character
-- which follows is underlined and the menu can be activated by pressing
-- Alt + that character. The character "&" is not displayed.
--
-- Menu operations:
--
-- Menu (Parent, -- create a menu attached to a frame or a menu
-- Text) -- with the specified text label.
--
-- Menu_Height -- return the height of a menu bar.
--
----------------------------------------------------------------------------
function Menu (Parent : Frame_Type'Class;
Text : String) return Menu_Type;
function Menu (Parent : Menu_Type'Class;
Text : String) return Menu_Type;
function Menu_Height return Natural;
----------------------------------------------------------------------------
--
-- C O N T R O L S
--
-- Controls are windows for user interaction. They hold values (e.g. a
-- text string) which can normally be set by the user, as well as being
-- accessed and altered by the program itself. Some controls (e.g. menu
-- items) generate command values which can be used to trigger actions
-- in the program. The following operations are common to all controls:
--
-- Enable (Control, -- enable or disable the control depending on
-- Enabled) -- the value of Enabled (default: True).
-- Disable (Control) -- disable the control.
-- Enabled (Control) -- test if the control is enabled.
--
----------------------------------------------------------------------------
procedure Enable (Control : in Control_Type;
Enabled : in Boolean := True);
procedure Disable (Control : in Control_Type);
function Enabled (Control : Control_Type) return Boolean;
----------------------------------------------------------------------------
--
-- The types of control available are as follows:
--
-- Menuitem_Type : controls which can appear on pull-down menus
-- Text_Control_Type : controls containing with a single-line text string
-- Multiline_Type : controls containing multiple text strings
-- Canvas_Type : a plain window for drawing arbitrary shapes on
--
----------------------------------------------------------------------------
type Text_Control_Type is abstract new Control_Type with private;
type Multiline_Type is abstract new Control_Type with private;
type Canvas_Type is new Control_Type with private;
----------------------------------------------------------------------------
--
-- T E X T C O N T R O L S
--
-- Text controls include a single-line text string. The following
-- operations are common to all text controls:
--
-- Get_Length (Control) -- get the length of the text associated with the
-- -- control.
-- Get_Text (Control) -- get the text associated with the control as a
-- -- string of indefinite size.
-- Get_Text (Control, -- get the text associated with the control into
-- Text, -- this fixed-size string variable
-- Length) -- and set this integer variable to the actual
-- -- number of characters copied.
-- Set_Text (Control, -- set the text associated with the control.
-- Text) -- to the specified new text value.
--
----------------------------------------------------------------------------
function Get_Length (Control : Text_Control_Type) return Natural;
function Get_Text (Control : Text_Control_Type) return String;
procedure Get_Text (Control : in Text_Control_Type;
Text : out String;
Length : out Natural);
procedure Set_Text (Control : in Text_Control_Type;
Text : in String);
----------------------------------------------------------------------------
--
-- The types of text control available are as follows:
--
-- Button_Type : a pushbutton which generates a command code.
-- Label_Type : a static non-interactive label.
-- Editbox_Type : a single-line edit control for text input.
--
-- There is a further subclass of text control, as follows:
--
-- Boolean_Control_Type : a text control with an associated Boolean state
--
----------------------------------------------------------------------------
type Button_Type is new Text_Control_Type with private;
type Label_Type is new Text_Control_Type with private;
type Editbox_Type is new Text_Control_Type with private;
type Boolean_Control_Type is abstract new Text_Control_Type with private;
----------------------------------------------------------------------------
--
-- B U T T O N S
--
-- Buttons are rectangular labelled controls which generate a command
-- code when pressed. "Default" buttons are displayed with a heavier
-- border and respond when the Enter key is pressed.
--
-- Button operations:
--
-- Button (Parent, -- create a button in a parent container, with
-- Origin, -- top left coordinates relative to the parent,
-- Width, -- with the specified width
-- Height, -- and the specified height,
-- Text, -- labelled with the specified text,
-- Command, -- generating this command when it is pressed,
-- Default, -- set up as a "default" button (default: False),
-- Font) -- using this font (default: same as Parent).
--
----------------------------------------------------------------------------
function Button (Parent : Container_Type'Class;
Origin : Point_Type;
Width : Integer;
Height : Integer;
Text : String;
Command : Command_Type;
Default : Boolean := False;
Font : Font_Type := Parent_Font) return Button_Type;
----------------------------------------------------------------------------
--
-- L A B E L S
--
-- A label is a static text control that can be used to label other
-- controls. Labels do not respond to user interaction, but their
-- values can be read and altered by the program in the same way as
-- any other text control.
--
-- Label operations:
--
-- Label (Parent, -- create a label inside a container, with
-- Origin, -- top left coordinates relative to the parent,
-- Width, -- with the specified width
-- Height, -- and the specified height, and
-- Text, -- labelled with the specified text
-- Align, -- aligned left, right or centre (default: Left),
-- Font) -- using this font (default: same as Parent).
--
----------------------------------------------------------------------------
function Label (Parent : Container_Type'Class;
Origin : Point_Type;
Width : Integer;
Height : Integer;
Text : String;
Align : Alignment_Type := Left;
Font : Font_Type := Parent_Font) return Label_Type;
----------------------------------------------------------------------------
--
-- E D I T B O X E S
--
-- An editbox is a text control containing a single line of text whose
-- value can be edited by the user.
--
-- Editbox operations:
--
-- Editbox (Parent, -- create an editbox inside a container, with
-- Origin, -- top left coordinates relative to the parent,
-- Width, -- with the specified width
-- Height, -- and the specified height, and
-- Text, -- initialised with the specified text,
-- Password, -- optionally set up as a password editbox,
-- Font) -- using this font (default: same as Parent).
--
-- Modified (Editbox) -- test if the editbox has been modified by the
-- -- user.
--
----------------------------------------------------------------------------
function Editbox (Parent : Container_Type'Class;
Origin : Point_Type;
Width : Integer;
Height : Integer;
Text : String := "";
Password : Boolean := False;
Font : Font_Type := Parent_Font) return Editbox_Type;
function Modified (Editbox : Editbox_Type) return Boolean;
----------------------------------------------------------------------------
--
-- B O O L E A N C O N T R O L S
--
-- Boolean controls are text controls which can be toggled between two
-- states (checked or unchecked). The following operations are common
-- to all Boolean controls:
--
-- Get_State (Control) -- get the current state of the control
-- Set_State (Control, -- set the current state of the control
-- State) -- to the specified value
--
----------------------------------------------------------------------------
function Get_State (Control : Boolean_Control_Type) return Boolean;
procedure Set_State (Control : in Boolean_Control_Type;
State : in Boolean);
----------------------------------------------------------------------------
--
-- The types of Boolean controls available are as follows:
--
-- Checkbox_Type : a checkbox which can be checked or unchecked.
-- Radiobutton_Type : a radio button which can be checked or unchecked.
--
----------------------------------------------------------------------------
type Menuitem_Type is new Boolean_Control_Type with private;
type Checkbox_Type is new Boolean_Control_Type with private;
type Radiobutton_Type is new Boolean_Control_Type with private;
----------------------------------------------------------------------------
--
-- M E N U I T E M S
--
-- Menu items can only be attached to menus. When a menu is clicked, a
-- pull-down menu appears which can consist of menu items (which generate
-- a command when clicked) or further menus.
--
-- Each menu and menu item has a text label in which the character "&"
-- is treated specially. "&" will not be displayed, but the following
-- character (e.g. 'X') will be underlined to indicate that it can be
-- selected by pressing Alt + 'X' when the menu is visible.
--
-- Menuitem operations:
--
-- Menuitem (Parent, -- create a menu item attached to a parent menu
-- Text, -- with this text label,
-- Command) -- generating this command code when selected
--
-- Separator (Parent) -- create a separator (an inactive horizontal
-- -- bar) attached to a parent menu
--
----------------------------------------------------------------------------
function Menuitem (Parent : Menu_Type'Class;
Text : String;
Command : Command_Type) return Menuitem_Type;
function Separator (Parent : Menu_Type'Class) return Menuitem_Type;
----------------------------------------------------------------------------
-- Menu items behave slightly differently to other controls, so the
-- following operations are overridden:
--
procedure Enable (Control : in Menuitem_Type;
Enabled : in Boolean := True);
function Enabled (Control : Menuitem_Type) return Boolean;
function Get_Length (Control : Menuitem_Type) return Natural;
function Get_Text (Control : Menuitem_Type) return String;
procedure Set_Text (Control : in Menuitem_Type;
Text : in String);
function Get_State (Control : Menuitem_Type) return Boolean;
procedure Set_State (Control : in Menuitem_Type;
State : in Boolean);
----------------------------------------------------------------------------
--
-- C H E C K B O X E S
--
-- A checkbox is a labelled control with a left-aligned box that can be
-- checked or unchecked. Clicking on a checkbox (or pressing Space when
-- it is selected) toggles the checkbox between the checked and unchecked
-- states.
--
-- Checkbox operations:
--
-- Checkbox (Parent, -- create a checkbox in a container, with
-- Origin, -- top left coordinates relative to the parent,
-- Width, -- with the specified width
-- Height, -- and the specified height, and
-- Text, -- labelled with the specified text, and
-- Checked, -- set to this initial state (default: False),
-- Font) -- using this font (default: same as Parent).
--
----------------------------------------------------------------------------
function Checkbox (Parent : Container_Type'Class;
Origin : Point_Type;
Width : Integer;
Height : Integer;
Text : String;
Checked : Boolean := False;
Font : Font_Type := Parent_Font) return Checkbox_Type;
----------------------------------------------------------------------------
--
-- R A D I O B U T T O N S
--
-- A radiobutton is a Boolean control with a left-aligned box that can be
-- checked or unchecked. Radiobuttons attached to the same container form
-- a group. Clicking on an unchecked radiobutton will set the radiobutton
-- to the checked state and will also uncheck the other radiobuttons which
-- belong to the same group (i.e. which are attached to the same container).
-- Unlike a checkbox, a radiobutton cannot be turned off by clicking on it;
-- you can only uncheck a radiobutton by checking another one in the same
-- group.
--
-- Radiobutton operations:
--
-- Radiobutton (Parent, -- create a radiobutton in a container, with
-- Origin, -- top left coordinates relative to the parent,
-- Width, -- with the specified width
-- Height, -- and the specified height, and
-- Text, -- labelled with the specified text, and
-- Checked, -- set to this initial state (default: False),
-- Font) -- using this font (default: Default_Font).
--
----------------------------------------------------------------------------
function Radiobutton (Parent : Container_Type'Class;
Origin : Point_Type;
Width : Integer;
Height : Integer;
Text : String;
Checked : Boolean := False;
Font : Font_Type := Parent_Font)
return Radiobutton_Type;
----------------------------------------------------------------------------
--
-- M U L T I L I N E C O N T R O L S
--
-- Multiline controls contain multiple lines of text numbered from 1
-- upwards. Individual lines can be accessed by specifying a line
-- number. The user can select a particular line by clicking on it
-- with the mouse or using the keyboard arrow keys when the control
-- is selected. Specifying the line number to access as 0 will access
-- the currently selected line. If no line is selected, the current
-- line number will be reported as 0 but its contents can still be
-- accessed . A Constraint_Error will be raised if an attempt is made
-- to access a line beyond the last one.
--
-- The following operations are common to all multiline controls, but
-- their precise effects vary slightly according to the actual type of
-- the control (see below):
--
-- Get_Count (Control) -- get the number of lines of text in the control.
-- Get_Line (Control) -- get the number of the currently selected line.
-- Get_Length (Control, -- get the length of the specified line
-- Line) -- (default: current line).
-- Get_Text (Control, -- get the text of the specified line as a string
-- Line) -- of indefinite length (default: current line).
--
-- Get_Text (Control, -- get the text of the control
-- Line, -- from the specified line (default: current line)
-- Text, -- into a fixed-size string variable, together
-- Length) -- with the number of characters transferred.
-- Set_Text (Control, -- set the text of the control
-- Line, -- at the specified line
-- Text) -- to the specified value.
--
-- Select_Line (Control, -- select the line at the specified line number
-- Line) -- (default: 0, meaning deselect).
-- Append_Line (Control, -- append a line to the end of the control, where
-- Text) -- this is the text to append.
-- Insert_Line (Control, -- insert a new line above the specified
-- Line, -- line number, where
-- Text) -- this is the text to insert.
-- Delete_Line (Control, -- delete the specified line.
-- Line)
-- Delete_All (Control) -- delete all lines.
--
----------------------------------------------------------------------------
function Get_Count (Control : Multiline_Type) return Natural is abstract;
function Get_Line (Control : Multiline_Type) return Natural is abstract;
function Get_Length (Control : Multiline_Type;
Line : Natural := 0) return Natural is abstract;
function Get_Text (Control : Multiline_Type;
Line : Natural := 0) return String is abstract;
procedure Get_Text (Control : in Multiline_Type;
Line : in Natural := 0;
Text : out String;
Length : out Natural);
procedure Set_Text (Control : in Multiline_Type;
Text : in String;
Line : in Natural := 0) is abstract;
procedure Select_Line (Control : in Multiline_Type;
Line : in Natural := 0) is abstract;
procedure Append_Line (Control : in Multiline_Type;
Text : in String) is abstract;
procedure Insert_Line (Control : in Multiline_Type;
Text : in String;
Line : in Natural := 0) is abstract;
procedure Delete_Line (Control : in Multiline_Type;
Line : in Natural := 0) is abstract;
procedure Delete_All (Control : in Multiline_Type) is abstract;
----------------------------------------------------------------------------
--
-- The types of multiline controls available are as follows:
--
-- Listbox_Type : a list of text items in a scrollable window
-- Combobox_Type : an editbox in combination with a drop-down list box
-- Memo_Type : a multi-line text editor
--
----------------------------------------------------------------------------
type Listbox_Type is new Multiline_Type with private;
type Combobox_Type is new Multiline_Type with private;
type Memo_Type is new Multiline_Type with private;
----------------------------------------------------------------------------
--
-- L I S T B O X E S
--
-- A listbox is a list of lines of text (initially empty). The lines are
-- sorted into ascending order by default, but can be left unsorted if
-- required. For a sorted list, the position at which a new line is added
-- will be ignored, with the new line being inserted at the appropriate
-- position according to its value. When no line has been selected, the
-- contents of the current line will be reported as an empty string ("").
--
-- Listbox operations:
--
-- Listbox (Parent, -- create a listbox inside a container, with
-- Origin, -- top left coordinates relative to the parent,
-- Width, -- the specified width
-- Height, -- and the specified height, using
-- Font) -- this font (default: same as Parent).
--
----------------------------------------------------------------------------
function Listbox (Parent : Container_Type'Class;
Origin : Point_Type;
Width : Integer;
Height : Integer;
Font : Font_Type := Parent_Font) return Listbox_Type;
----------------------------------------------------------------------------
--
-- C O M B O B O X E S
--
-- A combobox consists of an edit control together with a drop-down list
-- (effectively a combination of an editbox and a listbox). The currently
-- selected line is displayed in the edit control, and you can specify
-- whether the user is able to manually edit this value. If not, only
-- the values in the drop-down list can be selected.
--
-- If the contents of the edit control match one of the values in the list,
-- the position of the corresponding line in the list is reported as the
-- number of the currently selected line. Otherwise, the number of the
-- current line is reported as 0. Accessing the value of the current line
-- (line 0) will report the current value of the edit control.
--
-- Combobox operations:
--
-- Combobox (Parent, -- create a combobox inside a container, with
-- Origin, -- top left coordinates relative to the parent,
-- Width, -- with the specified width, whose value can
-- Editable, -- be manually edited (default: True),
-- Font) -- using this font (default: same as Parent).
--
----------------------------------------------------------------------------
function Combobox (Parent : Container_Type'Class;
Origin : Point_Type;
Width : Integer;
Editable : Boolean := True;
Font : Font_Type := Parent_Font) return Combobox_Type;
----------------------------------------------------------------------------
--
-- M E M O S
--
-- A memo is a simple multi-line text editor similar to Windows Notepad.
-- There are several memo-specific operations in addition to the standard
-- operations on multi-line controls. The user can select a block of text
-- spanning multiple lines using the mouse (or by moving the cursor with
-- the Shift key held down) and there are operations to fetch, replace
-- and delete the selected text, find the line and column position of
-- the start and end of the selected text, and get its total length (which
-- will include one or more additional end-of-line characters if the text
-- spans more than one line).
--
-- Memo operations:
--
-- Memo (Parent, -- create a memo inside a container, with
-- Origin, -- top left coordinates relative to the parent,
-- Width, -- the specified width
-- Height) -- and the specified height
-- Font) -- using this font (default: same as Parent).
--
-- Get_Column (Memo) -- get the column position of the current
-- -- selection.
-- Modified (Memo) -- test if the user has modified the memo.
-- Cut_Selection (Memo) -- cut the current selection to the clipboard.
-- Copy_Selection (Memo) -- copy the current selection to the clipboard.
-- Paste_Selection (Memo) -- paste the clipboard contents to the memo,
-- -- replacing the current selection.
-- Undo_Change (Memo) -- undo the user's last change to the memo.
-- Show_Selection (Memo) -- scroll the memo so that the current position
-- -- is visible on the screen.
--
----------------------------------------------------------------------------
function Memo (Parent : Container_Type'Class;
Origin : Point_Type;
Width : Integer;
Height : Integer;
Font : Font_Type := Parent_Font) return Memo_Type;
function Get_Column (Memo : Memo_Type) return Natural;
function Modified (Memo : Memo_Type) return Boolean;
procedure Cut_Selection (Memo : in Memo_Type);
procedure Copy_Selection (Memo : in Memo_Type);
procedure Paste_Selection (Memo : in Memo_Type);
procedure Undo_Change (Memo : in Memo_Type);
procedure Show_Selection (Memo : in Memo_Type);
----------------------------------------------------------------------------
-- Most operations on multiline types are implemented in different ways,
-- so they are overridden here:
--
function Get_Count (Control : Listbox_Type) return Natural;
function Get_Count (Control : Combobox_Type) return Natural;
function Get_Count (Control : Memo_Type) return Natural;
function Get_Line (Control : Listbox_Type) return Natural;
function Get_Line (Control : Combobox_Type) return Natural;
function Get_Line (Control : Memo_Type) return Natural;
function Get_Length (Control : Listbox_Type;
Line : Natural := 0) return Natural;
function Get_Length (Control : Combobox_Type;
Line : Natural := 0) return Natural;
function Get_Length (Control : Memo_Type;
Line : Natural := 0) return Natural;
function Get_Text (Control : Listbox_Type;
Line : Natural := 0) return String;
function Get_Text (Control : Combobox_Type;
Line : Natural := 0) return String;
function Get_Text (Control : Memo_Type;
Line : Natural := 0) return String;
procedure Set_Text (Control : in Listbox_Type;
Text : in String;
Line : in Natural := 0);
procedure Set_Text (Control : in Combobox_Type;
Text : in String;
Line : in Natural := 0);
procedure Set_Text (Control : in Memo_Type;
Text : in String;
Line : in Natural := 0);
procedure Select_Line (Control : in Listbox_Type;
Line : in Natural := 0);
procedure Select_Line (Control : in Combobox_Type;
Line : in Natural := 0);
procedure Select_Line (Control : in Memo_Type;
Line : in Natural := 0);
procedure Append_Line (Control : in Listbox_Type;
Text : in String);
procedure Append_Line (Control : in Combobox_Type;
Text : in String);
procedure Append_Line (Control : in Memo_Type;
Text : in String);
procedure Insert_Line (Control : in Listbox_Type;
Text : in String;
Line : in Natural := 0);
procedure Insert_Line (Control : in Combobox_Type;
Text : in String;
Line : in Natural := 0);
procedure Insert_Line (Control : in Memo_Type;
Text : in String;
Line : in Natural := 0);
procedure Delete_Line (Control : in Listbox_Type;
Line : in Natural := 0);
procedure Delete_Line (Control : in Combobox_Type;
Line : in Natural := 0);
procedure Delete_Line (Control : in Memo_Type;
Line : in Natural:= 0);
procedure Delete_All (Control : in Listbox_Type);
procedure Delete_All (Control : in Combobox_Type);
procedure Delete_All (Control : in Memo_Type);
----------------------------------------------------------------------------
--
-- C A N V A S E S
--
-- A canvas is a blank rectangle for drawing on which can optionally
-- be set to generate a command code when the mouse is clicked on it.
-- A canvas has an associated font (the same as the parent window by
-- default), a background colour (initially white), a pen for drawing
-- lines (initially black, one pixel wide) and a fill colour used to
-- colour closed shapes (initially white).
--
-- The freedom of expression available with canvases make these the
-- most complex component of all, with over 20 available operations.
-- There are operations to draw lines, rectangles (with or without
-- rounded corners), ellipses, circles, line sequences, polygons and
-- text. The font, pen size and colour and fill colour can be changed
-- at any time any will affect all subsequent drawing operations (but
-- everything drawn previously will be unaffected). Rectangles can be
-- given rounded corners by specifying a rounding factor, which gives
-- the X and Y offsets from the corners to the points where the rounded
-- corner begins.
--
-- Anything drawn on a canvas will normally stay there, but the canvas
-- can be erased or the current state of a drawing can be saved and then
-- restored later (which provides a basic "undo" facility). For example,
-- a clock can be drawn by drawing a circle, saving the drawing, and then
-- drawing the hands. To change the position of the hands, restore the
-- saved drawing (thus erasing the hands) and then redraw the hands in
-- the new position. You can only save one copy of the drawing, so if you
-- save it a second time you will lose the previous saved copy.
--
-- A canvas can be set up to generate a command when the mouse button
-- is pressed inside its borders. There are operations to get the
-- position at which the button was pressed, to get the current mouse
-- position, and to test if the mouse button is still down and whether
-- the mouse has been moved. As long as the button is down, the mouse
-- position will be tracked even if the mouse is moved outside the canvas.
-- You can track the mouse visually by saving the drawing when the mouse
-- is first pressed, then restoring the drawing and drawing a new line
-- from the initial mouse position to the current one.
--
-- Canvas operations:
--
-- Canvas (Parent, -- create a canvas inside a container, with
-- Origin, -- top left coordinates relative to Parent,
-- Width, -- the specified width
-- Height, -- and the specified height, using
-- Font) -- this font (default: same as Parent).
--
-- Canvas (Parent, -- create a canvas inside a container, with
-- Origin, -- top left coordinates relative to the parent,
-- Width, -- the specified width
-- Height, -- and the specified height,
-- Command, -- which generates this command code, and
-- Font) -- uses this font (default: same as Parent).
--
-- Canvas (Parent, -- create a canvas inside a container, with
-- Origin, -- top left coordinates relative to the parent,
-- Width, -- the specified width
-- Height, -- and the specified height,
-- Command, -- which generates this command code, and
-- Keypress, -- this one when a key is pressed, and
-- Font) -- uses this font (default: same as Parent).
--
-- Set_Colour (Canvas, -- set the background colour for a canvas
-- Colour) -- using this colour (default: white)
--
-- Erase (Canvas) -- erase the drawing in a canvas. This will
-- -- also erase any saved drawing.
-- Save (Canvas) -- save the current drawing.
-- Restore (Canvas) -- restore a saved drawing, erasing anything
-- -- drawn since. If the drawing has never been
-- -- saved, or the window has been erased using
-- -- Erase, this will do nothing.
-- Set_Font (Canvas, -- set a new font for all subsequent text
-- Font) -- drawn on the canvas.
-- Set_Pen (Canvas, -- set the pen used to draw lines on the
-- Colour, -- canvas to this colour (default: black)
-- Width) -- and thickness (default: 1 pixel).
-- Set_Fill (Canvas, -- set the colour used to fill subsequent
-- Colour) -- closed shapes drawn on the canvas.
-- Set_Fill (Canvas) -- clear the colour used to fill subsequent
-- -- closed shapes drawn on the canvas.
-- Draw_Text (Canvas, -- draw a text string on the canvas
-- From, -- from this top-left point, where
-- Text) -- this is the text to be drawn.
-- Draw_Text (Canvas, -- draw a text string on the canvas
-- From, -- in a rectangle between this point
-- To, -- and this one, where
-- Text, -- this is the text to be drawn
-- Align) -- with this alignment (default: left).
-- Draw_Text (Canvas, -- draw a text string on the canvas
-- From, -- in a rectangle starting at this point
-- Width, -- with this width
-- Height, -- and this height, where
-- Text, -- this is the text to be drawn
-- Align) -- with this alignment (default: left).
--
-- Draw_Line (Canvas, -- draw a line on the canvas
-- From, -- from this point
-- To) -- to this one.
-- Draw_Line (Canvas, -- draw a line on the canvas
-- From, -- from this point
-- Length, -- for this length
-- Angle) -- at this angle.
-- Draw_Line_List (Canvas, -- draw lines on the canvas connecting
-- Points) -- the points in this list.
--
-- Draw_Rectangle (Canvas, -- draw a rectangle on the canvas
-- From, -- from this corner point
-- To, -- to this diagonally-opposite point
-- Rounding) -- with corners rounded this much
-- -- (default: no rounding).
-- Draw_Rectangle (Canvas, -- draw a rectangle on the canvas
-- From, -- from this top-left point
-- Width, -- with this width
-- Height, -- and this height
-- Rounding) -- with corners rounded this much
-- -- (default: no rounding).
--
-- Draw_Ellipse (Canvas, -- draw an ellipse on the canvas
-- From, -- bounded by a rectangle from this point
-- To) -- to this point.
-- Draw_Ellipse (Canvas, -- draw an ellipse on the canvas
-- From, -- bounded by a rectangle from this point
-- Width, -- with this width.
-- Height) -- and this height
-- Draw_Circle (Canvas, -- draw a circle on the canvas
-- Centre, -- with this centre point
-- Radius) -- and this radius.
--
-- Draw_Polygon (Canvas, -- draw a polygon on the canvas
-- Points) -- with vertices at these points.
--
-- Draw_Image (Canvas, -- draw an image on the canvas
-- From, -- from this point
-- Image) -- using this image object.
-- Draw_Image (Canvas, -- draw an image on the canvas
-- From, -- from this point
-- To, -- to this one (stretching the image to fit)
-- Image) -- using this image object.
-- Draw_Image (Canvas, -- draw an image on the canvas
-- From, -- from this point
-- Width, -- with this width
-- Height, -- and this height
-- Image) -- using this image object.
--
-- Mouse_Down (Canvas) -- test if the left mouse button is down.
-- Mouse_Moved (Canvas) -- test if the mouse has been moved.
-- Start_Point (Canvas) -- get the point where the mouse button
-- -- was first pressed.
-- End_Point (Canvas) -- get the point where the mouse is now
-- -- (or its final position when the left
-- -- button was released).
-- Key_Code (Canvas) -- get the character code for the last
-- -- key pressed.
--
----------------------------------------------------------------------------
function Canvas (Parent : Container_Type'Class;
Origin : Point_Type;
Width : Integer;
Height : Integer;
Font : Font_Type := Parent_Font) return Canvas_Type;
function Canvas (Parent : Container_Type'Class;
Origin : Point_Type;
Width : Integer;
Height : Integer;
Command : Command_Type;
Font : Font_Type := Parent_Font) return Canvas_Type;
function Canvas (Parent : Container_Type'Class;
Origin : Point_Type;
Width : Integer;
Height : Integer;
Command : Command_Type;
Keypress : Command_Type;
Font : Font_Type := Parent_Font) return Canvas_Type;
procedure Set_Colour (Canvas : in Canvas_Type;
Colour : in Colour_Type := White);
procedure Erase (Canvas : in Canvas_Type);
procedure Save (Canvas : in Canvas_Type);
procedure Restore (Canvas : in Canvas_Type);
procedure Set_Font (Canvas : in Canvas_Type;
Font : in Font_Type);
procedure Set_Pen (Canvas : in Canvas_Type;
Colour : in Colour_Type := Black;
Width : in Natural := 1);
procedure Set_Fill (Canvas : in Canvas_Type;
Colour : in Colour_Type);
procedure Set_Fill (Canvas : in Canvas_Type);
procedure Draw_Text (Canvas : in Canvas_Type;
From : in Point_Type;
Text : in String);
procedure Draw_Text (Canvas : in Canvas_Type;
From : in Point_Type;
To : in Point_Type;
Text : in String;
Align : in Alignment_Type := Left);
procedure Draw_Text (Canvas : in Canvas_Type;
From : in Point_Type;
Width : in Integer;
Height : in Integer;
Text : in String;
Align : in Alignment_Type := Left);
procedure Draw_Line (Canvas : in Canvas_Type;
From : in Point_Type;
To : in Point_Type);
procedure Draw_Line (Canvas : in Canvas_Type;
From : in Point_Type;
Length : in Positive;
Angle : in Angle_Type);
procedure Draw_Line_List
(Canvas : in Canvas_Type;
Points : in Point_List);
procedure Draw_Rectangle
(Canvas : in Canvas_Type;
From : in Point_Type;
To : in Point_Type;
Rounding : in Point_Type := (0,0));
procedure Draw_Rectangle
(Canvas : in Canvas_Type;
From : in Point_Type;
Width : in Positive;
Height : in Positive;
Rounding : in Point_Type := (0,0));
procedure Draw_Ellipse
(Canvas : in Canvas_Type;
From : in Point_Type;
To : in Point_Type);
procedure Draw_Ellipse
(Canvas : in Canvas_Type;
From : in Point_Type;
Width : in Positive;
Height : in Positive);
procedure Draw_Circle
(Canvas : in Canvas_Type;
Centre : in Point_Type;
Radius : in Positive);
procedure Draw_Polygon
(Canvas : in Canvas_Type;
Points : in Point_List);
procedure Draw_Image (Canvas : in Canvas_Type;
From : in Point_Type;
Image : in Image_Type);
procedure Draw_Image (Canvas : in Canvas_Type;
From : in Point_Type;
To : in Point_Type;
Image : in Image_Type);
procedure Draw_Image (Canvas : in Canvas_Type;
From : in Point_Type;
Width : in Natural;
Height : in Natural;
Image : in Image_Type);
function Start_Point (Canvas : Canvas_Type) return Point_Type;
function End_Point (Canvas : Canvas_Type) return Point_Type;
function Mouse_Down (Canvas : Canvas_Type) return Boolean;
function Mouse_Moved (Canvas : Canvas_Type) return Boolean;
function Key_Code (Canvas : Canvas_Type) return Character;
----------------------------------------------------------------------------
--
-- C O M M O N D I A L O G S
--
-- Common dialogs are pre-packaged dialog widgets which are not treated
-- as normal windows (although they are made to look similar for ease of
-- use).
--
-- Common dialog operations (common to all dialogs):
--
-- Execute (Dialog) -- execute the dialog and return True if the OK
-- -- button was used to close the dialog and False
-- -- otherwise.
--
----------------------------------------------------------------------------
type Common_Dialog_Type is abstract tagged private;
function Execute (Dialog : Common_Dialog_Type) return Boolean;
----------------------------------------------------------------------------
--
-- C O M M O N D I A L O G S U B C L A S S E S
--
-- The available dialog subclasses are colour, font and file dialogs.
--
-- Colour_Dialog_Type : a dialog to allow the user to select a colour.
-- Font_Dialog_Type : a dialog to allow the user to select a font.
-- File_Dialog_Type : a dialog to allow the user to select a file name.
--
----------------------------------------------------------------------------
type Colour_Dialog_Type is new Common_Dialog_Type with private;
type Font_Dialog_Type is new Common_Dialog_Type with private;
type File_Dialog_Type is abstract new Common_Dialog_Type with private;
----------------------------------------------------------------------------
--
-- C O L O U R D I A L O G S
--
-- Colour dialogs allow the user to select or create a colour.
--
-- Colour dialog operations:
--
-- Colour_Dialog -- create a colour dialog.
-- Set_Colour (Dialog, -- set the initial colour displayed in the
-- Colour) -- dialog to this colour.
-- Get_Colour (Dialog) -- get the colour contained in the dialog.
--
----------------------------------------------------------------------------
function Colour_Dialog return Colour_Dialog_Type;
procedure Set_Colour (Dialog : in Colour_Dialog_Type;
Colour : in Colour_Type);
function Get_Colour (Dialog : in Colour_Dialog_Type) return Colour_Type;
----------------------------------------------------------------------------
--
-- F O N T D I A L O G S
--
-- Font dialogs allow the user to select a font.
--
-- Font dialog operations:
--
-- Font_Dialog -- create a font dialog.
-- Set_Font (Dialog, -- set the initial font displayed in the
-- Font) -- dialog to this font.
-- Get_Font (Dialog) -- get the font contained in the dialog.
--
----------------------------------------------------------------------------
function Font_Dialog return Font_Dialog_Type;
procedure Set_Font (Dialog : in Font_Dialog_Type;
Font : in Font_Type);
function Get_Font (Dialog : in Font_Dialog_Type) return Font_Type;
----------------------------------------------------------------------------
--
-- F I L E D I A L O G S
--
-- File dialogs allow the user to select or enter a file name. This is an
-- abstract type which is further subclassed below.
--
-- File dialog operations (common to all file dialogs):
--
-- Set_Name (Dialog, -- set the initial file name displayed in the
-- Name) -- dialog to this string.
-- Get_Name (Dialog) -- get the file name contained in the dialog.
-- Add_Filter (Dialog, -- add a file type filter to the dialog
-- Text, -- with this description
-- Filter) -- to match this wildcard specification.
-- Set_Directory (Dialog, -- set the initial directory for the dialog
-- Name) -- to this directory.
--
----------------------------------------------------------------------------
procedure Set_Name (Dialog : in File_Dialog_Type;
Name : in String);
function Get_Name (Dialog : in File_Dialog_Type) return String;
procedure Add_Filter (Dialog : in File_Dialog_Type;
Text : in String;
Filter : in String);
procedure Set_Directory (Dialog : in File_Dialog_Type;
Name : in String);
----------------------------------------------------------------------------
--
-- O P E N D I A L O G S
--
-- Open dialogs allow the user to select or enter a file name for use as
-- an input file. The file name selected must be the name of an existing
-- file.
--
-- Open dialog operations:
--
-- Open_Dialog (Title) -- create an open file dialog with this title.
--
----------------------------------------------------------------------------
type Open_Dialog_Type is new File_Dialog_Type with private;
function Open_Dialog (Title : String) return Open_Dialog_Type;
----------------------------------------------------------------------------
--
-- S A V E D I A L O G S
--
-- Save dialogs allow the user to select or enter a file name for use as
-- an output file. If the Create parameter to the constructor function
-- below is True (as it is by default) and an existing file is selected,
-- the user will be asked if the file should be overwritten. If it is
-- False and the file does not exist, the user will be asked if it should
-- be created.
--
-- Save dialog operations:
--
-- Save_Dialog (Title, -- create a save file dialog with this title
-- Create) -- which will prompt the user as described above.
--
----------------------------------------------------------------------------
type Save_Dialog_Type is new File_Dialog_Type with private;
function Save_Dialog (Title : String;
Create : Boolean := True) return Save_Dialog_Type;
----------------------------------------------------------------------------
-- Renamings for our transatlantic cousins, in the hope that some day
-- they'll repay the favour/favor...
----------------------------------------------------------------------------
procedure Set_Color (Canvas : in Canvas_Type;
Colour : in Colour_Type := White) renames Set_Colour;
subtype Color_Dialog_Type is Colour_Dialog_Type;
function Color_Dialog return Colour_Dialog_Type renames Colour_Dialog;
procedure Set_Color (Dialog : in Colour_Dialog_Type;
Colour : in Colour_Type) renames Set_Colour;
function Get_Color (Dialog : in Colour_Dialog_Type) return Colour_Type
renames Get_Colour;
private -- and deliberately uninformative!
type Window_Type is abstract tagged
record
Internals : JEWL.Controlled_Type; -- see package JEWL
end record;
type Container_Type is abstract new Window_Type with null record;
type Control_Type is abstract new Window_Type with null record;
type Frame_Type is new Container_Type with null record;
type Dialog_Type is new Container_Type with null record;
type Panel_Type is new Container_Type with null record;
type Menu_Type is new Container_Type with null record;
type Text_Control_Type is abstract new Control_Type with null record;
type Multiline_Type is abstract new Control_Type with null record;
type Canvas_Type is new Control_Type with null record;
type Button_Type is new Text_Control_Type with null record;
type Label_Type is new Text_Control_Type with null record;
type Editbox_Type is new Text_Control_Type with null record;
type Boolean_Control_Type is abstract new Text_Control_Type with null record;
type Menuitem_Type is new Boolean_Control_Type with null record;
type Checkbox_Type is new Boolean_Control_Type with null record;
type Radiobutton_Type is new Boolean_Control_Type with null record;
type Listbox_Type is new Multiline_Type with null record;
type Combobox_Type is new Multiline_Type with null record;
type Memo_Type is new Multiline_Type with null record;
type Common_Dialog_Type is abstract tagged
record
Internals : JEWL.Controlled_Type; -- see package JEWL
end record;
type Colour_Dialog_Type is new Common_Dialog_Type with null record;
type Font_Dialog_Type is new Common_Dialog_Type with null record;
type File_Dialog_Type is abstract new Common_Dialog_Type with null record;
type Open_Dialog_Type is new File_Dialog_Type with null record;
type Save_Dialog_Type is new File_Dialog_Type with null record;
type Image_Type is
record
Internals : JEWL.Controlled_Type; -- see package JEWL
end record;
end JEWL.Windows;
| 48.805573 | 82 | 0.512172 |
cb868e161444b2857e9f8fc6eb6e200e915c2538 | 23,495 | adb | Ada | sources/acme.adb | reznikmm/acme-ada | 5581c25d7f9194ed75eb60eb5a21714e02d5a615 | [
"MIT"
] | 3 | 2020-06-21T22:55:01.000Z | 2021-11-30T21:41:38.000Z | sources/acme.adb | reznikmm/acme-ada | 5581c25d7f9194ed75eb60eb5a21714e02d5a615 | [
"MIT"
] | null | null | null | sources/acme.adb | reznikmm/acme-ada | 5581c25d7f9194ed75eb60eb5a21714e02d5a615 | [
"MIT"
] | null | null | null | -- SPDX-FileCopyrightText: 2020 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
----------------------------------------------------------------
with Ada.Text_IO;
with Ada.Wide_Wide_Text_IO;
with GNAT.SHA256;
with AWS.Client;
with AWS.Default;
with AWS.Messages;
with AWS.Response;
with JWS;
with JWS.RS256; pragma Unreferenced (JWS.RS256); -- Enable RS256
with JWS.To_Base_64_URL;
with League.Calendars.ISO_8601;
with League.JSON.Arrays;
with League.JSON.Documents;
with League.JSON.Values;
package body ACME is
function "+" (V : Wide_Wide_String) return League.Strings.Universal_String
renames League.Strings.To_Universal_String;
function "-" (V : Wide_Wide_String) return League.JSON.Values.JSON_Value
is (League.JSON.Values.To_JSON_Value (+V));
function "-" (V : League.Strings.Universal_String)
return League.JSON.Values.JSON_Value
is (League.JSON.Values.To_JSON_Value (V));
User_Agent : constant String := AWS.Default.User_Agent &
" acme-ada 0.0.1";
procedure Get_Nonce
(Self : in out Context'Class;
Nonce : out League.Strings.Universal_String);
------------------------
-- Challenge_Complete --
------------------------
procedure Challenge_Complete
(Self : in out Context'Class;
Account_URL : League.Strings.Universal_String;
Private_Key : League.Stream_Element_Vectors.Stream_Element_Vector;
Challenge : ACME.Challenge)
is
URL : constant League.Strings.Universal_String := Challenge.URL;
Nonce : League.Strings.Universal_String;
JWT : JWS.JSON_Web_Signature;
Header : JWS.JOSE_Header;
Result : AWS.Response.Data;
begin
Self.Get_Nonce (Nonce);
Ada.Wide_Wide_Text_IO.Put ("Nonce=");
Ada.Wide_Wide_Text_IO.Put_Line (Nonce.To_Wide_Wide_String);
Header.Set_Algorithm (+"RS256");
Header.Insert (+"nonce", -Nonce);
Header.Insert (+"url", -URL);
Header.Insert (+"kid", -Account_URL);
JWT.Create
(Header => Header,
Payload => League.JSON.Objects.Empty_JSON_Object.
To_JSON_Document.To_JSON.To_Stream_Element_Array,
Secret => Private_Key.To_Stream_Element_Array);
Ada.Wide_Wide_Text_IO.Put_Line
(JWT.Flattened_Serialization.
To_JSON_Document.To_JSON.To_Wide_Wide_String);
Result := AWS.Client.Post
(URL => URL.To_UTF_8_String,
Data => JWT.Flattened_Serialization.
To_JSON_Document.To_JSON.To_UTF_8_String,
Content_Type => "application/jose+json",
User_Agent => User_Agent);
Ada.Text_IO.Put_Line (AWS.Response.Status_Code (Result)'Img);
Ada.Text_IO.Put_Line
(AWS.Response.Message_Body (Result));
pragma Assert
(AWS.Response.Status_Code (Result) in AWS.Messages.Success);
if AWS.Response.Has_Header (Result, "Replay-Nonce") then
Self.Nonce := League.Strings.From_UTF_8_String
(AWS.Response.Header (Result, "Replay-Nonce", 1));
end if;
end Challenge_Complete;
----------------------
-- Challenge_Status --
----------------------
procedure Challenge_Status
(Self : in out Context'Class;
Account_URL : League.Strings.Universal_String;
Private_Key : League.Stream_Element_Vectors.Stream_Element_Vector;
Challenge : ACME.Challenge;
Status : out League.Strings.Universal_String)
is
URL : constant League.Strings.Universal_String := Challenge.URL;
Doc : League.JSON.Documents.JSON_Document;
Nonce : League.Strings.Universal_String;
JWT : JWS.JSON_Web_Signature;
Header : JWS.JOSE_Header;
Result : AWS.Response.Data;
begin
Self.Get_Nonce (Nonce);
Ada.Wide_Wide_Text_IO.Put ("Nonce=");
Ada.Wide_Wide_Text_IO.Put_Line (Nonce.To_Wide_Wide_String);
Header.Set_Algorithm (+"RS256");
Header.Insert (+"nonce", -Nonce);
Header.Insert (+"url", -URL);
Header.Insert (+"kid", -Account_URL);
JWT.Create
(Header => Header,
Payload => (1 .. 0 => <>),
Secret => Private_Key.To_Stream_Element_Array);
Result := AWS.Client.Post
(URL => URL.To_UTF_8_String,
Data => JWT.Flattened_Serialization.
To_JSON_Document.To_JSON.To_UTF_8_String,
Content_Type => "application/jose+json",
User_Agent => User_Agent);
Ada.Text_IO.Put_Line (AWS.Response.Status_Code (Result)'Img);
Ada.Text_IO.Put_Line
(AWS.Response.Message_Body (Result));
pragma Assert
(AWS.Response.Status_Code (Result) in AWS.Messages.Success);
if AWS.Response.Has_Header (Result, "Replay-Nonce") then
Self.Nonce := League.Strings.From_UTF_8_String
(AWS.Response.Header (Result, "Replay-Nonce", 1));
end if;
Doc := League.JSON.Documents.From_JSON
(AWS.Response.Message_Body (Result));
Status := Doc.To_JSON_Object.Value (+"status").To_String;
end Challenge_Status;
--------------------
-- Create_Account --
--------------------
procedure Create_Account
(Self : in out Context'Class;
Public_Key : League.JSON.Objects.JSON_Object;
Private_Key : League.Stream_Element_Vectors.Stream_Element_Vector;
Contact : League.String_Vectors.Universal_String_Vector;
TOS_Agreed : Boolean := True;
Only_Existing : Boolean := False;
Account_URL : out League.Strings.Universal_String)
is
URL : constant League.Strings.Universal_String :=
Self.Directory.Value (+"newAccount").To_String;
Account : League.JSON.Objects.JSON_Object;
Nonce : League.Strings.Universal_String;
Meta : constant League.JSON.Objects.JSON_Object :=
Self.Directory.Value (+"meta").To_Object;
JWT : JWS.JSON_Web_Signature;
Header : JWS.JOSE_Header;
Result : AWS.Response.Data;
begin
Self.Get_Nonce (Nonce);
Ada.Wide_Wide_Text_IO.Put ("Nonce=");
Ada.Wide_Wide_Text_IO.Put_Line (Nonce.To_Wide_Wide_String);
if not Contact.Is_Empty then
declare
List : League.JSON.Arrays.JSON_Array;
begin
for J in 1 .. Contact.Length loop
List.Append (-Contact (J));
end loop;
Account.Insert (+"contact", List.To_JSON_Value);
end;
end if;
if Meta.Contains (+"termsOfService") then
Account.Insert
(+"termsOfServiceAgreed",
League.JSON.Values.To_JSON_Value (TOS_Agreed));
end if;
if Only_Existing then
Account.Insert
(+"onlyReturnExisting",
League.JSON.Values.To_JSON_Value (True));
end if;
Header.Set_Algorithm (+"RS256");
Header.Insert (+"nonce", -Nonce);
Header.Insert (+"url", -URL);
Header.Insert (+"jwk", Public_Key.To_JSON_Value);
JWT.Create
(Header => Header,
Payload => Account.To_JSON_Document.To_JSON.To_Stream_Element_Array,
Secret => Private_Key.To_Stream_Element_Array);
Result := AWS.Client.Post
(URL => URL.To_UTF_8_String,
Data => JWT.Flattened_Serialization.
To_JSON_Document.To_JSON.To_UTF_8_String,
Content_Type => "application/jose+json",
User_Agent => User_Agent);
Ada.Text_IO.Put_Line (AWS.Response.Status_Code (Result)'Img);
Ada.Text_IO.Put_Line
(AWS.Response.Message_Body (Result));
pragma Assert
(AWS.Response.Status_Code (Result) in AWS.Messages.Success);
Account_URL := League.Strings.From_UTF_8_String
(AWS.Response.Header (Result, "Location", 1));
if AWS.Response.Has_Header (Result, "Replay-Nonce") then
Self.Nonce := League.Strings.From_UTF_8_String
(AWS.Response.Header (Result, "Replay-Nonce", 1));
end if;
end Create_Account;
------------------
-- Create_Order --
------------------
procedure Create_Order
(Self : in out Context'Class;
Account_URL : League.Strings.Universal_String;
Private_Key : League.Stream_Element_Vectors.Stream_Element_Vector;
DNS_Id_List : League.String_Vectors.Universal_String_Vector;
Not_Before : Optional_Date_Time := (Is_Set => False);
Not_After : Optional_Date_Time := (Is_Set => False);
Auth_List : out League.String_Vectors.Universal_String_Vector;
Finalize : out League.Strings.Universal_String;
Order_URL : out League.Strings.Universal_String)
is
Format : constant League.Strings.Universal_String :=
+"yyyy-MM-ddTHH:mm:ss+04:00Z";
URL : constant League.Strings.Universal_String :=
Self.Directory.Value (+"newOrder").To_String;
Doc : League.JSON.Documents.JSON_Document;
Order : League.JSON.Objects.JSON_Object;
Nonce : League.Strings.Universal_String;
JWT : JWS.JSON_Web_Signature;
Header : JWS.JOSE_Header;
Result : AWS.Response.Data;
List : League.JSON.Arrays.JSON_Array;
begin
Self.Get_Nonce (Nonce);
Ada.Wide_Wide_Text_IO.Put ("Nonce=");
Ada.Wide_Wide_Text_IO.Put_Line (Nonce.To_Wide_Wide_String);
Header.Set_Algorithm (+"RS256");
Header.Insert (+"nonce", -Nonce);
Header.Insert (+"url", -URL);
Header.Insert (+"kid", -Account_URL);
for J in 1 .. DNS_Id_List.Length loop
declare
DNS : League.JSON.Objects.JSON_Object;
begin
DNS.Insert (+"type", -"dns");
DNS.Insert (+"value", -DNS_Id_List (J));
List.Append (DNS.To_JSON_Value);
end;
end loop;
Order.Insert (+"identifiers", List.To_JSON_Value);
if Not_Before.Is_Set then
Order.Insert
(+"notBefore",
-League.Calendars.ISO_8601.Image (Format, Not_Before.Value));
end if;
if Not_After.Is_Set then
Order.Insert
(+"notAfter",
-League.Calendars.ISO_8601.Image (Format, Not_After.Value));
end if;
JWT.Create
(Header => Header,
Payload => Order.To_JSON_Document.To_JSON.To_Stream_Element_Array,
Secret => Private_Key.To_Stream_Element_Array);
Ada.Wide_Wide_Text_IO.Put_Line
(JWT.Flattened_Serialization.
To_JSON_Document.To_JSON.To_Wide_Wide_String);
Result := AWS.Client.Post
(URL => URL.To_UTF_8_String,
Data => JWT.Flattened_Serialization.
To_JSON_Document.To_JSON.To_UTF_8_String,
Content_Type => "application/jose+json",
User_Agent => User_Agent);
Ada.Text_IO.Put_Line (AWS.Response.Status_Code (Result)'Img);
Ada.Text_IO.Put_Line
(AWS.Response.Message_Body (Result));
Doc := League.JSON.Documents.From_JSON
(AWS.Response.Message_Body (Result));
pragma Assert
(AWS.Response.Status_Code (Result) in AWS.Messages.Success);
Order := Doc.To_JSON_Object;
declare
Vector : constant League.JSON.Arrays.JSON_Array :=
Order.Value (+"authorizations").To_Array;
begin
for J in 1 .. Vector.Length loop
Auth_List.Append (Vector (J).To_String);
end loop;
end;
Finalize := Order.Value (+"finalize").To_String;
Order_URL := League.Strings.From_UTF_8_String
(AWS.Response.Header (Result, "Location", 1));
if AWS.Response.Has_Header (Result, "Replay-Nonce") then
Self.Nonce := League.Strings.From_UTF_8_String
(AWS.Response.Header (Result, "Replay-Nonce", 1));
end if;
end Create_Order;
--------------------
-- Finalize_Order --
--------------------
procedure Finalize_Order
(Self : in out Context'Class;
Account_URL : League.Strings.Universal_String;
Private_Key : League.Stream_Element_Vectors.Stream_Element_Vector;
Finalize : League.Strings.Universal_String;
CSR : League.Stream_Element_Vectors.Stream_Element_Vector)
is
URL : constant League.Strings.Universal_String := Finalize;
Object : League.JSON.Objects.JSON_Object;
Nonce : League.Strings.Universal_String;
JWT : JWS.JSON_Web_Signature;
Header : JWS.JOSE_Header;
Result : AWS.Response.Data;
begin
Self.Get_Nonce (Nonce);
Ada.Wide_Wide_Text_IO.Put ("Nonce=");
Ada.Wide_Wide_Text_IO.Put_Line (Nonce.To_Wide_Wide_String);
Header.Set_Algorithm (+"RS256");
Header.Insert (+"nonce", -Nonce);
Header.Insert (+"url", -URL);
Header.Insert (+"kid", -Account_URL);
Object.Insert (+"csr", -JWS.To_Base_64_URL (CSR));
JWT.Create
(Header => Header,
Payload => Object.To_JSON_Document.To_JSON.To_Stream_Element_Array,
Secret => Private_Key.To_Stream_Element_Array);
Ada.Wide_Wide_Text_IO.Put_Line
(JWT.Flattened_Serialization.
To_JSON_Document.To_JSON.To_Wide_Wide_String);
Result := AWS.Client.Post
(URL => URL.To_UTF_8_String,
Data => JWT.Flattened_Serialization.
To_JSON_Document.To_JSON.To_UTF_8_String,
Content_Type => "application/jose+json",
User_Agent => User_Agent);
Ada.Text_IO.Put_Line (AWS.Response.Status_Code (Result)'Img);
Ada.Text_IO.Put_Line
(AWS.Response.Message_Body (Result));
pragma Assert
(AWS.Response.Status_Code (Result) in AWS.Messages.Success);
if AWS.Response.Has_Header (Result, "Replay-Nonce") then
Self.Nonce := League.Strings.From_UTF_8_String
(AWS.Response.Header (Result, "Replay-Nonce", 1));
end if;
end Finalize_Order;
-----------------------
-- Get_Authorization --
-----------------------
procedure Get_Challenges
(Self : in out Context'Class;
Account_URL : League.Strings.Universal_String;
Private_Key : League.Stream_Element_Vectors.Stream_Element_Vector;
Auth_URL : League.Strings.Universal_String;
HTTP : out Challenge;
DNS : out Challenge)
is
URL : constant League.Strings.Universal_String := Auth_URL;
Doc : League.JSON.Documents.JSON_Document;
Auth : League.JSON.Objects.JSON_Object;
Nonce : League.Strings.Universal_String;
JWT : JWS.JSON_Web_Signature;
Header : JWS.JOSE_Header;
Result : AWS.Response.Data;
begin
Self.Get_Nonce (Nonce);
Ada.Wide_Wide_Text_IO.Put ("Nonce=");
Ada.Wide_Wide_Text_IO.Put_Line (Nonce.To_Wide_Wide_String);
Header.Set_Algorithm (+"RS256");
Header.Insert (+"nonce", -Nonce);
Header.Insert (+"url", -URL);
Header.Insert (+"kid", -Account_URL);
JWT.Create
(Header => Header,
Payload => (1 .. 0 => <>),
Secret => Private_Key.To_Stream_Element_Array);
Result := AWS.Client.Post
(URL => URL.To_UTF_8_String,
Data => JWT.Flattened_Serialization.
To_JSON_Document.To_JSON.To_UTF_8_String,
Content_Type => "application/jose+json",
User_Agent => User_Agent);
Ada.Text_IO.Put_Line (AWS.Response.Status_Code (Result)'Img);
Ada.Text_IO.Put_Line
(AWS.Response.Message_Body (Result));
pragma Assert
(AWS.Response.Status_Code (Result) in AWS.Messages.Success);
Doc := League.JSON.Documents.From_JSON
(AWS.Response.Message_Body (Result));
Auth := Doc.To_JSON_Object;
declare
Vector : constant League.JSON.Arrays.JSON_Array :=
Auth.Value (+"challenges").To_Array;
begin
for J in 1 .. Vector.Length loop
declare
use type League.Strings.Universal_String;
Item : constant League.JSON.Objects.JSON_Object :=
Vector (J).To_Object;
begin
if Item.Value (+"type").To_String = +"http-01" then
HTTP.URL := Item.Value (+"url").To_String;
HTTP.Token := Item.Value (+"token").To_String;
elsif Item.Value (+"type").To_String = +"dns-01" then
DNS.URL := Item.Value (+"url").To_String;
DNS.Token := Item.Value (+"token").To_String;
end if;
end;
end loop;
end;
if AWS.Response.Has_Header (Result, "Replay-Nonce") then
Self.Nonce := League.Strings.From_UTF_8_String
(AWS.Response.Header (Result, "Replay-Nonce", 1));
end if;
end Get_Challenges;
procedure Get_Certificate
(Self : in out Context'Class;
Account_URL : League.Strings.Universal_String;
Private_Key : League.Stream_Element_Vectors.Stream_Element_Vector;
Certificate : League.Strings.Universal_String;
Text : out League.Strings.Universal_String)
is
URL : constant League.Strings.Universal_String := Certificate;
Nonce : League.Strings.Universal_String;
JWT : JWS.JSON_Web_Signature;
Header : JWS.JOSE_Header;
Headers : AWS.Client.Header_List;
Result : AWS.Response.Data;
begin
Self.Get_Nonce (Nonce);
Header.Set_Algorithm (+"RS256");
Header.Insert (+"nonce", -Nonce);
Header.Insert (+"url", -URL);
Header.Insert (+"kid", -Account_URL);
JWT.Create
(Header => Header,
Payload => (1 .. 0 => <>),
Secret => Private_Key.To_Stream_Element_Array);
Headers.Add ("Accept", "application/pem-certificate-chain");
Result := AWS.Client.Post
(URL => URL.To_UTF_8_String,
Data => JWT.Flattened_Serialization.
To_JSON_Document.To_JSON.To_UTF_8_String,
Content_Type => "application/jose+json",
Headers => Headers,
User_Agent => User_Agent);
Ada.Text_IO.Put_Line (AWS.Response.Status_Code (Result)'Img);
Ada.Text_IO.Put_Line
(AWS.Response.Message_Body (Result));
pragma Assert
(AWS.Response.Status_Code (Result) in AWS.Messages.Success);
if AWS.Response.Has_Header (Result, "Replay-Nonce") then
Self.Nonce := League.Strings.From_UTF_8_String
(AWS.Response.Header (Result, "Replay-Nonce", 1));
end if;
Text := League.Strings.From_UTF_8_String
(AWS.Response.Message_Body (Result));
end Get_Certificate;
---------------
-- Get_Nonce --
---------------
procedure Get_Nonce
(Self : in out Context'Class;
Nonce : out League.Strings.Universal_String)
is
Result : AWS.Response.Data;
URL : League.Strings.Universal_String;
begin
if Self.Nonce.Is_Empty then
URL := Self.Directory.Value (+"newNonce").To_String;
Result := AWS.Client.Head
(URL => URL.To_UTF_8_String,
User_Agent => User_Agent);
pragma Assert (AWS.Response.Has_Header (Result, "Replay-Nonce"));
Self.Nonce := League.Strings.From_UTF_8_String
(AWS.Response.Header (Result, "Replay-Nonce", 1));
end if;
Nonce := Self.Nonce;
end Get_Nonce;
procedure Get_Order_Status
(Self : in out Context'Class;
Account_URL : League.Strings.Universal_String;
Private_Key : League.Stream_Element_Vectors.Stream_Element_Vector;
Order_URL : League.Strings.Universal_String;
Certificate : out League.Strings.Universal_String;
Status : out League.Strings.Universal_String)
is
URL : constant League.Strings.Universal_String := Order_URL;
Doc : League.JSON.Documents.JSON_Document;
Nonce : League.Strings.Universal_String;
JWT : JWS.JSON_Web_Signature;
Header : JWS.JOSE_Header;
Result : AWS.Response.Data;
begin
Self.Get_Nonce (Nonce);
Header.Set_Algorithm (+"RS256");
Header.Insert (+"nonce", -Nonce);
Header.Insert (+"url", -URL);
Header.Insert (+"kid", -Account_URL);
JWT.Create
(Header => Header,
Payload => (1 .. 0 => <>),
Secret => Private_Key.To_Stream_Element_Array);
Result := AWS.Client.Post
(URL => URL.To_UTF_8_String,
Data => JWT.Flattened_Serialization.
To_JSON_Document.To_JSON.To_UTF_8_String,
Content_Type => "application/jose+json",
User_Agent => User_Agent);
Ada.Text_IO.Put_Line (AWS.Response.Status_Code (Result)'Img);
Ada.Text_IO.Put_Line
(AWS.Response.Message_Body (Result));
pragma Assert
(AWS.Response.Status_Code (Result) in AWS.Messages.Success);
if AWS.Response.Has_Header (Result, "Replay-Nonce") then
Self.Nonce := League.Strings.From_UTF_8_String
(AWS.Response.Header (Result, "Replay-Nonce", 1));
end if;
Doc := League.JSON.Documents.From_JSON
(AWS.Response.Message_Body (Result));
Status := Doc.To_JSON_Object.Value (+"status").To_String;
Certificate := Doc.To_JSON_Object.Value (+"certificate").To_String;
end Get_Order_Status;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : in out Context'Class;
Directory_URL : League.Strings.Universal_String;
Terms_Of_Service : out League.Strings.Universal_String)
is
Doc : League.JSON.Documents.JSON_Document;
Meta : League.JSON.Objects.JSON_Object;
Result : AWS.Response.Data;
URL : constant League.Strings.Universal_String := Directory_URL;
begin
Result := AWS.Client.Get
(URL => URL.To_UTF_8_String,
Follow_Redirection => True,
User_Agent => User_Agent);
pragma Assert
(AWS.Response.Status_Code (Result) in AWS.Messages.Success);
Doc := League.JSON.Documents.From_JSON
(AWS.Response.Message_Body (Result));
Self.Directory := Doc.To_JSON_Object;
pragma Assert (Self.Directory.Contains (+"newNonce"));
pragma Assert (Self.Directory.Contains (+"newAccount"));
pragma Assert (Self.Directory.Contains (+"newOrder"));
pragma Assert (Self.Directory.Contains (+"revokeCert"));
pragma Assert (Self.Directory.Contains (+"keyChange"));
Meta := Self.Directory.Value (+"meta").To_Object;
Terms_Of_Service := Meta.Value (+"termsOfService").To_String;
end Initialize;
-----------------------
-- Key_Authorization --
-----------------------
function Key_Authorization
(Token : League.Strings.Universal_String;
Public_Key : League.JSON.Objects.JSON_Object)
return League.Strings.Universal_String
is
SHA256 : constant GNAT.SHA256.Binary_Message_Digest :=
GNAT.SHA256.Digest (JWS.Thumbprint (Public_Key));
Vector : League.Stream_Element_Vectors.Stream_Element_Vector;
Result : League.Strings.Universal_String;
begin
Vector.Append (SHA256);
Result.Append (Token);
Result.Append ('.');
Result.Append (JWS.To_Base_64_URL (Vector));
return Result;
end Key_Authorization;
end ACME;
| 34.249271 | 77 | 0.615833 |
239d5e0ee73ce12c7544e52963823b2ba39acbf1 | 2,680 | adb | Ada | gcc-gcc-7_3_0-release/gcc/ada/s-multip.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/ada/s-multip.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/ada/s-multip.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . M U L T I P R O C E S S O R S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2010-2015, 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/>. --
-- --
------------------------------------------------------------------------------
with Interfaces.C; use Interfaces.C;
package body System.Multiprocessors is
--------------------
-- Number_Of_CPUs --
--------------------
function Number_Of_CPUs return CPU is
begin
if CPU'Last = 1 then
return 1;
else
declare
function Gnat_Number_Of_CPUs return int;
pragma Import (C, Gnat_Number_Of_CPUs, "__gnat_number_of_cpus");
begin
return CPU (Gnat_Number_Of_CPUs);
end;
end if;
end Number_Of_CPUs;
end System.Multiprocessors;
| 51.538462 | 78 | 0.401119 |
18efa78b90560559f86926fa0541a7c73fc026b4 | 8,545 | adb | Ada | src/rejuvenation-printer.adb | TNO/Rejuvenation-Ada | 8113ec28da3923ccde40d76cbab70e0e614f4b75 | [
"BSD-3-Clause"
] | 1 | 2022-03-08T13:00:47.000Z | 2022-03-08T13:00:47.000Z | src/libraries/Rejuvenation_Lib/src/rejuvenation-printer.adb | selroc/Renaissance-Ada | 39230b34aced4a9d83831be346ca103136c53715 | [
"BSD-3-Clause"
] | null | null | null | src/libraries/Rejuvenation_Lib/src/rejuvenation-printer.adb | selroc/Renaissance-Ada | 39230b34aced4a9d83831be346ca103136c53715 | [
"BSD-3-Clause"
] | null | null | null | with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
with Rejuvenation.Utils; use Rejuvenation.Utils;
package body Rejuvenation.Printer is
-- Private -------
procedure Print (Str : in out Unbounded_String; Node : Ada_Node'Class);
procedure Print (Str : in out Unbounded_String; Node : Ada_Node'Class)
is
begin
if Node.Is_Null then
Append (Str, Node.Image);
else
case Node.Kind is
when Ada_Alternatives_List
| Ada_Assoc_List
| Ada_Defining_Name_List =>
declare
Children : constant Ada_Node_Array := Node.Children;
begin
for Index in Children'Range loop
if Index /= Node.First_Child_Index then
Append (Str, ", ");
end if;
Print (Str, Children (Index));
end loop;
end;
when Ada_Aggregate =>
Append (Str, "(");
if not Node.As_Aggregate.F_Ancestor_Expr.Is_Null then
Print (Str, Node.As_Aggregate.F_Ancestor_Expr);
Append (Str, " => ");
end if;
Print (Str, Node.As_Aggregate.F_Assocs);
Append (Str, ")");
when Ada_Aggregate_Assoc =>
if Node.As_Aggregate_Assoc.F_Designators.Children'Length /= 0
then
Print (Str, Node.As_Aggregate_Assoc.F_Designators);
Append (Str, " => ");
end if;
Print (Str, Node.As_Aggregate_Assoc.F_R_Expr);
when Ada_Assign_Stmt =>
Print (Str, Node.As_Assign_Stmt.F_Dest);
Append (Str, " := ");
Print (Str, Node.As_Assign_Stmt.F_Expr);
when Ada_Attribute_Ref =>
Print (Str, Node.As_Attribute_Ref.F_Prefix);
Append (Str, "'");
Print (Str, Node.As_Attribute_Ref.F_Attribute);
if not Node.As_Attribute_Ref.F_Args.Is_Null then
Append (Str, "(");
Print (Str, Node.As_Attribute_Ref.F_Args);
Append (Str, ")");
end if;
when Ada_Bin_Op =>
Print (Str, Node.As_Bin_Op.F_Left);
Append (Str, " ");
Print (Str, Node.As_Bin_Op.F_Op);
Append (Str, " ");
Print (Str, Node.As_Bin_Op.F_Right);
when Ada_Call_Expr =>
Print (Str, Node.As_Call_Expr.F_Name);
Append (Str, "(");
Print (Str, Node.As_Call_Expr.F_Suffix);
Append (Str, ")");
when Ada_Char_Literal =>
Append (Str, "'");
Append
(Str, Raw_Signature (Node));
Append (Str, "'");
when Ada_Delay_Stmt =>
Append (Str, "delay ");
if Node.As_Delay_Stmt.F_Has_Until then
Append (Str, " until ");
end if;
Print (Str, Node.As_Delay_Stmt.F_Expr);
when Ada_Dotted_Name =>
Print (Str, Node.As_Dotted_Name.F_Prefix);
Append (Str, ".");
Print (Str, Node.As_Dotted_Name.F_Suffix);
when Ada_Elsif_Expr_Part_List
| Ada_Expr_Alternatives_List =>
declare
Children : constant Ada_Node_Array := Node.Children;
begin
for Index in Children'Range loop
Print (Str, Children (Index));
end loop;
end;
when Ada_Explicit_Deref =>
Print (Str, Node.As_Explicit_Deref.F_Prefix);
Append (Str, ".all");
when Ada_Identifier =>
Append (Str, Raw_Signature (Node));
when Ada_Defining_Name =>
Print (Str, Node.As_Defining_Name.F_Name);
when Ada_For_Loop_Var_Decl =>
Print (Str, Node.As_For_Loop_Var_Decl.F_Id);
when Ada_If_Expr =>
Append (Str, "if ");
Print (Str, Node.As_If_Expr.F_Cond_Expr);
Append (Str, " then ");
Print (Str, Node.As_If_Expr.F_Then_Expr);
Print (Str, Node.As_If_Expr.F_Alternatives);
Append (Str, " else ");
Print (Str, Node.As_If_Expr.F_Else_Expr);
when Ada_Int_Literal =>
Append
(Str, Raw_Signature (Node));
when Ada_Membership_Expr =>
Print (Str, Node.As_Membership_Expr.F_Expr);
Append (Str, " ");
Print (Str, Node.As_Membership_Expr.F_Op);
Append (Str, " ");
Print (Str, Node.As_Membership_Expr.F_Membership_Exprs);
when Ada_Null_Literal =>
Append (Str, "null");
when Ada_Op_Abs =>
Append (Str, "abs");
when Ada_Op_And =>
Append (Str, "and");
when Ada_Op_And_Then =>
Append (Str, "and then");
when Ada_Op_Concat =>
Append (Str, "&");
when Ada_Op_Div =>
Append (Str, "/");
when Ada_Op_Double_Dot =>
Append (Str, "..");
when Ada_Op_Eq =>
Append (Str, "=");
when Ada_Op_Gt =>
Append (Str, ">");
when Ada_Op_Gte =>
Append (Str, ">=");
when Ada_Op_In =>
Append (Str, "in");
when Ada_Op_Lt =>
Append (Str, "<");
when Ada_Op_Lte =>
Append (Str, "<=");
when Ada_Op_Minus =>
Append (Str, "-");
when Ada_Op_Mod =>
Append (Str, "mod");
when Ada_Op_Mult =>
Append (Str, "*");
when Ada_Op_Neq =>
Append (Str, "/=");
when Ada_Op_Not =>
Append (Str, "not");
when Ada_Op_Not_In =>
Append (Str, "not in");
when Ada_Op_Or =>
Append (Str, "or");
when Ada_Op_Or_Else =>
Append (Str, "or else");
when Ada_Op_Plus =>
Append (Str, "+");
when Ada_Op_Pow =>
Append (Str, "**");
when Ada_Op_Rem =>
Append (Str, "rem");
when Ada_Op_Xor =>
Append (Str, "xor");
when Ada_Others_Designator =>
Append (Str, "others");
when Ada_Param_Assoc =>
if not Node.As_Param_Assoc.F_Designator.Is_Null then
Print (Str, Node.As_Param_Assoc.F_Designator);
Append (Str, " => ");
end if;
Print (Str, Node.As_Param_Assoc.F_R_Expr);
when Ada_Paren_Expr =>
Append (Str, "(");
Print (Str, Node.As_Paren_Expr.F_Expr);
Append (Str, ")");
when Ada_Qual_Expr =>
Print (Str, Node.As_Qual_Expr.F_Prefix);
Append (Str, "'");
Print (Str, Node.As_Qual_Expr.F_Suffix);
when Ada_Real_Literal =>
Append
(Str, Raw_Signature (Node));
when Ada_Relation_Op =>
Print (Str, Node.As_Relation_Op.F_Left);
Append (Str, " ");
Print (Str, Node.As_Relation_Op.F_Op);
Append (Str, " ");
Print (Str, Node.As_Relation_Op.F_Right);
when Ada_Return_Stmt =>
Append (Str, "return ");
Print (Str, Node.As_Return_Stmt.F_Return_Expr);
when Ada_String_Literal =>
Append
(Str, Raw_Signature (Node));
when Ada_Un_Op =>
Print (Str, Node.As_Un_Op.F_Op);
Append (Str, " ");
Print (Str, Node.As_Un_Op.F_Expr);
when others =>
Append (Str, Node.Image);
Put_Line ("??? Rejuvenation.Printer: " & Node.Image);
end case;
end if;
end Print;
-- Public -------
function Print (Node : Ada_Node'Class) return String is
Str : Unbounded_String;
begin
Print (Str, Node);
return To_String (Str);
end Print;
end Rejuvenation.Printer;
| 31.415441 | 76 | 0.472089 |
20df4a138bc71cd2fc6c8c2692b4c438a0c9ec80 | 2,874 | ads | Ada | arch/RISC-V/SiFive/drivers/fe310-clint.ads | shakram02/Ada_Drivers_Library | a407ca7ddbc2d9756647016c2f8fd8ef24a239ff | [
"BSD-3-Clause"
] | 192 | 2016-06-01T18:32:04.000Z | 2022-03-26T22:52:31.000Z | arch/RISC-V/SiFive/drivers/fe310-clint.ads | shakram02/Ada_Drivers_Library | a407ca7ddbc2d9756647016c2f8fd8ef24a239ff | [
"BSD-3-Clause"
] | 239 | 2016-05-26T20:02:01.000Z | 2022-03-31T09:46:56.000Z | arch/RISC-V/SiFive/drivers/fe310-clint.ads | shakram02/Ada_Drivers_Library | a407ca7ddbc2d9756647016c2f8fd8ef24a239ff | [
"BSD-3-Clause"
] | 142 | 2016-06-05T08:12:20.000Z | 2022-03-24T17:37:17.000Z | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2018, AdaCore and other contributors --
-- --
-- See github.com/AdaCore/Ada_Drivers_Library/graphs/contributors --
-- for more information --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package FE310.CLINT is
subtype Machine_Time_Value is UInt64;
function Machine_Time return Machine_Time_Value;
procedure Set_Machine_Time_Compare (Value : Machine_Time_Value);
function Machine_Time_Compare return Machine_Time_Value;
end FE310.CLINT;
| 62.478261 | 78 | 0.522617 |
dcff0bc6e554bac4215eb52c5063370ac0841527 | 1,507 | ads | Ada | src/gl/interface/gl-fixed.ads | Roldak/OpenGLAda | 6807605b7321249d71286fa25231bdfd537d3eac | [
"MIT"
] | 79 | 2015-04-20T23:10:02.000Z | 2022-03-04T13:50:56.000Z | src/gl/interface/gl-fixed.ads | Roldak/OpenGLAda | 6807605b7321249d71286fa25231bdfd537d3eac | [
"MIT"
] | 126 | 2015-09-10T10:41:34.000Z | 2022-03-20T11:25:40.000Z | src/gl/interface/gl-fixed.ads | Roldak/OpenGLAda | 6807605b7321249d71286fa25231bdfd537d3eac | [
"MIT"
] | 20 | 2015-03-17T07:15:57.000Z | 2022-02-02T17:12:11.000Z | -- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with GL.Types;
private with GL.Low_Level;
-- Fixed function pipeline. Deprecated in OpenGL 3.0.
package GL.Fixed is
pragma Preelaborate;
use GL.Types;
subtype Vertex_Length is Positive range 2 .. 4;
type Client_Side_Capability is (Vertex_Array, Normal_Array, Color_Array,
Index_Array, Texture_Coord_Array,
Edge_Flag_Array, Fog_Coord_Array,
Secondary_Color_Array);
procedure Set_Vertex_Pointer (Length : Vertex_Length; Stride, Offset : Size);
procedure Set_Color_Pointer (Stride, Offset : Size);
procedure Enable (Capability : Client_Side_Capability);
procedure Disable (Capability : Client_Side_Capability);
private
for Client_Side_Capability use (Vertex_Array => 16#8074#,
Normal_Array => 16#8075#,
Color_Array => 16#8076#,
Index_Array => 16#8077#,
Texture_Coord_Array => 16#8078#,
Edge_Flag_Array => 16#8079#,
Fog_Coord_Array => 16#8457#,
Secondary_Color_Array => 16#845E#);
for Client_Side_Capability'Size use Low_Level.Enum'Size;
end GL.Fixed;
| 39.657895 | 80 | 0.557399 |
df53fab84dd458b15a836aef6b0f3ad07ac02022 | 5,657 | adb | Ada | orka/src/orka/implementation/egl/orka-contexts-egl.adb | onox/orka | 9edf99559a16ffa96dfdb208322f4d18efbcbac6 | [
"Apache-2.0"
] | 52 | 2016-07-30T23:00:28.000Z | 2022-02-05T11:54:55.000Z | orka/src/orka/implementation/egl/orka-contexts-egl.adb | onox/orka | 9edf99559a16ffa96dfdb208322f4d18efbcbac6 | [
"Apache-2.0"
] | 79 | 2016-08-01T18:36:48.000Z | 2022-02-27T12:14:20.000Z | orka/src/orka/implementation/egl/orka-contexts-egl.adb | onox/orka | 9edf99559a16ffa96dfdb208322f4d18efbcbac6 | [
"Apache-2.0"
] | 4 | 2018-04-28T22:36:26.000Z | 2020-11-14T23:00:29.000Z | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with GL.Context;
with GL.Viewports;
with Orka.Loggers;
with Orka.Logging;
package body Orka.Contexts.EGL is
use all type Orka.Logging.Source;
use all type Orka.Logging.Severity;
use Orka.Logging;
package Messages is new Orka.Logging.Messages (Window_System);
procedure Print_Error
(Error : Standard.EGL.Errors.Error_Code;
Level : Standard.EGL.Debug.Severity;
Command, Message : String)
is
package Debug renames Standard.EGL.Debug;
Severity : constant Orka.Loggers.Severity :=
(case Level is
when Debug.Critical => Loggers.Error,
when Debug.Error => Loggers.Error,
when Debug.Warning => Loggers.Warning,
when Debug.Info => Loggers.Debug);
begin
Messages.Log (Severity, Error'Image & " in " & Command & ": " & Trim (Message));
end Print_Error;
procedure Print_Debug
(Display : Standard.EGL.Objects.Displays.Display;
Flags : Context_Flags) is
begin
Messages.Log (Debug, "Created EGL context");
Messages.Log (Debug, " platform: " & Display.Platform'Image);
declare
Name : constant String := Display.Device.Name;
begin
Messages.Log (Debug, " device: " & (if Name /= "" then Name else "unknown"));
end;
Messages.Log (Debug, " vendor: " & Display.Vendor);
Messages.Log (Debug, " version: " & Display.Version);
Messages.Log (Debug, " context:");
Messages.Log (Debug, " flags: " & Image (Flags));
Messages.Log (Debug, " version: " & GL.Context.Version_String);
Messages.Log (Debug, " renderer: " & GL.Context.Renderer);
end Print_Debug;
procedure Post_Initialize (Object : in out EGL_Context'Class) is
Flags : constant GL.Context.Context_Flags := GL.Context.Flags;
begin
Object.Version :=
(Major => GL.Context.Major_Version,
Minor => GL.Context.Minor_Version);
pragma Assert (Flags.Forward_Compatible);
Object.Flags.Debug := Flags.Debug;
Object.Flags.Robust := Flags.Robust_Access;
Object.Flags.No_Error := Flags.No_Error;
-- Other information about context can be read back as well with
-- GL.Context.Reset_Notification and GL.Context.Release_Behavior
GL.Viewports.Set_Clipping (GL.Viewports.Lower_Left, GL.Viewports.Zero_To_One);
Object.Vertex_Array.Create;
end Post_Initialize;
function Create_Context
(Device : Standard.EGL.Objects.Devices.Device;
Version : Context_Version;
Flags : Context_Flags := (others => False)) return Device_EGL_Context
is
package EGL_Contexts renames Standard.EGL.Objects.Contexts;
package EGL_Displays renames Standard.EGL.Objects.Displays;
begin
Standard.EGL.Debug.Set_Message_Callback (Print_Error'Access);
declare
Display : constant EGL_Displays.Display := EGL_Displays.Create_Display (Device);
begin
return Result : Device_EGL_Context do
Result.Context := EGL_Contexts.Create_Context
(Display,
(Major => Version.Major,
Minor => Version.Minor),
(Debug => Flags.Debug,
Robust => Flags.Robust,
No_Error => Flags.No_Error));
Result.Context.Make_Current;
Post_Initialize (Result);
Print_Debug (Display, Flags);
end return;
end;
end Create_Context;
overriding
function Create_Context
(Version : Context_Version;
Flags : Context_Flags := (others => False)) return Device_EGL_Context
is
package EGL_Devices renames Standard.EGL.Objects.Devices;
Devices : constant EGL_Devices.Device_List := EGL_Devices.Devices;
begin
Messages.Log (Debug, "EGL devices:");
for Device of Devices loop
declare
Name : constant String := Device.Name;
begin
Messages.Log (Debug, " - " & (if Name /= "" then Name else "unknown"));
end;
end loop;
return Create_Context (Devices (Devices'First), Version, Flags);
end Create_Context;
overriding
procedure Finalize (Object : in out EGL_Context) is
begin
if Object.Flags.Debug then
Messages.Log (Debug, "Shutting down EGL");
end if;
Object.Vertex_Array.Delete;
end Finalize;
overriding
procedure Enable (Object : in out EGL_Context; Subject : Feature) is
begin
Contexts.Enable (Object.Features, Subject);
end Enable;
overriding
function Enabled (Object : EGL_Context; Subject : Feature) return Boolean
is (Contexts.Enabled (Object.Features, Subject));
overriding
procedure Make_Current (Object : Device_EGL_Context) is
begin
Object.Context.Make_Current;
end Make_Current;
overriding
procedure Make_Not_Current (Object : Device_EGL_Context) is
begin
Object.Context.Make_Not_Current;
end Make_Not_Current;
end Orka.Contexts.EGL;
| 33.276471 | 89 | 0.657416 |
dcb2592b8106278f221ee63c98367c1175c95ef7 | 1,875 | adb | Ada | awa/regtests/awa_command.adb | twdroeger/ada-awa | 77b824773747aecb912c37b1b7b59ea414679b80 | [
"Apache-2.0"
] | null | null | null | awa/regtests/awa_command.adb | twdroeger/ada-awa | 77b824773747aecb912c37b1b7b59ea414679b80 | [
"Apache-2.0"
] | null | null | null | awa/regtests/awa_command.adb | twdroeger/ada-awa | 77b824773747aecb912c37b1b7b59ea414679b80 | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- awa_command - Tests for AWA command
-- Copyright (C) 2020 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Commands;
with Util.Tests;
with AWA.Tests;
with AWA.Commands.Drivers;
with AWA.Commands.List;
with AWA.Commands.Start;
with AWA.Commands.Stop;
with Servlet.Server;
with AWA.Tests;
with ADO.Drivers;
with AWA.Testsuite;
procedure AWA_Command is
package Server_Commands is
new AWA.Commands.Drivers (Driver_Name => "awa",
Container_Type => Servlet.Server.Container);
package List_Command is
new AWA.Commands.List (Server_Commands);
package Start_Command is
new AWA.Commands.Start (Server_Commands);
package Stop_Command is
new AWA.Commands.Stop (Server_Commands);
App : aliased AWA.Tests.Test_Application;
Context : AWA.Commands.Context_Type;
Arguments : Util.Commands.Dynamic_Argument_List;
Suite : Util.Tests.Access_Test_Suite := AWA.Testsuite.Suite;
begin
ADO.Drivers.Initialize;
Server_Commands.WS.Register_Application ("/test", App'Unchecked_Access);
Server_Commands.Run (Context, Arguments);
end AWA_Command;
| 34.722222 | 76 | 0.6752 |
df9552ab8445936c8aee392c47fbba6400ae9535 | 10,442 | ads | Ada | source/s-unwrai.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 33 | 2015-04-04T09:19:36.000Z | 2021-11-10T05:33:34.000Z | source/s-unwrai.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 8 | 2017-11-14T13:05:07.000Z | 2018-08-09T15:28:49.000Z | source/s-unwrai.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 9 | 2015-02-03T17:09:53.000Z | 2021-11-12T01:16:05.000Z | pragma License (Unrestricted);
-- runtime unit
with Ada;
with System.Unwind.Representation;
package System.Unwind.Raising is
pragma Preelaborate;
-- equivalent to Raise_With_Location_And_Msg (a-except-2005.adb)
procedure Raise_Exception (
E : not null Exception_Data_Access;
File : String := "";
Line : Integer := 0;
Column : Integer := 0;
Message : String := "");
pragma No_Return (Raise_Exception);
-- equivalent to Raise_From_Signal_Handler (a-except-2005.adb)
procedure Raise_From_Signal_Handler (
E : not null Exception_Data_Access;
Message : String;
Stack_Guard : Address);
pragma No_Return (Raise_From_Signal_Handler);
-- implementation for raising (a-except-2005.adb)
procedure Raise_E (
E : Exception_Data_Access;
Message : String)
with Export,
Convention => Ada,
External_Name => "ada__exceptions__raise_exception";
pragma No_Return (Raise_E);
procedure Raise_Exception_From_Here (
E : not null Exception_Data_Access;
File : String := Ada.Debug.File;
Line : Integer := Ada.Debug.Line)
with Export,
Convention => Ada,
External_Name => "__drake_raise_exception_from_here";
procedure Raise_Exception_From_Here_With (
E : not null Exception_Data_Access;
File : String := Ada.Debug.File;
Line : Integer := Ada.Debug.Line;
Message : String)
with Export,
Convention => Ada,
External_Name => "__drake_raise_exception_from_here_with";
pragma No_Return (Raise_Exception_From_Here);
pragma No_Return (Raise_Exception_From_Here_With);
-- implementation for reraising (a-except-2005.adb)
procedure Reraise (X : Exception_Occurrence)
with Export,
Convention => Ada,
External_Name => "ada__exceptions__reraise_occurrence_always";
pragma No_Return (Reraise);
-- implementation for reraising from when all others (a-except-2005.adb)
procedure Reraise_From_All_Others (X : Exception_Occurrence)
with Export,
Convention => Ada,
External_Name => "ada__exceptions__reraise_occurrence_no_defer";
pragma No_Return (Reraise_From_All_Others);
-- implementation for raising from controlled objects (a-except-2005.adb)
procedure Reraise_From_Controlled_Operation (X : Exception_Occurrence)
with Export,
Convention => Ada,
External_Name => "__gnat_raise_from_controlled_operation";
pragma No_Return (Reraise_From_Controlled_Operation);
-- equivalent to Reraise_GCC_Exception (a-exexpr-gcc.adb)
-- for nested controlled types
procedure Reraise_Machine_Occurrence (
Machine_Occurrence : not null Representation.Machine_Occurrence_Access)
with Export, Convention => C, External_Name => "__gnat_reraise_zcx";
-- utility for implementing a dummy subprogram
procedure Raise_Program_Error
with Export, Convention => Ada, External_Name => "__drake_program_error";
-- for runtime checks (a-except-2005.adb)
procedure rcheck_00 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_CE_Access_Check";
pragma No_Return (rcheck_00);
procedure rcheck_02 (File : not null access Character; Line : Integer)
with Export,
Convention => C,
External_Name => "__gnat_rcheck_CE_Discriminant_Check";
pragma No_Return (rcheck_02);
procedure rcheck_03 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_CE_Divide_By_Zero";
pragma No_Return (rcheck_03);
-- equivalent to rcheck_03
procedure Zero_Division (
File : String := Ada.Debug.File;
Line : Integer := Ada.Debug.Line);
pragma No_Return (Zero_Division);
procedure rcheck_04 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_CE_Explicit_Raise";
pragma No_Return (rcheck_04);
procedure rcheck_05 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_CE_Index_Check";
pragma No_Return (rcheck_05);
procedure rcheck_06 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_CE_Invalid_Data";
pragma No_Return (rcheck_06);
procedure rcheck_07 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_CE_Length_Check";
pragma No_Return (rcheck_07);
procedure rcheck_09 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_CE_Null_Not_Allowed";
pragma No_Return (rcheck_09);
procedure rcheck_10 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_CE_Overflow_Check";
pragma No_Return (rcheck_10);
-- equivalent to rcheck_10
procedure Overflow (
File : String := Ada.Debug.File;
Line : Integer := Ada.Debug.Line);
pragma No_Return (Overflow);
procedure rcheck_12 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_CE_Range_Check";
pragma No_Return (rcheck_12);
procedure rcheck_13 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_CE_Tag_Check";
pragma No_Return (rcheck_13);
procedure rcheck_14 (File : not null access Character; Line : Integer)
with Export,
Convention => C,
External_Name => "__gnat_rcheck_PE_Access_Before_Elaboration";
pragma No_Return (rcheck_14);
procedure rcheck_15 (File : not null access Character; Line : Integer)
with Export,
Convention => C,
External_Name => "__gnat_rcheck_PE_Accessibility_Check";
pragma No_Return (rcheck_15);
procedure rcheck_18 (File : not null access Character; Line : Integer)
with Export,
Convention => C,
External_Name => "__gnat_rcheck_PE_All_Guards_Closed";
pragma No_Return (rcheck_18);
procedure rcheck_22 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_PE_Explicit_Raise";
pragma No_Return (rcheck_22);
procedure rcheck_23 (File : not null access Character; Line : Integer)
with Export,
Convention => C,
External_Name => "__gnat_rcheck_PE_Finalize_Raised_Exception";
pragma No_Return (rcheck_23);
-- equivalent to rcheck_23
procedure Finalize_Raised_Exception;
pragma No_Return (Finalize_Raised_Exception);
procedure rcheck_24 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_PE_Implicit_Return";
pragma No_Return (rcheck_24);
procedure rcheck_25 (File : not null access Character; Line : Integer)
with Export,
Convention => C,
External_Name => "__gnat_rcheck_PE_Misaligned_Address_Value";
pragma No_Return (rcheck_25);
procedure rcheck_26 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_PE_Missing_Return";
pragma No_Return (rcheck_26);
procedure rcheck_27 (File : not null access Character; Line : Integer)
with Export,
Convention => C,
External_Name => "__gnat_rcheck_PE_Overlaid_Controlled_Object";
pragma No_Return (rcheck_27);
procedure rcheck_30 (File : not null access Character; Line : Integer)
with Export,
Convention => C,
External_Name => "__gnat_rcheck_PE_Unchecked_Union_Restriction";
pragma No_Return (rcheck_30);
procedure rcheck_32 (File : not null access Character; Line : Integer)
with Export,
Convention => C,
External_Name => "__gnat_rcheck_SE_Empty_Storage_Pool";
pragma No_Return (rcheck_32);
procedure rcheck_33 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_SE_Explicit_Raise";
pragma No_Return (rcheck_33);
procedure rcheck_35 (File : not null access Character; Line : Integer)
with Export,
Convention => C, External_Name => "__gnat_rcheck_SE_Object_Too_Large";
pragma No_Return (rcheck_35);
procedure Save_Exception (
X : out Exception_Occurrence;
E : not null Exception_Data_Access;
File : String := "";
Line : Integer := 0;
Column : Integer := 0;
Message : String := "");
procedure Save_E (
X : out Exception_Occurrence;
E : not null Exception_Data_Access;
Message : String)
with Export,
Convention => Ada, External_Name => "__drake_save_exception";
procedure Save_Exception_From_Here (
X : out Exception_Occurrence;
E : not null Exception_Data_Access;
File : String := Ada.Debug.File;
Line : Integer := Ada.Debug.Line)
with Export,
Convention => Ada,
External_Name => "__drake_save_exception_from_here";
procedure Save_Exception_From_Here_With (
X : out Exception_Occurrence;
E : not null Exception_Data_Access;
File : String := Ada.Debug.File;
Line : Integer := Ada.Debug.Line;
Message : String)
with Export,
Convention => Ada,
External_Name => "__drake_save_exception_from_here_with";
-- excluding code range
function AAA return Address;
function ZZZ return Address;
-- GDB knows some names for "catch exception" command.
-- However, it works incompletely with official gcc (works fine with GNAT
-- Community/GPL Edition).
-- In drake, only the simple form of "catch exception" is supported.
-- (s-excdeb.ads)
procedure Debug_Raise_Exception (
E : not null Exception_Data_Access;
Message : String)
with Export,
Convention => Ada, External_Name => "__gnat_debug_raise_exception";
-- procedure __gnat_unhandled_exception (E : Exception_Data_Ptr);
-- procedure __gnat_debug_raise_assert_failure;
-- procedure __gnat_raise_nodefer_with_msg (E : Exception_Data_Ptr);
end System.Unwind.Raising;
| 36.638596 | 79 | 0.692205 |
df127e1fcca0516d017d4b7f410d82c259b7d97c | 7,009 | adb | Ada | orka_egl/src/egl-objects-contexts.adb | onox/orka | 9edf99559a16ffa96dfdb208322f4d18efbcbac6 | [
"Apache-2.0"
] | 52 | 2016-07-30T23:00:28.000Z | 2022-02-05T11:54:55.000Z | orka_egl/src/egl-objects-contexts.adb | onox/orka | 9edf99559a16ffa96dfdb208322f4d18efbcbac6 | [
"Apache-2.0"
] | 79 | 2016-08-01T18:36:48.000Z | 2022-02-27T12:14:20.000Z | orka_egl/src/egl-objects-contexts.adb | onox/orka | 9edf99559a16ffa96dfdb208322f4d18efbcbac6 | [
"Apache-2.0"
] | 4 | 2018-04-28T22:36:26.000Z | 2020-11-14T23:00:29.000Z | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <[email protected]>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Unchecked_Conversion;
with EGL.API;
with EGL.Errors;
package body EGL.Objects.Contexts is
Major_Version : constant Int := 16#3098#;
Minor_Version : constant Int := 16#30FB#;
Context_Flags_Bits : constant Int := 16#30FC#;
OpenGL_Profile_Mask : constant Int := 16#30FD#;
-- EGL 1.5
-- OpenGL_Debug : constant Int := 16#31B0#;
-- OpenGL_Forward_Compatible : constant Int := 16#31B1#;
-- OpenGL_Robust : constant Int := 16#31B2#;
OpenGL_No_Error : constant Int := 16#31B3#;
OpenGL_Reset_Notification_Strategy : constant Int := 16#31BD#;
Context_Release_Behavior : constant Int := 16#2097#;
Context_Release_Behavior_None : constant Int := 0;
-- Context_Release_Behavior_Flush : constant Int := 16#2098#;
No_Reset_Notification : constant Int := 16#31BE#;
Lose_Context_On_Reset : constant Int := 16#31BF#;
OpenGL_Core_Profile : constant Int := 16#0000_0001#;
type Flag_Bits is record
Debug : Boolean := False;
Forward : Boolean := True;
Robust : Boolean := False;
end record;
for Flag_Bits use record
Debug at 0 range 0 .. 0;
Forward at 0 range 1 .. 1;
Robust at 0 range 2 .. 2;
end record;
for Flag_Bits'Size use Int'Size;
function Create_Context
(Display : Displays.Display;
Version : Context_Version;
Flags : Context_Flags) return Context
is
No_Config : constant ID_Type := ID_Type (System.Null_Address);
No_Context : constant ID_Type := ID_Type (System.Null_Address);
function Convert is new Ada.Unchecked_Conversion (Flag_Bits, Int);
Flags_Mask : constant Flag_Bits :=
(Debug => Flags.Debug,
Forward => True,
Robust => Flags.Robust);
Attributes : constant Int_Array :=
(Major_Version, Int (Version.Major),
Minor_Version, Int (Version.Minor),
Context_Flags_Bits, Convert (Flags_Mask),
OpenGL_Profile_Mask, OpenGL_Core_Profile,
-- EGL 1.5
-- OpenGL_Debug, (if Flags.Debug then 1 else 0),
-- OpenGL_Forward_Compatible, 1,
-- OpenGL_Robust, (if Flags.Robust then 1 else 0),
OpenGL_Reset_Notification_Strategy,
(if Flags.Robust then Lose_Context_On_Reset else No_Reset_Notification));
-- Requires EGL_KHR_create_context or EGL 1.5
No_Error : constant Int_Array := (OpenGL_No_Error, 1);
No_Flush : constant Int_Array := (Context_Release_Behavior, Context_Release_Behavior_None);
Extensions : constant String_List := Display.Extensions;
begin
if not Boolean (API.Bind_API (OpenGL_API)) then
Errors.Raise_Exception_On_EGL_Error;
end if;
Check_Extension (Extensions, "EGL_KHR_create_context");
Check_Extension (Extensions, "EGL_KHR_no_config_context");
Check_Extension (Extensions, "EGL_KHR_surfaceless_context");
declare
Can_Have_No_Error : constant Boolean :=
Flags.No_Error and then Has_Extension (Extensions, "EGL_KHR_create_context_no_error");
Can_Have_Release_Context : constant Boolean :=
Has_Extension (Extensions, "EGL_KHR_context_flush_control");
ID : constant ID_Type :=
API.Create_Context (Display.ID, No_Config, No_Context,
Attributes &
(if Can_Have_No_Error then No_Error else (1 .. 0 => <>)) &
(if Can_Have_Release_Context then No_Flush else (1 .. 0 => <>)) &
None);
-- TODO Support shared context (replace No_Context with Shared_Context.ID)
begin
if ID = No_Context then
Errors.Raise_Exception_On_EGL_Error;
end if;
return Result : Context (Display.Platform) do
Result.Reference.ID := ID;
Result.Display := Display;
end return;
end;
end Create_Context;
function Buffer (Object : Context) return Buffer_Kind is
Result : Buffer_Kind;
begin
if not Boolean (API.Query_Context (Object.Display.ID, Object.ID, Render_Buffer, Result)) then
Errors.Raise_Exception_On_EGL_Error;
end if;
return Result;
end Buffer;
function Is_Current (Object : Context; Kind : Task_Kind) return Boolean is
begin
case Kind is
when Current_Task =>
return API.Get_Current_Context = Object.ID;
when Any_Task =>
return Object.Reference.Active;
end case;
end Is_Current;
procedure Make_Current (Object : Context) is
No_Surface : constant ID_Type := ID_Type (System.Null_Address);
begin
if not API.Make_Current (Object.Display.ID, No_Surface, No_Surface, Object.ID) then
Errors.Raise_Exception_On_EGL_Error;
end if;
Object.Reference.Active := True;
end Make_Current;
procedure Make_Current (Object : Context; Surface : Surfaces.Surface) is
begin
if not API.Make_Current (Object.Display.ID, Surface.ID, Surface.ID, Object.ID) then
Errors.Raise_Exception_On_EGL_Error;
end if;
Object.Reference.Active := True;
end Make_Current;
procedure Make_Not_Current (Object : Context) is
No_Context : constant ID_Type := ID_Type (System.Null_Address);
No_Surface : constant ID_Type := ID_Type (System.Null_Address);
begin
if not API.Make_Current (Object.Display.ID, No_Surface, No_Surface, No_Context) then
Errors.Raise_Exception_On_EGL_Error;
end if;
Object.Reference.Active := False;
end Make_Not_Current;
procedure Set_Swap_Interval (Object : Context; Value : Natural) is
begin
if not Boolean (API.Swap_Interval (Object.Display.ID, Int (Value))) then
Errors.Raise_Exception_On_EGL_Error;
end if;
end Set_Swap_Interval;
overriding procedure Pre_Finalize (Object : in out Context) is
No_Context : constant ID_Type := ID_Type (System.Null_Address);
begin
pragma Assert (Object.ID /= No_Context);
if Object.Is_Current (Current_Task) then
Object.Make_Not_Current;
end if;
if not Boolean (API.Destroy_Context (Object.Display.ID, Object.ID)) then
Errors.Raise_Exception_On_EGL_Error;
end if;
Object.Reference.ID := No_Context;
end Pre_Finalize;
end EGL.Objects.Contexts;
| 35.57868 | 99 | 0.666001 |
df6fc31a41334618b654256c27aa77000ad5e1dc | 20,256 | adb | Ada | ada/core/agar-object.adb | charlesdaniels/libagar | 099ce716e2ca01a7904b23f22610bf589295f5b5 | [
"BSD-2-Clause"
] | null | null | null | ada/core/agar-object.adb | charlesdaniels/libagar | 099ce716e2ca01a7904b23f22610bf589295f5b5 | [
"BSD-2-Clause"
] | null | null | null | ada/core/agar-object.adb | charlesdaniels/libagar | 099ce716e2ca01a7904b23f22610bf589295f5b5 | [
"BSD-2-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- AGAR CORE LIBRARY --
-- A G A R . O B J E C T --
-- B o d y --
-- --
-- Copyright (c) 2018-2019, Julien Nadeau Carriere ([email protected]) --
-- Copyright (c) 2010, coreland ([email protected]) --
-- --
-- Permission to use, copy, modify, and/or distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Agar.Error;
package body Agar.Object is
use Interfaces.C;
use Agar.Event;
function New_Object
(Parent : in Object_Access;
Name : in String;
Class : in Class_Not_Null_Access) return Object_Access
is
Ch_Name : aliased C.char_array := C.To_C(Name);
begin
return AG_ObjectNew
(Parent => Parent.all'Address,
Name => CS.To_Chars_Ptr(Ch_Name'Unchecked_Access),
Class => Class);
end;
function New_Object
(Parent : in Object_Access;
Class : in Class_Not_Null_Access) return Object_Access is
begin
return AG_ObjectNew
(Parent => Parent.all'Address,
Name => CS.Null_Ptr,
Class => Class);
end;
function New_Object
(Class : in Class_Not_Null_Access) return Object_Access is
begin
return AG_ObjectNew
(Parent => System.Null_Address,
Name => CS.Null_Ptr,
Class => Class);
end;
procedure Init_Object
(Object : in Object_Not_Null_Access;
Class : in Class_Not_Null_Access;
Static : in Boolean := False) is
begin
if Static then
AG_ObjectInitStatic (Object, Class);
else
AG_ObjectInit (Object, Class);
end if;
end;
procedure Attach
(Parent : in Object_Access;
Child : in Object_not_null_Access)
is
begin
AG_ObjectAttach
(Parent => Parent,
Child => Child);
end;
function Find
(Root : in Object_Not_Null_Access;
Path : in String) return Object_Access
is
Ch_Path : aliased C.char_array := C.To_C(Path);
begin
return AG_ObjectFindS
(Root => Root,
Path => CS.To_Chars_Ptr(Ch_Path'Unchecked_Access));
end;
function Find_Parent
(Object : in Object_Not_Null_Access;
Name : in String;
Class : in String) return Object_Access
is
Ch_Name : aliased C.char_array := C.To_C(Name);
Ch_Class : aliased C.char_array := C.To_C(Class);
begin
return AG_ObjectFindParent
(Object => Object,
Name => CS.To_Chars_Ptr(Ch_Name'Unchecked_Access),
Class => CS.To_Chars_Ptr(Ch_Class'Unchecked_Access));
end;
function Find_Child
(Parent : in Object_Not_Null_Access;
Name : in String) return Object_Access
is
Ch_Name : aliased C.char_array := C.To_C(Name);
begin
return AG_ObjectFindChild
(Parent => Parent,
Name => CS.To_Chars_Ptr(Ch_Name'Unchecked_Access));
end;
function Get_Name (Object : in Object_Not_Null_Access) return String
is
Ch_Name : aliased C.char_array (0 .. C.size_t(HIERARCHY_MAX));
Result : C.int;
begin
Result := AG_ObjectCopyName
(Object => Object,
Buffer => Ch_Name'Address,
Size => Ch_Name'Length);
if Integer(Result) /= 0 then
raise Program_Error with Agar.Error.Get_Error;
end if;
return C.To_Ada(Ch_Name);
end;
procedure Set_Name
(Object : in Object_Not_Null_Access;
Name : in String)
is
Ch_Name : aliased C.char_array := C.To_C(Name);
begin
AG_ObjectSetNameS
(Object => Object,
Name => CS.To_Chars_Ptr(Ch_Name'Unchecked_Access));
end;
function Generate_Name
(Object : in Object_Not_Null_Access;
Class : in Class_Not_Null_Access) return String
is
Ch_Name : aliased C.char_array (0 .. C.size_t(NAME_MAX));
begin
AG_ObjectGenName
(Object => Object,
Class => Class,
Buffer => Ch_Name'Address,
Size => Ch_Name'Length);
return C.To_Ada(Ch_Name);
end;
function Generate_Name
(Object : in Object_Not_Null_Access;
Prefix : in String) return String
is
Ch_Name : aliased C.char_array (0 .. C.size_t(NAME_MAX));
Ch_Prefix : aliased C.char_array := C.To_C(Prefix);
begin
AG_ObjectGenNamePfx
(Object => Object,
Prefix => CS.To_Chars_Ptr(Ch_Prefix'Unchecked_Access),
Buffer => Ch_Name'Address,
Size => Ch_Name'Length);
return C.To_Ada(Ch_Name);
end;
procedure Register_Namespace
(Name : in String;
Prefix : in String;
URL : in String)
is
Ch_Name : aliased C.char_array := C.To_C(Name);
Ch_Prefix : aliased C.char_array := C.To_C(Prefix);
Ch_URL : aliased C.char_array := C.To_C(URL);
begin
AG_RegisterNamespace
(Name => CS.To_Chars_Ptr(Ch_Name'Unchecked_Access),
Prefix => CS.To_Chars_Ptr(Ch_Prefix'Unchecked_Access),
URL => CS.To_Chars_Ptr(Ch_URL'Unchecked_Access));
end;
procedure Unregister_Namespace
(Name : in String)
is
Ch_Name : aliased C.char_array := C.To_C(Name);
begin
AG_UnregisterNamespace(CS.To_Chars_Ptr(Ch_Name'Unchecked_Access));
end;
function Create_Class
(Hierarchy : in String;
Object_Size : in Natural;
Class_Size : in Natural;
Major : in Natural := 1;
Minor : in Natural := 0;
Init_Func : in Init_Func_Access := null;
Reset_Func : in Reset_Func_Access := null;
Destroy_Func : in Destroy_Func_Access := null;
Load_Func : in Load_Func_Access := null;
Save_Func : in Save_Func_Access := null;
Edit_Func : in Edit_Func_Access := null) return Class_Not_Null_Access
is
Ch_Hierarchy : aliased C.char_array := C.To_C(Hierarchy);
Class : Class_Access;
begin
Class := AG_CreateClass
(Hierarchy => CS.To_Chars_Ptr(Ch_Hierarchy'Unchecked_Access),
Object_Size => AG_Size(Object_Size / System.Storage_Unit),
Class_Size => AG_Size(Class_Size / System.Storage_Unit),
Major => C.unsigned(Major),
Minor => C.unsigned(Minor));
if Class = null then
raise Program_Error with Agar.Error.Get_Error;
end if;
if Init_Func /= null then AG_ClassSetInit (Class, Init_Func); end if;
if Reset_Func /= null then AG_ClassSetReset (Class, Reset_Func); end if;
if Destroy_Func /= null then AG_ClassSetDestroy (Class, Destroy_Func); end if;
if Load_Func /= null then AG_ClassSetLoad (Class, Load_Func); end if;
if Save_Func /= null then AG_ClassSetSave (Class, Save_Func); end if;
if Edit_Func /= null then AG_ClassSetEdit (Class, Edit_Func); end if;
return Class;
end Create_Class;
procedure Class_Set_Init
(Class : in Class_Not_Null_Access;
Init_Func : in Init_Func_Access) is
begin
AG_ClassSetInit(Class, Init_Func);
end;
function Class_Set_Init
(Class : in Class_Not_Null_Access;
Init_Func : in Init_Func_Access) return Init_Func_Access is
begin
return AG_ClassSetInit(Class, Init_Func);
end;
procedure Class_Set_Reset
(Class : in Class_Not_Null_Access;
Reset_Func : in Reset_Func_Access) is
begin
AG_ClassSetReset(Class, Reset_Func);
end;
function Class_Set_Reset
(Class : in Class_Not_Null_Access;
Reset_Func : in Reset_Func_Access) return Reset_Func_Access is
begin
return AG_ClassSetReset(Class, Reset_Func);
end;
procedure Class_Set_Destroy
(Class : in Class_Not_Null_Access;
Destroy_Func : in Destroy_Func_Access) is
begin
AG_ClassSetDestroy(Class, Destroy_Func);
end;
function Class_Set_Destroy
(Class : in Class_Not_Null_Access;
Destroy_Func : in Destroy_Func_Access) return Destroy_Func_Access is
begin
return AG_ClassSetDestroy(Class, Destroy_Func);
end;
procedure Class_Set_Load
(Class : in Class_Not_Null_Access;
Load_Func : in Load_Func_Access) is
begin
AG_ClassSetLoad(Class, Load_Func);
end;
function Class_Set_Load
(Class : in Class_Not_Null_Access;
Load_Func : in Load_Func_Access) return Load_Func_Access is
begin
return AG_ClassSetLoad(Class, Load_Func);
end;
procedure Class_Set_Save
(Class : in Class_Not_Null_Access;
Save_Func : in Save_Func_Access) is
begin
AG_ClassSetSave(Class, Save_Func);
end;
function Class_Set_Save
(Class : in Class_Not_Null_Access;
Save_Func : in Save_Func_Access) return Save_Func_Access is
begin
return AG_ClassSetSave(Class, Save_Func);
end;
procedure Class_Set_Edit
(Class : in Class_Not_Null_Access;
Edit_Func : in Edit_Func_Access) is
begin
AG_ClassSetEdit(Class, Edit_Func);
end;
function Class_Set_Edit
(Class : in Class_Not_Null_Access;
Edit_Func : in Edit_Func_Access) return Edit_Func_Access is
begin
return AG_ClassSetEdit(Class, Edit_Func);
end;
function Lookup_Class
(Class : in String) return Class_Access
is
Ch_Class : aliased C.char_array := C.To_C(Class);
begin
return AG_LookupClass
(Class => CS.To_Chars_Ptr(Ch_Class'Unchecked_Access));
end;
function Load_Class
(Class : in String) return Class_Access
is
Ch_Class : aliased C.char_array := C.To_C(Class);
begin
return AG_LoadClass
(Class => CS.To_Chars_Ptr(Ch_Class'Unchecked_Access));
end;
procedure Register_Module_Directory
(Path : in String)
is
Ch_Path : aliased C.char_array := C.To_C(Path);
begin
AG_RegisterModuleDirectory
(Path => CS.To_Chars_Ptr(Ch_Path'Unchecked_Access));
end;
procedure Unregister_Module_Directory
(Path : in String)
is
Ch_Path : aliased C.char_array := C.To_C(Path);
begin
AG_UnregisterModuleDirectory
(Path => CS.To_Chars_Ptr(Ch_Path'Unchecked_Access));
end;
function Is_Of_Class
(Object : in Object_Not_Null_Access;
Pattern : in String) return Boolean
is
Ch_Pattern : aliased C.char_array := C.To_C(Pattern);
begin
return AG_OfClass
(Object => Object,
Pattern => CS.To_Chars_Ptr(Ch_Pattern'Unchecked_Access)) = 1;
end;
function Is_A
(Object : in Object_Not_Null_Access;
Pattern : in String) return Boolean
is
Ch_Pattern : aliased C.char_array := C.To_C(Pattern);
begin
return AG_OfClass
(Object => Object,
Pattern => CS.To_Chars_Ptr(Ch_Pattern'Unchecked_Access)) = 1;
end;
function In_Use (Object : in Object_Not_Null_Access) return Boolean is
begin
return AG_ObjectInUse(Object) = 1;
end;
function Add_Dependency
(Object : in Object_Not_Null_Access;
Dependency : in Object_Not_Null_Access;
Persistent : in Boolean := False) return Dependency_Access is
begin
return AG_ObjectAddDep
(Object => Object,
Dependency => Dependency,
Persistent => Boolean'Pos(Persistent));
end;
function Find_Dependency
(Object : in Object_Not_Null_Access;
Index : in Interfaces.Unsigned_32;
Pointer : access Object_Not_Null_Access) return Boolean is
begin
return AG_ObjectFindDep
(Object => Object,
Index => Index,
Pointer => Pointer) = 0;
end;
-------------------
-- Serialization --
-------------------
function Load (Object : in Object_Not_Null_Access) return Boolean is
begin
return AG_ObjectLoad(Object) = 0;
end;
function Load
(Object : in Object_Not_Null_Access;
File : in String) return Boolean
is
Ch_File : aliased C.char_array := C.To_C(File);
begin
return AG_ObjectLoadFromFile
(Object => Object,
File => CS.To_Chars_Ptr(Ch_File'Unchecked_Access)) = 0;
end;
function Load_Data (Object : in Object_Not_Null_Access) return Boolean is
begin
return AG_ObjectLoadData(Object) = 0;
end;
function Load_Data
(Object : in Object_Not_Null_Access;
File : in String) return Boolean
is
Ch_File : aliased C.char_array := C.To_C(File);
begin
return AG_ObjectLoadDataFromFile
(Object => Object,
File => CS.To_Chars_Ptr(Ch_File'Unchecked_Access)) = 0;
end;
function Load_Generic (Object : in Object_Not_Null_Access) return Boolean is
begin
return AG_ObjectLoadGeneric(Object) = 0;
end;
function Load_Generic
(Object : in Object_Not_Null_Access;
File : in String) return Boolean
is
Ch_File : aliased C.char_array := C.To_C(File);
begin
return AG_ObjectLoadGenericFromFile
(Object => Object,
File => CS.To_Chars_Ptr(Ch_File'Unchecked_Access)) = 0;
end;
function Save (Object : in Object_Not_Null_Access) return Boolean is
begin
return AG_ObjectSave(Object) = 0;
end;
function Save
(Object : in Object_Not_Null_Access;
File : in String) return Boolean
is
Ch_File : aliased C.char_array := C.To_C(File);
begin
return AG_ObjectSaveToFile
(Object => Object,
File => CS.To_Chars_Ptr(Ch_File'Unchecked_Access)) = 0;
end;
function Save_All (Object : in Object_Not_Null_Access) return Boolean is
begin
return AG_ObjectSaveAll(Object) = 0;
end;
function Serialize
(Object : in Object_Not_Null_Access;
Source : in DS.Data_Source_Not_Null_Access) return Boolean is
begin
return AG_ObjectSerialize(Object, Source) = 0;
end;
function Unserialize
(Object : in Object_Not_Null_Access;
Source : in DS.Data_Source_Not_Null_Access) return Boolean is
begin
return AG_ObjectUnserialize(Object, Source) = 0;
end;
function Read_Header
(Source : in DS.Data_Source_Not_Null_Access;
Header : in Header_Access) return Boolean is
begin
return AG_ObjectReadHeader (Source, Header) = 0;
end;
function Page_In
(Object : in Object_Not_Null_Access) return Boolean is
begin
return AG_ObjectPageIn (Object) = 0;
end;
function Page_Out
(Object : in Object_Not_Null_Access) return Boolean is
begin
return AG_ObjectPageOut (Object) = 0;
end;
------------
-- Events --
------------
function Set_Event
(Object : in Object_Not_Null_Access;
Event : in String;
Func : in Event_Func_Access;
Async : in Boolean := False;
Propagate : in Boolean := False) return Event_Not_Null_Access
is
Ch_Event : aliased C.char_array := C.To_C(Event);
Result : constant Event_Not_Null_Access := AG_SetEvent
(Object => Object,
Event => CS.To_Chars_Ptr(Ch_Event'Unchecked_Access),
Func => Func,
Format => CS.Null_Ptr);
begin
-- TODO Async, Propagate
return (Result);
end;
procedure Set_Event
(Object : in Object_Not_Null_Access;
Event : in String;
Func : in Event_Func_Access;
Async : in Boolean := False;
Propagate : in Boolean := False)
is
Ch_Event : aliased C.char_array := C.To_C(Event);
begin
AG_SetEvent
(Object => Object,
Event => CS.To_Chars_Ptr(Ch_Event'Unchecked_Access),
Func => Func,
Format => CS.Null_Ptr);
end;
function Add_Event
(Object : in Object_Not_Null_Access;
Event : in String;
Func : in Event_Func_Access;
Async : in Boolean := False;
Propagate : in Boolean := False) return Event_Not_Null_Access
is
Ch_Event : aliased C.char_array := C.To_C(Event);
Result : constant Event_Not_Null_Access := AG_AddEvent
(Object => Object,
Event => CS.To_Chars_Ptr(Ch_Event'Unchecked_Access),
Func => Func,
Format => CS.Null_Ptr);
begin
return (Result);
end;
procedure Add_Event
(Object : in Object_Not_Null_Access;
Event : in String;
Func : in Event_Func_Access;
Async : in Boolean := False;
Propagate : in Boolean := False)
is
Ch_Event : aliased C.char_array := C.To_C(Event);
begin
AG_AddEvent
(Object => Object,
Event => CS.To_Chars_Ptr(Ch_Event'Unchecked_Access),
Func => Func,
Format => CS.Null_Ptr);
end;
procedure Post_Event
(Source : in Object_Access;
Target : in Object_Not_Null_Access;
Event : in String)
is
Ch_Event : aliased C.char_array := C.To_C(Event);
begin
AG_PostEvent
(Source => Source,
Target => Target,
Event => CS.To_Chars_Ptr(Ch_Event'Unchecked_Access),
Format => CS.Null_Ptr);
end;
procedure Post_Event
(Source : in Object_Access;
Target : in Object_Not_Null_Access;
Event : in Event_Not_Null_Access) is
begin
AG_PostEventByPtr
(Source => Source,
Target => Target,
Event => Event,
Format => CS.Null_Ptr);
end;
procedure Post_Event
(Target : in Object_Not_Null_Access;
Event : in String)
is
Ch_Event : aliased C.char_array := C.To_C(Event);
begin
AG_PostEvent
(Source => Null,
Target => Target,
Event => CS.To_Chars_Ptr(Ch_Event'Unchecked_Access),
Format => CS.Null_Ptr);
end;
procedure Post_Event
(Target : in Object_Not_Null_Access;
Event : in Event_Not_Null_Access) is
begin
AG_PostEventByPtr
(Source => Null,
Target => Target,
Event => Event,
Format => CS.Null_Ptr);
end;
procedure Debug
(Object : in Object_Access;
Message : in String)
is
Ch_Format : aliased C.char_array := C.To_C("%s");
Ch_Message : aliased C.char_array := C.To_C(Message);
begin
AG_Debug
(Object => Object,
Format => CS.To_Chars_Ptr(Ch_Format'Unchecked_Access),
Message => CS.To_Chars_Ptr(Ch_Message'Unchecked_Access));
end;
------------
-- Timers --
------------
function Add_Timer
(Object : in Object_Access;
Timer : in TMR.Timer_not_null_Access;
Interval : in Interfaces.Unsigned_32;
Func : in TMR.Timer_Callback) return Boolean
is
begin
return 0 = AG_AddTimer
(Object => Object,
Timer => Timer,
Interval => Interval,
Func => Func,
Flags => 0,
Format => CS.Null_Ptr);
end;
function Add_Timer
(Object : in Object_Access;
Interval : in Interfaces.Unsigned_32;
Func : in TMR.Timer_Callback) return TMR.Timer_Access
is
begin
return AG_AddTimerAuto
(Object => Object,
Interval => Interval,
Func => Func,
Format => CS.Null_Ptr);
end;
---------------
-- Variables --
---------------
function Defined
(Object : in Object_not_null_Access;
Variable : in String) return Boolean
is
Ch_Name : aliased C.char_array := C.To_C(Variable);
Result : C.int;
begin
Lock(Object);
Result := AG_Defined
(Object => Object,
Name => CS.To_Chars_Ptr(Ch_Name'Unchecked_Access));
Unlock(Object);
return Result = 1;
end;
--
-- Compare two variables with no dereference. Discrete types are compared
-- by value. Strings are compared case-sensitively. Reference types are
-- compared by their pointer value.
--
function "=" (Left, Right : in Variable_not_null_Access) return Boolean is
begin
return 0 = AG_CompareVariables (Left, Right);
end;
end Agar.Object;
| 28.978541 | 82 | 0.639317 |
dc5a6fb9690bf572d757acec0800497cbdf07157 | 6,792 | ads | Ada | src/ado-drivers-connections.ads | Letractively/ada-ado | f0863c6975ae1a2c5349daee1e98a04fe11ba11e | [
"Apache-2.0"
] | null | null | null | src/ado-drivers-connections.ads | Letractively/ada-ado | f0863c6975ae1a2c5349daee1e98a04fe11ba11e | [
"Apache-2.0"
] | null | null | null | src/ado-drivers-connections.ads | Letractively/ada-ado | f0863c6975ae1a2c5349daee1e98a04fe11ba11e | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- ADO Drivers -- Database Drivers
-- Copyright (C) 2010, 2011, 2012 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Finalization;
with ADO.Statements;
with ADO.Schemas;
with Util.Properties;
with Util.Strings;
-- The <b>ADO.Drivers</b> package represents the database driver that will create
-- database connections and provide the database specific implementation.
package ADO.Drivers.Connections is
use ADO.Statements;
type Driver is abstract tagged limited private;
type Driver_Access is access all Driver'Class;
-- ------------------------------
-- Database connection implementation
-- ------------------------------
--
type Database_Connection is abstract new Ada.Finalization.Limited_Controlled with record
Count : Natural := 0;
Ident : String (1 .. 8) := (others => ' ');
end record;
type Database_Connection_Access is access all Database_Connection'Class;
function Create_Statement (Database : in Database_Connection;
Table : in ADO.Schemas.Class_Mapping_Access)
return Query_Statement_Access is abstract;
function Create_Statement (Database : in Database_Connection;
Query : in String)
return Query_Statement_Access is abstract;
-- Create a delete statement.
function Create_Statement (Database : in Database_Connection;
Table : in ADO.Schemas.Class_Mapping_Access)
return Delete_Statement_Access is abstract;
-- Create an insert statement.
function Create_Statement (Database : in Database_Connection;
Table : in ADO.Schemas.Class_Mapping_Access)
return Insert_Statement_Access is abstract;
-- Create an update statement.
function Create_Statement (Database : in Database_Connection;
Table : in ADO.Schemas.Class_Mapping_Access)
return Update_Statement_Access is abstract;
-- Start a transaction.
procedure Begin_Transaction (Database : in out Database_Connection) is abstract;
-- Commit the current transaction.
procedure Commit (Database : in out Database_Connection) is abstract;
-- Rollback the current transaction.
procedure Rollback (Database : in out Database_Connection) is abstract;
-- Load the database schema definition for the current database.
procedure Load_Schema (Database : in Database_Connection;
Schema : out ADO.Schemas.Schema_Definition) is abstract;
-- Get the database driver which manages this connection.
function Get_Driver (Database : in Database_Connection)
return Driver_Access is abstract;
-- Closes the database connection
procedure Close (Database : in out Database_Connection) is abstract;
-- ------------------------------
-- The database configuration properties
-- ------------------------------
type Configuration is new Ada.Finalization.Controlled with private;
type Configuration_Access is access all Configuration'Class;
-- Set the connection URL to connect to the database.
-- The driver connection is a string of the form:
--
-- driver://[host][:port]/[database][?property1][=value1]...
--
-- If the string is invalid or if the driver cannot be found,
-- the Connection_Error exception is raised.
procedure Set_Connection (Controller : in out Configuration;
URI : in String);
-- Set a property on the datasource for the driver.
-- The driver can retrieve the property to configure and open
-- the database connection.
procedure Set_Property (Controller : in out Configuration;
Name : in String;
Value : in String);
-- Get a property from the data source configuration.
-- If the property does not exist, an empty string is returned.
function Get_Property (Controller : in Configuration;
Name : in String) return String;
-- Get the server hostname.
function Get_Server (Controller : in Configuration) return String;
-- Get the server port.
function Get_Port (Controller : in Configuration) return Integer;
-- Get the database name.
function Get_Database (Controller : in Configuration) return String;
-- Create a new connection using the configuration parameters.
procedure Create_Connection (Config : in Configuration'Class;
Result : out Database_Connection_Access);
-- ------------------------------
-- Database Driver
-- ------------------------------
-- Create a new connection using the configuration parameters.
procedure Create_Connection (D : in out Driver;
Config : in Configuration'Class;
Result : out Database_Connection_Access) is abstract;
-- Get the driver unique index.
function Get_Driver_Index (D : in Driver) return Driver_Index;
-- Get the driver name.
function Get_Driver_Name (D : in Driver) return String;
-- Register a database driver.
procedure Register (Driver : in Driver_Access);
-- Get a database driver given its name.
function Get_Driver (Name : in String) return Driver_Access;
private
type Driver is abstract new Ada.Finalization.Limited_Controlled with record
Name : Util.Strings.Name_Access;
Index : Driver_Index;
end record;
type Configuration is new Ada.Finalization.Controlled with record
URI : Unbounded_String := Null_Unbounded_String;
Server : Unbounded_String := Null_Unbounded_String;
Port : Integer := 0;
Database : Unbounded_String := Null_Unbounded_String;
Properties : Util.Properties.Manager;
Driver : Driver_Access;
end record;
end ADO.Drivers.Connections;
| 40.670659 | 91 | 0.636779 |
df63983a91cbf2f4859e06275fb63b514dc4a084 | 170 | adb | Ada | src/examples/Rejuvenation_Workshop/src/math.adb | selroc/Renaissance-Ada | 39230b34aced4a9d83831be346ca103136c53715 | [
"BSD-3-Clause"
] | 1 | 2022-03-08T13:00:47.000Z | 2022-03-08T13:00:47.000Z | src/examples/Rejuvenation_Workshop/src/math.adb | selroc/Renaissance-Ada | 39230b34aced4a9d83831be346ca103136c53715 | [
"BSD-3-Clause"
] | null | null | null | src/examples/Rejuvenation_Workshop/src/math.adb | selroc/Renaissance-Ada | 39230b34aced4a9d83831be346ca103136c53715 | [
"BSD-3-Clause"
] | null | null | null | package body Math is
procedure Temp (x : Integer)
is
Square : constant Integer := x * x;
begin
pragma Unreferenced (Square);
end Temp;
end Math;
| 15.454545 | 40 | 0.623529 |
0e636e2eec8570003b0653a9447a30262626b2bf | 829 | adb | Ada | gdb/testsuite/gdb.ada/exec_changed/first.adb | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | 1 | 2020-10-14T03:24:35.000Z | 2020-10-14T03:24:35.000Z | gdb/testsuite/gdb.ada/exec_changed/first.adb | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | null | null | null | gdb/testsuite/gdb.ada/exec_changed/first.adb | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | null | null | null | -- Copyright 2005-2021 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
procedure First is
procedure Break_Me is
begin
null;
end Break_Me;
begin
Break_Me;
end First;
| 31.884615 | 73 | 0.728589 |
2320fc3c6553075dbde99a1b494b3a023c51e844 | 2,476 | ads | Ada | tools/xml2ayacc/encoding/auto/encodings-maps-cp_855.ads | faelys/gela-asis | 48a3bee90eda9f0c9d958b4e3c80a5a9b1c65253 | [
"BSD-3-Clause"
] | 4 | 2016-02-05T15:51:56.000Z | 2022-03-25T20:38:32.000Z | tools/xml2ayacc/encoding/auto/encodings-maps-cp_855.ads | faelys/gela-asis | 48a3bee90eda9f0c9d958b4e3c80a5a9b1c65253 | [
"BSD-3-Clause"
] | null | null | null | tools/xml2ayacc/encoding/auto/encodings-maps-cp_855.ads | faelys/gela-asis | 48a3bee90eda9f0c9d958b4e3c80a5a9b1c65253 | [
"BSD-3-Clause"
] | null | null | null | -- Auto generated file. Don't edit
-- Read copyright and license at the end of this file
package Encodings.Maps.CP_855 is
function Decode (Char : Character) return Wide_Character;
pragma Inline (Decode);
procedure Encode
(Text : in Wide_String;
Text_Last : out Natural;
Result : out Raw_String;
Result_Last : out Natural;
Map : in Encoding := Encodings.CP_855);
procedure Decode
(Text : in Raw_String;
Text_Last : out Natural;
Result : out Wide_String;
Result_Last : out Natural;
Map : in Encoding := Encodings.CP_855);
end Encodings.Maps.CP_855;
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, Maxim Reznik
-- 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 Maxim Reznik, 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 OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
| 45.851852 | 79 | 0.657916 |
23b1157846240759b817e43b69ee0066c7039a2b | 12,026 | adb | Ada | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-direio.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-direio.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-direio.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . D I R E C T _ I O --
-- --
-- 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 Ada.IO_Exceptions; use Ada.IO_Exceptions;
with Ada.Unchecked_Deallocation;
with Interfaces.C_Streams; use Interfaces.C_Streams;
with System; use System;
with System.CRTL;
with System.File_IO;
with System.Soft_Links;
package body System.Direct_IO is
package FIO renames System.File_IO;
package SSL renames System.Soft_Links;
subtype AP is FCB.AFCB_Ptr;
use type FCB.Shared_Status_Type;
use type System.CRTL.int64;
use type System.CRTL.size_t;
-----------------------
-- Local Subprograms --
-----------------------
procedure Set_Position (File : File_Type);
-- Sets file position pointer according to value of current index
-------------------
-- AFCB_Allocate --
-------------------
function AFCB_Allocate (Control_Block : Direct_AFCB) return FCB.AFCB_Ptr is
pragma Unreferenced (Control_Block);
begin
return new Direct_AFCB;
end AFCB_Allocate;
----------------
-- AFCB_Close --
----------------
-- No special processing required for Direct_IO close
procedure AFCB_Close (File : not null access Direct_AFCB) is
pragma Unreferenced (File);
begin
null;
end AFCB_Close;
---------------
-- AFCB_Free --
---------------
procedure AFCB_Free (File : not null access Direct_AFCB) is
type FCB_Ptr is access all Direct_AFCB;
FT : FCB_Ptr := FCB_Ptr (File);
procedure Free is new
Ada.Unchecked_Deallocation (Direct_AFCB, FCB_Ptr);
begin
Free (FT);
end AFCB_Free;
------------
-- Create --
------------
procedure Create
(File : in out File_Type;
Mode : FCB.File_Mode := FCB.Inout_File;
Name : String := "";
Form : String := "")
is
Dummy_File_Control_Block : Direct_AFCB;
pragma Warnings (Off, Dummy_File_Control_Block);
-- Yes, we know this is never assigned a value, only the tag is used for
-- dispatching purposes, so that's expected.
begin
FIO.Open (File_Ptr => AP (File),
Dummy_FCB => Dummy_File_Control_Block,
Mode => Mode,
Name => Name,
Form => Form,
Amethod => 'D',
Creat => True,
Text => False);
end Create;
-----------------
-- End_Of_File --
-----------------
function End_Of_File (File : File_Type) return Boolean is
begin
FIO.Check_Read_Status (AP (File));
return File.Index > Size (File);
end End_Of_File;
-----------
-- Index --
-----------
function Index (File : File_Type) return Positive_Count is
begin
FIO.Check_File_Open (AP (File));
return File.Index;
end Index;
----------
-- Open --
----------
procedure Open
(File : in out File_Type;
Mode : FCB.File_Mode;
Name : String;
Form : String := "")
is
Dummy_File_Control_Block : Direct_AFCB;
pragma Warnings (Off, Dummy_File_Control_Block);
-- Yes, we know this is never assigned a value, only the tag is used for
-- dispatching purposes, so that's expected.
begin
FIO.Open (File_Ptr => AP (File),
Dummy_FCB => Dummy_File_Control_Block,
Mode => Mode,
Name => Name,
Form => Form,
Amethod => 'D',
Creat => False,
Text => False);
end Open;
----------
-- Read --
----------
procedure Read
(File : File_Type;
Item : Address;
Size : Interfaces.C_Streams.size_t;
From : Positive_Count)
is
begin
Set_Index (File, From);
Read (File, Item, Size);
end Read;
procedure Read
(File : File_Type;
Item : Address;
Size : Interfaces.C_Streams.size_t)
is
begin
FIO.Check_Read_Status (AP (File));
-- If last operation was not a read, or if in file sharing mode,
-- then reset the physical pointer of the file to match the index
-- We lock out task access over the two operations in this case.
if File.Last_Op /= Op_Read
or else File.Shared_Status = FCB.Yes
then
if End_Of_File (File) then
raise End_Error;
end if;
Locked_Processing : begin
SSL.Lock_Task.all;
Set_Position (File);
FIO.Read_Buf (AP (File), Item, Size);
SSL.Unlock_Task.all;
exception
when others =>
SSL.Unlock_Task.all;
raise;
end Locked_Processing;
else
FIO.Read_Buf (AP (File), Item, Size);
end if;
File.Index := File.Index + 1;
-- Set last operation to read, unless we did not read a full record
-- (happens with the variant record case) in which case we set the
-- last operation as other, to force the file position to be reset
-- on the next read.
File.Last_Op := (if File.Bytes = Size then Op_Read else Op_Other);
end Read;
-- The following is the required overriding for Stream.Read, which is
-- not used, since we do not do Stream operations on Direct_IO files.
procedure Read
(File : in out Direct_AFCB;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset)
is
begin
raise Program_Error;
end Read;
-----------
-- Reset --
-----------
procedure Reset (File : in out File_Type; Mode : FCB.File_Mode) is
pragma Warnings (Off, File);
-- File is actually modified via Unrestricted_Access below, but
-- GNAT will generate a warning anyway.
--
-- Note that we do not use pragma Unmodified here, since in -gnatc mode,
-- GNAT will complain that File is modified for "File.Index := 1;"
begin
FIO.Reset (AP (File)'Unrestricted_Access, Mode);
File.Index := 1;
File.Last_Op := Op_Read;
end Reset;
procedure Reset (File : in out File_Type) is
pragma Warnings (Off, File);
-- See above (other Reset procedure) for explanations on this pragma
begin
FIO.Reset (AP (File)'Unrestricted_Access);
File.Index := 1;
File.Last_Op := Op_Read;
end Reset;
---------------
-- Set_Index --
---------------
procedure Set_Index (File : File_Type; To : Positive_Count) is
begin
FIO.Check_File_Open (AP (File));
File.Index := Count (To);
File.Last_Op := Op_Other;
end Set_Index;
------------------
-- Set_Position --
------------------
procedure Set_Position (File : File_Type) is
R : int;
begin
R :=
fseek64
(File.Stream, int64 (File.Bytes) * int64 (File.Index - 1), SEEK_SET);
if R /= 0 then
raise Use_Error;
end if;
end Set_Position;
----------
-- Size --
----------
function Size (File : File_Type) return Count is
Pos : int64;
begin
FIO.Check_File_Open (AP (File));
File.Last_Op := Op_Other;
if fseek64 (File.Stream, 0, SEEK_END) /= 0 then
raise Device_Error;
end if;
Pos := ftell64 (File.Stream);
if Pos = -1 then
raise Use_Error;
end if;
return Count (Pos / int64 (File.Bytes));
end Size;
-----------
-- Write --
-----------
procedure Write
(File : File_Type;
Item : Address;
Size : Interfaces.C_Streams.size_t;
Zeroes : System.Storage_Elements.Storage_Array)
is
procedure Do_Write;
-- Do the actual write
--------------
-- Do_Write --
--------------
procedure Do_Write is
begin
FIO.Write_Buf (AP (File), Item, Size);
-- If we did not write the whole record (happens with the variant
-- record case), then fill out the rest of the record with zeroes.
-- This is cleaner in any case, and is required for the last
-- record, since otherwise the length of the file is wrong.
if File.Bytes > Size then
FIO.Write_Buf (AP (File), Zeroes'Address, File.Bytes - Size);
end if;
end Do_Write;
-- Start of processing for Write
begin
FIO.Check_Write_Status (AP (File));
-- If last operation was not a write, or if in file sharing mode,
-- then reset the physical pointer of the file to match the index
-- We lock out task access over the two operations in this case.
if File.Last_Op /= Op_Write
or else File.Shared_Status = FCB.Yes
then
Locked_Processing : begin
SSL.Lock_Task.all;
Set_Position (File);
Do_Write;
SSL.Unlock_Task.all;
exception
when others =>
SSL.Unlock_Task.all;
raise;
end Locked_Processing;
else
Do_Write;
end if;
File.Index := File.Index + 1;
-- Set last operation to write, unless we did not read a full record
-- (happens with the variant record case) in which case we set the
-- last operation as other, to force the file position to be reset
-- on the next write.
File.Last_Op := (if File.Bytes = Size then Op_Write else Op_Other);
end Write;
-- The following is the required overriding for Stream.Write, which is
-- not used, since we do not do Stream operations on Direct_IO files.
procedure Write
(File : in out Direct_AFCB;
Item : Ada.Streams.Stream_Element_Array)
is
begin
raise Program_Error;
end Write;
end System.Direct_IO;
| 30.065 | 79 | 0.527274 |
0e702c76d27773cc3df83eeaa0d616d3276aedb7 | 7,507 | ads | Ada | src/gl/interface/gl-objects-framebuffers.ads | Roldak/OpenGLAda | 6807605b7321249d71286fa25231bdfd537d3eac | [
"MIT"
] | 79 | 2015-04-20T23:10:02.000Z | 2022-03-04T13:50:56.000Z | src/gl/interface/gl-objects-framebuffers.ads | Roldak/OpenGLAda | 6807605b7321249d71286fa25231bdfd537d3eac | [
"MIT"
] | 126 | 2015-09-10T10:41:34.000Z | 2022-03-20T11:25:40.000Z | src/gl/interface/gl-objects-framebuffers.ads | Roldak/OpenGLAda | 6807605b7321249d71286fa25231bdfd537d3eac | [
"MIT"
] | 20 | 2015-03-17T07:15:57.000Z | 2022-02-02T17:12:11.000Z | -- part of OpenGLAda, (c) 2017 Felix Krause
-- released under the terms of the MIT license, see the file "COPYING"
with GL.Buffers;
with GL.Objects.Renderbuffers;
with GL.Objects.Textures;
private with GL.Low_Level.Enums;
package GL.Objects.Framebuffers is
pragma Preelaborate;
type Framebuffer_Status is (Undefined, Complete, Incomplete_Attachment,
Incomplete_Missing_Attachment,
Incomplete_Draw_Buffer, Incomplete_Read_Buffer,
Unsupported, Incomplete_Multisample,
Incomplete_Layer_Targets);
type Attachment_Point is (Depth_Stencil_Attachment,
Color_Attachment_0, Color_Attachment_1,
Color_Attachment_2, Color_Attachment_3,
Color_Attachment_4, Color_Attachment_5,
Color_Attachment_6, Color_Attachment_7,
Color_Attachment_8, Color_Attachment_9,
Color_Attachment_10, Color_Attachment_11,
Color_Attachment_12, Color_Attachment_13,
Color_Attachment_14, Color_Attachment_15,
Depth_Attachment, Stencil_Attachment);
type Attachment_List is array (Positive range <>) of Attachment_Point;
type Framebuffer_Target (<>) is tagged limited private;
function Status (Target : Framebuffer_Target) return Framebuffer_Status;
procedure Attach_Renderbuffer (Target : Framebuffer_Target;
Attachment : Attachment_Point;
Object : Renderbuffers.Renderbuffer'Class);
procedure Attach_Texture (Target : Framebuffer_Target;
Attachment : Attachment_Point;
Object : Textures.Texture'Class;
Level : Textures.Mipmap_Level);
procedure Attach_Texture_Layer (Target : Framebuffer_Target;
Attachment : Attachment_Point;
Object : Textures.Texture'Class;
Level : Textures.Mipmap_Level;
Layer : Int);
procedure Invalidate (Target : in out Framebuffer_Target;
Attachments : Attachment_List);
procedure Invalidate_Sub (Target : in out Framebuffer_Target;
Attachments : Attachment_List;
X, Y : Int;
Width, Height : Size);
procedure Set_Default_Width (Target : in out Framebuffer_Target;
Value : Size);
function Default_Width (Target : Framebuffer_Target) return Size;
function Max_Framebuffer_Width return Size;
procedure Set_Default_Height (Target : in out Framebuffer_Target;
Value : Size);
function Default_Height (Target : Framebuffer_Target) return Size;
function Max_Framebuffer_Height return Size;
procedure Set_Default_Layers (Target : in out Framebuffer_Target;
Value : Size);
function Default_Layers (Target : Framebuffer_Target) return Size;
function Max_Framebuffer_Layers return Size;
procedure Set_Default_Samples (Target : in out Framebuffer_Target;
Value : Size);
function Default_Samples
(Target : Framebuffer_Target) return Size;
function Max_Framebuffer_Samples return Size;
procedure Set_Default_Fixed_Sample_Locactions
(Target : in out Framebuffer_Target; Value : Boolean);
function Default_Fixed_Sample_Locations (Target : Framebuffer_Target)
return Boolean;
-- copy from current Read to current Draw framebuffer
procedure Blit (Src_X0, Src_Y0, Src_X1, Src_Y1,
Dst_X0, Dst_Y0, Dst_X1, Dst_Y1 : Int;
Mask : Buffers.Buffer_Bits;
Filter : Textures.Magnifying_Function);
type Framebuffer is new GL_Object with private;
procedure Bind (Target : Framebuffer_Target;
Object : Framebuffer'Class);
function Current (Target : Framebuffer_Target) return Framebuffer'Class;
Read_Target : constant Framebuffer_Target;
Draw_Target : constant Framebuffer_Target;
Read_And_Draw_Target : constant Framebuffer_Target;
Default_Framebuffer : constant Framebuffer;
private
for Framebuffer_Status use (Undefined => 16#8219#,
Complete => 16#8CD5#,
Incomplete_Attachment => 16#8CD6#,
Incomplete_Missing_Attachment => 16#8CD7#,
Incomplete_Draw_Buffer => 16#8CDB#,
Incomplete_Read_Buffer => 16#8CDC#,
Unsupported => 16#8CDD#,
Incomplete_Multisample => 16#8D56#,
Incomplete_Layer_Targets => 16#8DA8#);
for Framebuffer_Status'Size use Low_Level.Enum'Size;
for Attachment_Point use (Depth_Stencil_Attachment => 16#821A#,
Color_Attachment_0 => 16#8CE0#,
Color_Attachment_1 => 16#8CE1#,
Color_Attachment_2 => 16#8CE2#,
Color_Attachment_3 => 16#8CE3#,
Color_Attachment_4 => 16#8CE4#,
Color_Attachment_5 => 16#8CE5#,
Color_Attachment_6 => 16#8CE6#,
Color_Attachment_7 => 16#8CE7#,
Color_Attachment_8 => 16#8CE8#,
Color_Attachment_9 => 16#8CE9#,
Color_Attachment_10 => 16#8CEA#,
Color_Attachment_11 => 16#8CEB#,
Color_Attachment_12 => 16#8CEC#,
Color_Attachment_13 => 16#8CED#,
Color_Attachment_14 => 16#8CEE#,
Color_Attachment_15 => 16#8CEF#,
Depth_Attachment => 16#8D00#,
Stencil_Attachment => 16#8D01#);
for Attachment_Point'Size use Low_Level.Enum'Size;
pragma Convention (C, Attachment_List);
type Framebuffer is new GL_Object with null record;
overriding
procedure Internal_Create_Id (Object : Framebuffer; Id : out UInt);
overriding
procedure Internal_Release_Id (Object : Framebuffer; Id : UInt);
type Framebuffer_Target (Kind : Low_Level.Enums.Framebuffer_Kind) is
tagged limited null record;
Read_Target : constant Framebuffer_Target :=
Framebuffer_Target'(Kind => Low_Level.Enums.Read);
Draw_Target : constant Framebuffer_Target :=
Framebuffer_Target'(Kind => Low_Level.Enums.Draw);
Read_And_Draw_Target : constant Framebuffer_Target :=
Framebuffer_Target'(Kind => Low_Level.Enums.Read_Draw);
Default_Framebuffer : constant Framebuffer :=
Framebuffer'(Ada.Finalization.Controlled with Reference =>
Reference_To_Null_Object'Access);
end GL.Objects.Framebuffers;
| 46.91875 | 78 | 0.569468 |
0ef2b2d36a85aa439a5c8d1c500d9613ce4e95e0 | 758 | ads | Ada | source/tasking/a-tasatt.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 33 | 2015-04-04T09:19:36.000Z | 2021-11-10T05:33:34.000Z | source/tasking/a-tasatt.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 8 | 2017-11-14T13:05:07.000Z | 2018-08-09T15:28:49.000Z | source/tasking/a-tasatt.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 9 | 2015-02-03T17:09:53.000Z | 2021-11-12T01:16:05.000Z | pragma License (Unrestricted);
with Ada.Task_Identification; -- use Ada.Task_Identification;
generic
type Attribute is private;
Initial_Value : Attribute;
package Ada.Task_Attributes is
type Attribute_Handle is access all Attribute;
function Value (
T : Task_Identification.Task_Id := Task_Identification.Current_Task)
return Attribute;
function Reference (
T : Task_Identification.Task_Id := Task_Identification.Current_Task)
return not null Attribute_Handle;
procedure Set_Value (
Val : Attribute;
T : Task_Identification.Task_Id := Task_Identification.Current_Task);
procedure Reinitialize (
T : Task_Identification.Task_Id := Task_Identification.Current_Task);
end Ada.Task_Attributes;
| 30.32 | 75 | 0.754617 |
0e6151d806e55bc5c6ff4f3274d573b15a06f5d4 | 4,694 | adb | Ada | llvm-gcc-4.2-2.9/gcc/ada/s-caun64.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | 1 | 2016-04-09T02:58:13.000Z | 2016-04-09T02:58:13.000Z | llvm-gcc-4.2-2.9/gcc/ada/s-caun64.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | llvm-gcc-4.2-2.9/gcc/ada/s-caun64.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY COMPONENTS --
-- --
-- S Y S T E M . C O M P A R E _ A R R A Y _ U N S I G N E D _ 6 4 --
-- --
-- B o d y --
-- --
-- Copyright (C) 2002-2005 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 2, 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 COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Address_Operations; use System.Address_Operations;
with Unchecked_Conversion;
package body System.Compare_Array_Unsigned_64 is
type Word is mod 2 ** 64;
-- Used to process operands by words
type Uword is record
W : Word;
end record;
pragma Pack (Uword);
for Uword'Alignment use 1;
-- Used to process operands when unaligned
type WP is access Word;
type UP is access Uword;
function W is new Unchecked_Conversion (Address, WP);
function U is new Unchecked_Conversion (Address, UP);
-----------------------
-- Compare_Array_U64 --
-----------------------
function Compare_Array_U64
(Left : System.Address;
Right : System.Address;
Left_Len : Natural;
Right_Len : Natural) return Integer
is
Clen : Natural := Natural'Min (Left_Len, Right_Len);
-- Number of elements left to compare
L : Address := Left;
R : Address := Right;
-- Pointers to next elements to compare
begin
-- Case of going by aligned double words
if ModA (OrA (Left, Right), 8) = 0 then
while Clen /= 0 loop
if W (L).all /= W (R).all then
if W (L).all > W (R).all then
return +1;
else
return -1;
end if;
end if;
Clen := Clen - 1;
L := AddA (L, 8);
R := AddA (R, 8);
end loop;
-- Case of going by unaligned double words
else
while Clen /= 0 loop
if U (L).W /= U (R).W then
if U (L).W > U (R).W then
return +1;
else
return -1;
end if;
end if;
Clen := Clen - 1;
L := AddA (L, 8);
R := AddA (R, 8);
end loop;
end if;
-- Here if common section equal, result decided by lengths
if Left_Len = Right_Len then
return 0;
elsif Left_Len > Right_Len then
return +1;
else
return -1;
end if;
end Compare_Array_U64;
end System.Compare_Array_Unsigned_64;
| 38.793388 | 78 | 0.463144 |
239dceaed1dfeb55e33e24899414c2852acd07fd | 4,447 | ads | Ada | source/nodes/program-nodes-formal_ordinary_fixed_point_definitions.ads | optikos/oasis | 9f64d46d26d964790d69f9db681c874cfb3bf96d | [
"MIT"
] | null | null | null | source/nodes/program-nodes-formal_ordinary_fixed_point_definitions.ads | optikos/oasis | 9f64d46d26d964790d69f9db681c874cfb3bf96d | [
"MIT"
] | null | null | null | source/nodes/program-nodes-formal_ordinary_fixed_point_definitions.ads | optikos/oasis | 9f64d46d26d964790d69f9db681c874cfb3bf96d | [
"MIT"
] | 2 | 2019-09-14T23:18:50.000Z | 2019-10-02T10:11:40.000Z | -- Copyright (c) 2019 Maxim Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Formal_Ordinary_Fixed_Point_Definitions;
with Program.Element_Visitors;
package Program.Nodes.Formal_Ordinary_Fixed_Point_Definitions is
pragma Preelaborate;
type Formal_Ordinary_Fixed_Point_Definition is
new Program.Nodes.Node
and Program.Elements.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition
and Program.Elements.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition_Text
with private;
function Create
(Delta_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access)
return Formal_Ordinary_Fixed_Point_Definition;
type Implicit_Formal_Ordinary_Fixed_Point_Definition is
new Program.Nodes.Node
and Program.Elements.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition
with private;
function Create
(Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Formal_Ordinary_Fixed_Point_Definition
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Formal_Ordinary_Fixed_Point_Definition is
abstract new Program.Nodes.Node
and Program.Elements.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition
with null record;
procedure Initialize
(Self : aliased in out Base_Formal_Ordinary_Fixed_Point_Definition'Class);
overriding procedure Visit
(Self : not null access Base_Formal_Ordinary_Fixed_Point_Definition;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Is_Formal_Ordinary_Fixed_Point_Definition_Element
(Self : Base_Formal_Ordinary_Fixed_Point_Definition)
return Boolean;
overriding function Is_Formal_Type_Definition_Element
(Self : Base_Formal_Ordinary_Fixed_Point_Definition)
return Boolean;
overriding function Is_Definition_Element
(Self : Base_Formal_Ordinary_Fixed_Point_Definition)
return Boolean;
type Formal_Ordinary_Fixed_Point_Definition is
new Base_Formal_Ordinary_Fixed_Point_Definition
and Program.Elements.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition_Text
with record
Delta_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
Box_Token : not null Program.Lexical_Elements.Lexical_Element_Access;
end record;
overriding function To_Formal_Ordinary_Fixed_Point_Definition_Text
(Self : aliased in out Formal_Ordinary_Fixed_Point_Definition)
return Program.Elements.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition_Text_Access;
overriding function Delta_Token
(Self : Formal_Ordinary_Fixed_Point_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Box_Token
(Self : Formal_Ordinary_Fixed_Point_Definition)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Formal_Ordinary_Fixed_Point_Definition is
new Base_Formal_Ordinary_Fixed_Point_Definition
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Formal_Ordinary_Fixed_Point_Definition_Text
(Self : aliased in out Implicit_Formal_Ordinary_Fixed_Point_Definition)
return Program.Elements.Formal_Ordinary_Fixed_Point_Definitions
.Formal_Ordinary_Fixed_Point_Definition_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Formal_Ordinary_Fixed_Point_Definition)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Formal_Ordinary_Fixed_Point_Definition)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Formal_Ordinary_Fixed_Point_Definition)
return Boolean;
end Program.Nodes.Formal_Ordinary_Fixed_Point_Definitions;
| 38.336207 | 79 | 0.786148 |
4a098c85e0b4238dc708524d2473d2484cbc7b1e | 5,843 | adb | Ada | .emacs.d/elpa/wisi-2.1.1/wisitoken-wisi_ada.adb | caqg/linux-home | eed631aae6f5e59e4f46e14f1dff443abca5fa28 | [
"Linux-OpenIB"
] | null | null | null | .emacs.d/elpa/wisi-2.1.1/wisitoken-wisi_ada.adb | caqg/linux-home | eed631aae6f5e59e4f46e14f1dff443abca5fa28 | [
"Linux-OpenIB"
] | null | null | null | .emacs.d/elpa/wisi-2.1.1/wisitoken-wisi_ada.adb | caqg/linux-home | eed631aae6f5e59e4f46e14f1dff443abca5fa28 | [
"Linux-OpenIB"
] | null | null | null | -- Abstract :
--
-- see spec
--
-- Copyright (C) 2013, 2014, 2015, 2017, 2018 Free Software Foundation, Inc.
--
-- This file is part of the WisiToken package.
--
-- The WisiToken package is free software; you can redistribute it
-- and/or modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation; either version 3, or
-- (at your option) any later version. The WisiToken package 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 distributed with the WisiToken package;
-- see file GPL.txt. If not, write to the Free Software Foundation,
-- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- As a special exception, if other files instantiate generics from
-- this unit, or you link this unit with other files to produce an
-- executable, this unit does not by itself cause the resulting
-- executable to be covered by the GNU General Public License. This
-- exception does not however invalidate any other reasons why the
-- executable file might be covered by the GNU Public License.
pragma License (Modified_GPL);
package body WisiToken.Wisi_Ada is
use WisiToken.Productions;
function Only (Item : in Token_ID) return WisiToken.Token_ID_Arrays.Vector
is begin
return Result : WisiToken.Token_ID_Arrays.Vector do
Result.Append (Item);
end return;
end Only;
function "&" (Left : in Token_ID; Right : in Token_ID) return WisiToken.Token_ID_Arrays.Vector
is begin
return Result : WisiToken.Token_ID_Arrays.Vector do
Result.Append (Left);
Result.Append (Right);
end return;
end "&";
function "+" (Tokens : in Token_ID_Arrays.Vector; Action : in Syntax_Trees.Semantic_Action) return Right_Hand_Side
is begin
return (Tokens, Action, null);
end "+";
function "+" (Tokens : in Token_ID; Action : in Syntax_Trees.Semantic_Action) return Right_Hand_Side
is begin
return (Only (Tokens), Action, null);
end "+";
function "+" (Action : in Syntax_Trees.Semantic_Action) return Right_Hand_Side
is begin
return (Token_ID_Arrays.Empty_Vector, Action, null);
end "+";
function Only (Item : in WisiToken.Productions.Right_Hand_Side) return WisiToken.Productions.RHS_Arrays.Vector
is begin
return Result : WisiToken.Productions.RHS_Arrays.Vector do
Result.Append (Item);
end return;
end Only;
function "or"
(Left : in WisiToken.Productions.Instance;
Right : in WisiToken.Productions.Right_Hand_Side)
return WisiToken.Productions.Instance
is begin
return Result : WisiToken.Productions.Instance := Left do
Result.RHSs.Append (Right);
end return;
end "or";
function "<=" (LHS : in Token_ID; RHSs : in WisiToken.Productions.RHS_Arrays.Vector) return Instance
is begin
return (LHS, RHSs);
end "<=";
function Only (Subject : in Instance) return Prod_Arrays.Vector
is begin
return Result : Prod_Arrays.Vector do
Result.Set_First (Subject.LHS);
Result.Set_Last (Subject.LHS);
Result (Subject.LHS) := Subject;
end return;
end Only;
function Merge (Left, Right : in Instance) return Instance
is
Index : Integer := Left.RHSs.Last_Index + 1;
begin
return Result : Instance := Left do
Result.RHSs.Set_Last (Left.RHSs.Last_Index + Integer (Right.RHSs.Length));
for RHS of Right.RHSs loop
Result.RHSs (Index) := RHS;
Index := Index + 1;
end loop;
end return;
end Merge;
function "and" (Left : in Instance; Right : in Instance) return Prod_Arrays.Vector
is begin
return Result : Prod_Arrays.Vector do
Result.Set_First (Token_ID'Min (Left.LHS, Right.LHS));
Result.Set_Last (Token_ID'Max (Left.LHS, Right.LHS));
if Left.LHS = Right.LHS then
Result (Left.LHS) := Merge (Left, Right);
else
Result (Left.LHS) := Left;
Result (Right.LHS) := Right;
end if;
end return;
end "and";
function "and" (Left : in Prod_Arrays.Vector; Right : in Instance) return Prod_Arrays.Vector
is begin
return Result : Prod_Arrays.Vector := Left do
if Right.LHS < Result.First_Index then
Result.Set_First (Right.LHS);
elsif Right.LHS > Result.Last_Index then
Result.Set_Last (Right.LHS);
end if;
if Result (Right.LHS).LHS = Invalid_Token_ID then
Result (Right.LHS) := Right;
else
Result (Right.LHS) := Merge (Result (Right.LHS), Right);
end if;
end return;
end "and";
function "and" (Left : in Prod_Arrays.Vector; Right : in Prod_Arrays.Vector) return Prod_Arrays.Vector
is begin
return Result : Prod_Arrays.Vector := Left do
if Right.First_Index < Result.First_Index then
Result.Set_First (Right.First_Index);
elsif Right.First_Index > Result.Last_Index then
Result.Set_Last (Right.First_Index);
end if;
if Right.Last_Index < Result.First_Index then
Result.Set_First (Right.Last_Index);
elsif Right.Last_Index > Result.Last_Index then
Result.Set_Last (Right.Last_Index);
end if;
for P of Right loop
if Result (P.LHS).LHS = Invalid_Token_ID then
Result (P.LHS) := P;
else
Result (P.LHS) := Merge (Result (P.LHS), P);
end if;
end loop;
end return;
end "and";
end WisiToken.Wisi_Ada;
| 35.846626 | 117 | 0.655485 |
df964044ea8b532ef15fb1c75a39b793c20d55b2 | 12,441 | ads | Ada | llvm-gcc-4.2-2.9/gcc/ada/prj-attr.ads | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | 1 | 2016-04-09T02:58:13.000Z | 2016-04-09T02:58:13.000Z | llvm-gcc-4.2-2.9/gcc/ada/prj-attr.ads | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | llvm-gcc-4.2-2.9/gcc/ada/prj-attr.ads | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J . A T T R --
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2005, 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 2, 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 COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package defines packages and attributes in GNAT project files.
-- There are predefined packages and attributes.
-- It is also possible to define new packages with their attributes
with Table;
package Prj.Attr is
procedure Initialize;
-- Initialize the predefined project level attributes and the predefined
-- packages and their attribute. This procedure should be called by
-- Prj.Initialize.
type Attribute_Kind is
(Unknown,
Single,
Associative_Array,
Optional_Index_Associative_Array,
Case_Insensitive_Associative_Array,
Optional_Index_Case_Insensitive_Associative_Array);
-- Characteristics of an attribute. Optional_Index indicates that there
-- may be an optional index in the index of the associative array, as in
-- for Switches ("files.ada" at 2) use ...
subtype Defined_Attribute_Kind is Attribute_Kind
range Single .. Optional_Index_Case_Insensitive_Associative_Array;
-- Subset of Attribute_Kinds that may be used for the attributes that is
-- used when defining a new package.
Max_Attribute_Name_Length : constant := 64;
-- The maximum length of attribute names
subtype Attribute_Name_Length is
Positive range 1 .. Max_Attribute_Name_Length;
type Attribute_Data (Name_Length : Attribute_Name_Length := 1) is record
Name : String (1 .. Name_Length);
-- The name of the attribute
Attr_Kind : Defined_Attribute_Kind;
-- The type of the attribute
Index_Is_File_Name : Boolean;
-- For associative arrays, indicate if the index is a file name, so
-- that the attribute kind may be modified depending on the case
-- sensitivity of file names. This is only taken into account when
-- Attr_Kind is Associative_Array or Optional_Index_Associative_Array.
Opt_Index : Boolean;
-- True if there may be an optional index in the value of the index,
-- as in:
-- "file.ada" at 2
-- ("main.adb", "file.ada" at 1)
Var_Kind : Defined_Variable_Kind;
-- The attribute value kind: single or list
end record;
-- Name and characteristics of an attribute in a package registered
-- explicitly with Register_New_Package (see below).
type Attribute_Data_Array is array (Positive range <>) of Attribute_Data;
-- A list of attribute name/characteristics to be used as parameter of
-- procedure Register_New_Package below.
-- In the subprograms below, when it is specified that the subprogram
-- "fails", procedure Prj.Com.Fail is called. Unless it is specified
-- otherwise, if Prj.Com.Fail returns, exception Prj.Prj_Error is raised.
procedure Register_New_Package
(Name : String;
Attributes : Attribute_Data_Array);
-- Add a new package with its attributes. This procedure can only be
-- called after Initialize, but before any other call to a service of
-- the Project Manager. Fail if the name of the package is empty or not
-- unique, or if the names of the attributes are not different.
----------------
-- Attributes --
----------------
type Attribute_Node_Id is private;
-- The type to refers to an attribute, self-initialized
Empty_Attribute : constant Attribute_Node_Id;
-- Indicates no attribute. Default value of Attribute_Node_Id objects.
Attribute_First : constant Attribute_Node_Id;
-- First attribute node id of project level attributes
function Attribute_Node_Id_Of
(Name : Name_Id;
Starting_At : Attribute_Node_Id) return Attribute_Node_Id;
-- Returns the node id of an attribute at the project level or in
-- a package. Starting_At indicates the first known attribute node where
-- to start the search. Returns Empty_Attribute if the attribute cannot
-- be found.
function Attribute_Kind_Of
(Attribute : Attribute_Node_Id) return Attribute_Kind;
-- Returns the attribute kind of a known attribute. Returns Unknown if
-- Attribute is Empty_Attribute.
procedure Set_Attribute_Kind_Of
(Attribute : Attribute_Node_Id;
To : Attribute_Kind);
-- Set the attribute kind of a known attribute. Does nothing if
-- Attribute is Empty_Attribute.
function Attribute_Name_Of (Attribute : Attribute_Node_Id) return Name_Id;
-- Returns the name of a known attribute. Returns No_Name if Attribute is
-- Empty_Attribute.
function Variable_Kind_Of
(Attribute : Attribute_Node_Id) return Variable_Kind;
-- Returns the variable kind of a known attribute. Returns Undefined if
-- Attribute is Empty_Attribute.
procedure Set_Variable_Kind_Of
(Attribute : Attribute_Node_Id;
To : Variable_Kind);
-- Set the variable kind of a known attribute. Does nothing if Attribute is
-- Empty_Attribute.
function Optional_Index_Of (Attribute : Attribute_Node_Id) return Boolean;
-- Returns True if Attribute is a known attribute and may have an
-- optional index. Returns False otherwise.
function Next_Attribute
(After : Attribute_Node_Id) return Attribute_Node_Id;
-- Returns the attribute that follow After in the list of project level
-- attributes or the list of attributes in a package.
-- Returns Empty_Attribute if After is either Empty_Attribute or is the
-- last of the list.
--------------
-- Packages --
--------------
type Package_Node_Id is private;
-- Type to refer to a package, self initialized
Empty_Package : constant Package_Node_Id;
-- Default value of Package_Node_Id objects
procedure Register_New_Package (Name : String; Id : out Package_Node_Id);
-- Add a new package. Fails if Name (the package name) is empty or is
-- already the name of a package, and set Id to Empty_Package,
-- if Prj.Com.Fail returns. Initially, the new package has no attributes.
-- Id may be used to add attributes using procedure Register_New_Attribute
-- below.
procedure Register_New_Attribute
(Name : String;
In_Package : Package_Node_Id;
Attr_Kind : Defined_Attribute_Kind;
Var_Kind : Defined_Variable_Kind;
Index_Is_File_Name : Boolean := False;
Opt_Index : Boolean := False);
-- Add a new attribute to registered package In_Package. Fails if Name
-- (the attribute name) is empty, if In_Package is Empty_Package or if
-- the attribute name has a duplicate name. See definition of type
-- Attribute_Data above for the meaning of parameters Attr_Kind, Var_Kind,
-- Index_Is_File_Name and Opt_Index.
function Package_Node_Id_Of (Name : Name_Id) return Package_Node_Id;
-- Returns the package node id of the package with name Name. Returns
-- Empty_Package if there is no package with this name.
function First_Attribute_Of
(Pkg : Package_Node_Id) return Attribute_Node_Id;
-- Returns the first attribute in the list of attributes of package Pkg.
-- Returns Empty_Attribute if Pkg is Empty_Package.
private
----------------
-- Attributes --
----------------
Attributes_Initial : constant := 50;
Attributes_Increment : constant := 50;
Attribute_Node_Low_Bound : constant := 0;
Attribute_Node_High_Bound : constant := 099_999_999;
type Attr_Node_Id is
range Attribute_Node_Low_Bound .. Attribute_Node_High_Bound;
-- Index type for table Attrs in the body
type Attribute_Node_Id is record
Value : Attr_Node_Id := Attribute_Node_Low_Bound;
end record;
-- Full declaration of self-initialized private type
Empty_Attr : constant Attr_Node_Id := Attribute_Node_Low_Bound;
Empty_Attribute : constant Attribute_Node_Id := (Value => Empty_Attr);
First_Attribute : constant Attr_Node_Id := Attribute_Node_Low_Bound + 1;
First_Attribute_Node_Id : constant Attribute_Node_Id :=
(Value => First_Attribute);
Attribute_First : constant Attribute_Node_Id := First_Attribute_Node_Id;
--------------
-- Packages --
--------------
Packages_Initial : constant := 10;
Packages_Increment : constant := 50;
Package_Node_Low_Bound : constant := 0;
Package_Node_High_Bound : constant := 099_999_999;
type Pkg_Node_Id is
range Package_Node_Low_Bound .. Package_Node_High_Bound;
-- Index type for table Package_Attributes in the body
type Package_Node_Id is record
Value : Pkg_Node_Id := Package_Node_Low_Bound;
end record;
-- Full declaration of self-initialized private type
Empty_Pkg : constant Pkg_Node_Id := Package_Node_Low_Bound;
Empty_Package : constant Package_Node_Id := (Value => Empty_Pkg);
First_Package : constant Pkg_Node_Id := Package_Node_Low_Bound + 1;
First_Package_Node_Id : constant Package_Node_Id :=
(Value => First_Package);
Package_First : constant Package_Node_Id := First_Package_Node_Id;
----------------
-- Attributes --
----------------
type Attribute_Record is record
Name : Name_Id;
Var_Kind : Variable_Kind;
Optional_Index : Boolean;
Attr_Kind : Attribute_Kind;
Next : Attr_Node_Id;
end record;
-- Data for an attribute
package Attrs is
new Table.Table (Table_Component_Type => Attribute_Record,
Table_Index_Type => Attr_Node_Id,
Table_Low_Bound => First_Attribute,
Table_Initial => Attributes_Initial,
Table_Increment => Attributes_Increment,
Table_Name => "Prj.Attr.Attrs");
-- The table of the attributes
--------------
-- Packages --
--------------
type Package_Record is record
Name : Name_Id;
Known : Boolean := True;
First_Attribute : Attr_Node_Id;
end record;
-- Data for a package
package Package_Attributes is
new Table.Table (Table_Component_Type => Package_Record,
Table_Index_Type => Pkg_Node_Id,
Table_Low_Bound => First_Package,
Table_Initial => Packages_Initial,
Table_Increment => Packages_Increment,
Table_Name => "Prj.Attr.Packages");
-- The table of the packages
end Prj.Attr;
| 40.656863 | 79 | 0.627361 |
dfa57b214c3281c61f88743af6448053ff410cab | 5,917 | ads | Ada | src/xdg.ads | darkestkhan/xdg | 37d9dcbdb1896dcdf1f9c35150ae730a117ed58b | [
"0BSD"
] | 2 | 2015-01-05T22:35:41.000Z | 2015-03-14T00:06:05.000Z | src/xdg.ads | darkestkhan/xdg | 37d9dcbdb1896dcdf1f9c35150ae730a117ed58b | [
"0BSD"
] | null | null | null | src/xdg.ads | darkestkhan/xdg | 37d9dcbdb1896dcdf1f9c35150ae730a117ed58b | [
"0BSD"
] | null | null | null | ------------------------------------------------------------------------------
-- EMAIL: <[email protected]> --
-- License: ISC License (see COPYING file) --
-- --
-- Copyright © 2014 - 2015 darkestkhan --
------------------------------------------------------------------------------
-- Permission to use, copy, modify, and/or distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- The software is provided "as is" and the author disclaims all warranties --
-- with regard to this software including all implied warranties of --
-- merchantability and fitness. In no event shall the author be liable for --
-- any special, direct, indirect, or consequential damages or any damages --
-- whatsoever resulting from loss of use, data or profits, whether in an --
-- action of contract, negligence or other tortious action, arising out of --
-- or in connection with the use or performance of this software. --
------------------------------------------------------------------------------
----------------------------------------------------------------------------
-- This package implements functionality pertaining to XDG Base --
-- Directories Specification. --
-- <http://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html> --
----------------------------------------------------------------------------
---------------------------------------------------------------------------
-- FIXME: Create_* and Delete_* subprograms should check if Directory passed
-- is valid directory inside appropriate place (that is, ie. to prevent
-- deletion of "../../").
---------------------------------------------------------------------------
package XDG is
----------------------------------------------------------------------------
-- NOTE: All functions returning pathname are making sure last character of
-- said pathname is '/' (or '\' in case of Windows).
----------------------------------------------------------------------------
-- Directory in which user specific data files should be stored.
function Data_Home return String;
-- As above but for configuration files.
function Config_Home return String;
-- As above but for non-essential data files.
function Cache_Home return String;
-- As above but for non-essential runtime files.
-- Returns null string in case XDG_RUNTIME_DIR is not set.
function Runtime_Dir return String;
----------------------------------------------------------------------------
-- Preference ordered set of base directories to search for data files
-- in addition to Data_Home. Directories are separated by ':'.
-- NOTE: Default value for Windows is "".
function Data_Dirs return String;
-- As above but for config files.
function Config_Dirs return String;
----------------------------------------------------------------------------
-- NOTE: Subprograms below work only within XDG base directories.
-- For example: Data_Home (Directory) will return path resultant of
-- ${XDG_DATA_HOME}/${DIRECTORY}.
-- NOTE: Subprogram operating on XDG_RUNTIME_DIR will raise No_Runtime_Dir
-- exception if there is no XDG_RUNTIME_DIR environment variable defined.
----------------------------------------------------------------------------
-- These functions return path to directory.
function Data_Home (Directory: in String) return String;
function Config_Home (Directory: in String) return String;
function Cache_Home (Directory: in String) return String;
function Runtime_Dir (Directory: in String) return String;
No_Runtime_Dir: exception;
----------------------------------------------------------------------------
-- These procedures create path to directory. If target Directory already
-- exists nothing will happen.
procedure Create_Data_Home (Directory: in String);
procedure Create_Config_Home (Directory: in String);
procedure Create_Cache_Home (Directory: in String);
procedure Create_Runtime_Dir (Directory: in String);
----------------------------------------------------------------------------
-- These procedures delete directory. If Empty_Only is true Directory will
-- be deleted only when empty, otherwise will delete Directory with its entire
-- content.
procedure Delete_Data_Home
( Directory : in String;
Empty_Only: in Boolean := True
);
procedure Delete_Config_Home
( Directory : in String;
Empty_Only: in Boolean := True
);
procedure Delete_Cache_Home
( Directory : in String;
Empty_Only: in Boolean := True
);
procedure Delete_Runtime_Dir
( Directory : in String;
Empty_Only: in Boolean := True
);
----------------------------------------------------------------------------
-- These functions check if directory exists and if it actually is directory.
-- Returns false only when target file exists and is not directory. This way
-- you can check if Directory is valid location and if so you can create it
-- using one of the procedures available from this package.
function Is_Valid_Data_Home (Directory: in String) return Boolean;
function Is_Valid_Config_Home (Directory: in String) return Boolean;
function Is_Valid_Cache_Home (Directory: in String) return Boolean;
function Is_Valid_Runtime_Dir (Directory: in String) return Boolean;
----------------------------------------------------------------------------
end XDG;
| 51.452174 | 80 | 0.534054 |
dc05a708397476b6f2e6b44d18c32bdf32cfd8f8 | 3,036 | ads | Ada | awa/src/awa-events-dispatchers.ads | Letractively/ada-awa | 3c82a4d29ed6c1209a2ac7d5fe123c142f3cffbe | [
"Apache-2.0"
] | null | null | null | awa/src/awa-events-dispatchers.ads | Letractively/ada-awa | 3c82a4d29ed6c1209a2ac7d5fe123c142f3cffbe | [
"Apache-2.0"
] | null | null | null | awa/src/awa-events-dispatchers.ads | Letractively/ada-awa | 3c82a4d29ed6c1209a2ac7d5fe123c142f3cffbe | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- awa-events-dispatchers -- AWA Event Dispatchers
-- Copyright (C) 2012 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Finalization;
with EL.Expressions;
with EL.Beans;
with AWA.Events.Queues;
limited with AWA.Events.Services;
package AWA.Events.Dispatchers is
MAX_DISPATCHER_COUNT : constant Positive := 100;
type Dispatcher is new Ada.Finalization.Limited_Controlled with private;
type Dispatcher_Access is access all Dispatcher'Class;
type Dispatcher_Access_Array is array (1 .. MAX_DISPATCHER_COUNT) of Dispatcher_Access;
-- Start the dispatcher.
procedure Start (Manager : in out Dispatcher) is null;
-- Stop the dispatcher.
procedure Stop (Manager : in out Dispatcher) is null;
-- Add the queue to the dispatcher.
procedure Add_Queue (Manager : in out Dispatcher;
Queue : in AWA.Events.Queues.Queue_Ref;
Added : out Boolean);
-- Dispatch the events from the queue.
-- Increment the <b>Count</b> parameter to indicate the number of events that were dispatched.
procedure Dispatch (Manager : in Dispatcher;
Queue : in AWA.Events.Queues.Queue_Ref;
Count : in out Natural);
-- Dispatch the event identified by <b>Event</b>.
-- The event actions which are associated with the event are executed synchronously.
procedure Dispatch (Manager : in Dispatcher;
Event : in Module_Event'Class);
-- Add an action invoked when an event is dispatched through this dispatcher.
-- When the event queue dispatches the event, the Ada bean identified by the method action
-- represented by <b>Action</b> is created and initialized by evaluating and setting the
-- parameters defined in <b>Params</b>. The action method is then invoked.
procedure Add_Action (Manager : in out Dispatcher;
Action : in EL.Expressions.Method_Expression;
Params : in EL.Beans.Param_Vectors.Vector);
private
type Event_Manager_Access is access all AWA.Events.Services.Event_Manager'Class;
type Dispatcher is new Ada.Finalization.Limited_Controlled with record
Manager : Event_Manager_Access := null;
end record;
end AWA.Events.Dispatchers;
| 42.166667 | 98 | 0.667655 |
d01fb4e7ce2d669becf102a5db9560c8256d0672 | 921 | adb | Ada | Read Only/gdb-7.12.1/gdb/testsuite/gdb.ada/frame_args/foo.adb | samyvic/OS-Project | 1622bc1641876584964effd91d65ef02e92728e1 | [
"Apache-2.0"
] | null | null | null | Read Only/gdb-7.12.1/gdb/testsuite/gdb.ada/frame_args/foo.adb | samyvic/OS-Project | 1622bc1641876584964effd91d65ef02e92728e1 | [
"Apache-2.0"
] | null | null | null | Read Only/gdb-7.12.1/gdb/testsuite/gdb.ada/frame_args/foo.adb | samyvic/OS-Project | 1622bc1641876584964effd91d65ef02e92728e1 | [
"Apache-2.0"
] | null | null | null | -- Copyright 2007-2017 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
I : Integer := 1;
begin
Call_Me (Int => 1, Flt => 2.0, Bln => True, Ary => (1, 4, 8), Chr => 'j',
Sad => I'Address, Rec => (A => 3, B => 7));
end Foo;
| 38.375 | 76 | 0.679696 |
0e9070514df76fbbf4577cb525267dfdc454615f | 3,741 | adb | Ada | gcc-gcc-7_3_0-release/gcc/ada/s-expint.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/ada/s-expint.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/ada/s-expint.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . E X P I N T --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body System.Exp_Int is
-----------------
-- Exp_Integer --
-----------------
-- Note that negative exponents get a constraint error because the
-- subtype of the Right argument (the exponent) is Natural.
function Exp_Integer
(Left : Integer;
Right : Natural)
return Integer
is
Result : Integer := 1;
Factor : Integer := Left;
Exp : Natural := Right;
begin
-- We use the standard logarithmic approach, Exp gets shifted right
-- testing successive low order bits and Factor is the value of the
-- base raised to the next power of 2.
-- Note: it is not worth special casing base values -1, 0, +1 since
-- the expander does this when the base is a literal, and other cases
-- will be extremely rare.
if Exp /= 0 then
loop
if Exp rem 2 /= 0 then
declare
pragma Unsuppress (All_Checks);
begin
Result := Result * Factor;
end;
end if;
Exp := Exp / 2;
exit when Exp = 0;
declare
pragma Unsuppress (All_Checks);
begin
Factor := Factor * Factor;
end;
end loop;
end if;
return Result;
end Exp_Integer;
end System.Exp_Int;
| 44.535714 | 78 | 0.423416 |
dfb87ddb3c255b92e21cea49753bd6382e07534e | 3,131 | adb | Ada | src/fltk-widgets-valuators-sliders-fill.adb | micahwelf/FLTK-Ada | 83e0c58ea98e5ede2cbbb158b42eae44196c3ba7 | [
"Unlicense"
] | 1 | 2020-12-18T15:20:13.000Z | 2020-12-18T15:20:13.000Z | src/fltk-widgets-valuators-sliders-fill.adb | micahwelf/FLTK-Ada | 83e0c58ea98e5ede2cbbb158b42eae44196c3ba7 | [
"Unlicense"
] | null | null | null | src/fltk-widgets-valuators-sliders-fill.adb | micahwelf/FLTK-Ada | 83e0c58ea98e5ede2cbbb158b42eae44196c3ba7 | [
"Unlicense"
] | null | null | null |
with
Interfaces.C.Strings,
System;
use type
System.Address;
package body FLTK.Widgets.Valuators.Sliders.Fill is
procedure fill_slider_set_draw_hook
(W, D : in System.Address);
pragma Import (C, fill_slider_set_draw_hook, "fill_slider_set_draw_hook");
pragma Inline (fill_slider_set_draw_hook);
procedure fill_slider_set_handle_hook
(W, H : in System.Address);
pragma Import (C, fill_slider_set_handle_hook, "fill_slider_set_handle_hook");
pragma Inline (fill_slider_set_handle_hook);
function new_fl_fill_slider
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_fill_slider, "new_fl_fill_slider");
pragma Inline (new_fl_fill_slider);
procedure free_fl_fill_slider
(D : in System.Address);
pragma Import (C, free_fl_fill_slider, "free_fl_fill_slider");
pragma Inline (free_fl_fill_slider);
procedure fl_fill_slider_draw
(W : in System.Address);
pragma Import (C, fl_fill_slider_draw, "fl_fill_slider_draw");
pragma Inline (fl_fill_slider_draw);
function fl_fill_slider_handle
(W : in System.Address;
E : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_fill_slider_handle, "fl_fill_slider_handle");
pragma Inline (fl_fill_slider_handle);
procedure Finalize
(This : in out Fill_Slider) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in Fill_Slider'Class
then
free_fl_fill_slider (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
Finalize (Slider (This));
end Finalize;
package body Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String)
return Fill_Slider is
begin
return This : Fill_Slider do
This.Void_Ptr := new_fl_fill_slider
(Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.To_C (Text));
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
fill_slider_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
fill_slider_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
end return;
end Create;
end Forge;
procedure Draw
(This : in out Fill_Slider) is
begin
fl_fill_slider_draw (This.Void_Ptr);
end Draw;
function Handle
(This : in out Fill_Slider;
Event : in Event_Kind)
return Event_Outcome is
begin
return Event_Outcome'Val
(fl_fill_slider_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
end Handle;
end FLTK.Widgets.Valuators.Sliders.Fill;
| 26.091667 | 82 | 0.606196 |
2083ff0f1f554ee619fa095f388fbc570699158f | 807 | ads | Ada | firmware/coreboot/src/mainboard/gigabyte/ga-h61m-s2pv/gma-mainboard.ads | fabiojna02/OpenCellular | 45b6a202d6b2e2485c89955b9a6da920c4d56ddb | [
"CC-BY-4.0",
"BSD-3-Clause"
] | 1 | 2019-11-04T07:11:25.000Z | 2019-11-04T07:11:25.000Z | firmware/coreboot/src/mainboard/gigabyte/ga-h61m-s2pv/gma-mainboard.ads | aimin-wang/OpenCellular | 5308146bf7edf43cc81c0e4d15305b711117070a | [
"CC-BY-4.0",
"BSD-3-Clause"
] | 13 | 2018-10-12T21:29:09.000Z | 2018-10-25T20:06:51.000Z | firmware/coreboot/src/mainboard/gigabyte/ga-h61m-s2pv/gma-mainboard.ads | aimin-wang/OpenCellular | 5308146bf7edf43cc81c0e4d15305b711117070a | [
"CC-BY-4.0",
"BSD-3-Clause"
] | null | null | null | --
-- This file is part of the coreboot project.
--
-- Copyright (C) 2018 Angel Pons <[email protected]>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; version 2 of the License.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
with HW.GFX.GMA;
with HW.GFX.GMA.Display_Probing;
use HW.GFX.GMA;
use HW.GFX.GMA.Display_Probing;
private package GMA.Mainboard is
ports : constant Port_List :=
(HDMI1,
Analog,
others => Disabled);
end GMA.Mainboard;
| 26.9 | 71 | 0.728625 |
20d4ca0e5ba988c902829f3df905ef0399ebd861 | 3,504 | ads | Ada | tools/ayacc/src/ragged.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | lib/ayacc/ragged.ads | alvaromb/Compilemon | de5f88f084705868d38e301d95bb4a19a46a1156 | [
"MIT"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | lib/ayacc/ragged.ads | alvaromb/Compilemon | de5f88f084705868d38e301d95bb4a19a46a1156 | [
"MIT"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | -- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- The primary authors of ayacc were David Taback and Deepak Tolani.
-- Enhancements were made by Ronald J. Schmalz.
--
-- Send requests for ayacc information to [email protected]
-- Send bug reports for ayacc to [email protected]
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- Module : ragged.ada
-- Component of : ayacc
-- Version : 1.2
-- Date : 11/21/86 12:34:00
-- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxragged.ada
-- $Header: ragged.a,v 0.1 86/04/01 15:11:22 ada Exp $
-- $Log: ragged.a,v $
-- Revision 0.1 86/04/01 15:11:22 ada
-- This version fixes some minor bugs with empty grammars
-- and $$ expansion. It also uses vads5.1b enhancements
-- such as pragma inline.
--
--
-- Revision 0.0 86/02/19 18:40:45 ada
--
-- These files comprise the initial version of Ayacc
-- designed and implemented by David Taback and Deepak Tolani.
-- Ayacc has been compiled and tested under the Verdix Ada compiler
-- version 4.06 on a vax 11/750 running Unix 4.2BSD.
--
-- Remeber to get rid of rval as soon as all bugs have been eliminated
-- from routines that use this package.
generic
type Row_Index is (<>);
type Col_Index is (<>);
type Item is limited private;
with procedure Null_Value(Value : in out Item);
package Ragged is
-- Cell and index should be private but for efficency and for subtle
-- problems that arise when type item is implemeted as a limited private
-- in an external package, cell and index are kept visible.
type Cell;
type Index is access Cell;
pragma Controlled(Index);
type Hidden_Type is limited private;
type Cell is
record
Value : Item;
Hidden : Hidden_Type;
end record;
-- Use for retrieving the value of array(x,y). Raises value range
-- error if no such location has been allocated yet.
-- eg: value := rval(x,y).value;
function Rval(X: Row_Index; Y: Col_Index) return Index;
-- Use for setting a value in array(x,y). Allocates new storage
-- if the location does not exist yet. Can also use it if you
-- require a preinitialization value
-- eg: lval(x,y).value := value;
-- if lval(x,y).value = 0 then ...
function Lval(X: Row_Index; Y: Col_Index) return Index;
procedure Make_Array(Lower, Upper: Row_Index);
procedure Initialize(Iterator : out Index; Row : Row_Index);
procedure Next(Iterator : in out Index);
procedure Free_Array;
Value_Range_Error : exception;
private
type Hidden_Type is
record
Column : Col_Index;
Next : Index;
end record;
end Ragged;
| 32.444444 | 77 | 0.678653 |
202e1983562371985133ee2b638678e6d975d457 | 4,100 | adb | Ada | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-ztenio.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-ztenio.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-ztenio.adb | orb-zhuchen/Orb | 6da2404b949ac28bde786e08bf4debe4a27cd3a0 | [
"CNRI-Python-GPL-Compatible",
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . W I D E _ W I D E _ T E X T _ I O . E N U M E R A T I O N _ I O --
-- --
-- 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 Ada.Wide_Wide_Text_IO.Enumeration_Aux;
package body Ada.Wide_Wide_Text_IO.Enumeration_IO is
package Aux renames Ada.Wide_Wide_Text_IO.Enumeration_Aux;
---------
-- Get --
---------
procedure Get (File : File_Type; Item : out Enum) is
Buf : Wide_Wide_String (1 .. Enum'Width);
Buflen : Natural;
begin
Aux.Get_Enum_Lit (File, Buf, Buflen);
Item := Enum'Wide_Wide_Value (Buf (1 .. Buflen));
exception
when Constraint_Error => raise Data_Error;
end Get;
procedure Get (Item : out Enum) is
begin
Get (Current_Input, Item);
end Get;
procedure Get
(From : Wide_Wide_String;
Item : out Enum;
Last : out Positive)
is
Start : Natural;
begin
Aux.Scan_Enum_Lit (From, Start, Last);
Item := Enum'Wide_Wide_Value (From (Start .. Last));
exception
when Constraint_Error => raise Data_Error;
end Get;
---------
-- Put --
---------
procedure Put
(File : File_Type;
Item : Enum;
Width : Field := Default_Width;
Set : Type_Set := Default_Setting)
is
Image : constant Wide_Wide_String := Enum'Wide_Wide_Image (Item);
begin
Aux.Put (File, Image, Width, Set);
end Put;
procedure Put
(Item : Enum;
Width : Field := Default_Width;
Set : Type_Set := Default_Setting)
is
begin
Put (Current_Output, Item, Width, Set);
end Put;
procedure Put
(To : out Wide_Wide_String;
Item : Enum;
Set : Type_Set := Default_Setting)
is
Image : constant Wide_Wide_String := Enum'Wide_Wide_Image (Item);
begin
Aux.Puts (To, Image, Set);
end Put;
end Ada.Wide_Wide_Text_IO.Enumeration_IO;
| 39.047619 | 78 | 0.473171 |
2323c6bc4ec662e60b9624dbca9e815118f1f634 | 4,161 | adb | Ada | src/monsters.adb | thomas070605/shoot-n-loot | e242d71e9fe94271fe7fd79573ab06d231564350 | [
"MIT"
] | null | null | null | src/monsters.adb | thomas070605/shoot-n-loot | e242d71e9fe94271fe7fd79573ab06d231564350 | [
"MIT"
] | null | null | null | src/monsters.adb | thomas070605/shoot-n-loot | e242d71e9fe94271fe7fd79573ab06d231564350 | [
"MIT"
] | null | null | null | -- Shoot'n'loot
-- Copyright (c) 2020 Fabien Chouteau
with Game_Assets.Tileset;
with Game_Assets.Tileset_Collisions;
with Game_Assets.Misc_Objects;
with GESTE_Config; use GESTE_Config;
with GESTE.Tile_Bank;
with GESTE.Sprite.Animated;
with Sound;
package body Monsters is
package Item renames Game_Assets.Misc_Objects.Item;
Tile_Bank : aliased GESTE.Tile_Bank.Instance
(Game_Assets.Tileset.Tiles'Access,
Game_Assets.Tileset_Collisions.Tiles'Access,
Game_Assets.Palette'Access);
Empty_Tile : constant GESTE_Config.Tile_Index := Item.Empty_Tile.Tile_Id;
type Monster_Rec is record
Sprite : aliased GESTE.Sprite.Animated.Instance
(Tile_Bank'Access,
GESTE_Config.No_Tile);
Origin : GESTE.Pix_Point;
Pos : GESTE.Pix_Point;
Alive : Boolean := False;
Going_Right : Boolean := True;
Offset : Natural := 0;
end record;
Monster_Array : array (1 .. Max_Nbr_Of_Monsters) of Monster_Rec;
Last_Monster : Natural := 0;
Nbr_Killed : Natural := 0;
Anim_Step_Duration : constant := 10;
Monster_Animation : aliased constant GESTE.Sprite.Animated.Animation_Array :=
((Item.M1.Tile_Id, Anim_Step_Duration),
(Item.M2.Tile_Id, Anim_Step_Duration),
(Item.M3.Tile_Id, Anim_Step_Duration),
(Item.M4.Tile_Id, Anim_Step_Duration),
(Item.M5.Tile_Id, Anim_Step_Duration),
(Item.M6.Tile_Id, Anim_Step_Duration),
(Item.M7.Tile_Id, Anim_Step_Duration));
----------
-- Init --
----------
procedure Init (Objects : Object_Array) is
begin
Last_Monster := 0;
Nbr_Killed := 0;
for Monster of Objects loop
Last_Monster := Last_Monster + 1;
declare
M : Monster_Rec renames Monster_Array (Last_Monster);
begin
M.Sprite.Set_Animation (Monster_Animation'Access, Looping => True);
M.Alive := True;
M.Origin := (Integer (Monster.X), Integer (Monster.Y) - 8);
M.Pos := M.Origin;
M.Sprite.Move (M.Origin);
GESTE.Add (M.Sprite'Access, 2);
end;
end loop;
end Init;
---------------
-- Check_Hit --
---------------
function Check_Hit (Pt : GESTE.Pix_Point;
Lethal : Boolean)
return Boolean
is
begin
for M of Monster_Array (Monster_Array'First .. Last_Monster) loop
if M.Alive
and then
Pt.X in M.Pos.X .. M.Pos.X + Tile_Size
and then
Pt.Y in M.Pos.Y .. M.Pos.Y + Tile_Size
then
if Lethal then
-- Replace the monster by an empty tile to erase it from the
-- screen.
M.Sprite.Set_Animation (GESTE.Sprite.Animated.No_Animation,
Looping => False);
M.Sprite.Set_Tile (Empty_Tile);
M.Alive := False;
Nbr_Killed := Nbr_Killed + 1;
Sound.Play_Monster_Dead;
end if;
return True;
end if;
end loop;
return False;
end Check_Hit;
----------------
-- All_Killed --
----------------
function All_Killed return Boolean
is (Nbr_Killed = Last_Monster);
------------
-- Update --
------------
procedure Update is
begin
for M of Monster_Array (Monster_Array'First .. Last_Monster) loop
if M.Alive then
M.Sprite.Signal_Frame;
M.Pos := (M.Origin.X + M.Offset / 5, M.Origin.Y);
M.Sprite.Move (M.Pos);
if M.Going_Right then
if M.Offset >= GESTE_Config.Tile_Size * 2 * 5 then
M.Going_Right := False;
else
M.Offset := M.Offset + 1;
end if;
else
if M.Offset = 0 then
M.Going_Right := True;
else
M.Offset := M.Offset - 1;
end if;
end if;
end if;
end loop;
end Update;
end Monsters;
| 26.503185 | 80 | 0.5441 |
234bda748ed69cdfd4830c31caa02de830884477 | 4,013 | adb | Ada | rts/gcc-9/adainclude/s-memory.adb | letsbyteit/build-avr-ada-toolchain | 7c5dddbc69e6e2df8c30971417dc50d2f2b29794 | [
"MIT"
] | 7 | 2019-09-17T20:54:13.000Z | 2021-12-20T04:31:40.000Z | rts/gcc-9/adainclude/s-memory.adb | letsbyteit/build-avr-ada-toolchain | 7c5dddbc69e6e2df8c30971417dc50d2f2b29794 | [
"MIT"
] | 6 | 2019-05-08T14:20:48.000Z | 2022-01-20T18:58:30.000Z | rts/gcc-9/adainclude/s-memory.adb | letsbyteit/build-avr-ada-toolchain | 7c5dddbc69e6e2df8c30971417dc50d2f2b29794 | [
"MIT"
] | 8 | 2019-07-09T09:18:51.000Z | 2022-01-15T20:28:50.000Z | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . M E M O R Y --
-- --
-- B o d y --
-- --
-- Copyright (C) 2001-2009, 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. --
-- --
------------------------------------------------------------------------------
-- This is the stripped down version for AVR-Ada without threads
-- This implementation assumes that the underlying malloc/free/realloc
-- implementation is thread safe, and thus, no additional lock is required.
with Ada.Exceptions; use Ada.Exceptions;
package body System.Memory is
function avr_libc_malloc (Size : size_t) return System.Address;
pragma Import (C, avr_libc_malloc, "malloc");
-- function builtin_malloc (Size : size_t) return System.Address;
-- pragma Import (Intrinsic, builtin_malloc, "__builtin_malloc");
procedure c_free (Ptr : System.Address);
pragma Import (Intrinsic, c_free, "__builtin_free");
-----------
-- Alloc --
-----------
function Alloc (Size : size_t) return System.Address is
Result : System.Address;
Actual_Size : size_t := Size;
begin
if Size = size_t'Last then
Raise_Exception (Storage_Error'Identity, "object too large");
end if;
-- Change size from zero to non-zero. We still want a proper pointer
-- for the zero case because pointers to zero length objects have to
-- be distinct, but we can't just go ahead and allocate zero bytes,
-- since some malloc's return zero for a zero argument.
if Size = 0 then
Actual_Size := 1;
end if;
Result := avr_libc_malloc (Actual_Size);
if Result = System.Null_Address then
Raise_Exception (Storage_Error'Identity, "heap exhausted");
end if;
return Result;
end Alloc;
procedure Free (Ptr : System.Address) is
begin
c_free (Ptr);
end Free;
end System.Memory;
| 46.126437 | 78 | 0.485422 |
d0f44847f14ce420275546299fb10e919ce3e2a4 | 813 | adb | Ada | Read Only/gdb-6.8/gdb/testsuite/gdb.ada/ref_param/foo.adb | samyvic/OS-Project | 1622bc1641876584964effd91d65ef02e92728e1 | [
"Apache-2.0"
] | null | null | null | Read Only/gdb-6.8/gdb/testsuite/gdb.ada/ref_param/foo.adb | samyvic/OS-Project | 1622bc1641876584964effd91d65ef02e92728e1 | [
"Apache-2.0"
] | null | null | null | Read Only/gdb-6.8/gdb/testsuite/gdb.ada/ref_param/foo.adb | samyvic/OS-Project | 1622bc1641876584964effd91d65ef02e92728e1 | [
"Apache-2.0"
] | null | null | null | -- Copyright 2008 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
D : Data := (1, 2, 3, 4, 5, 6);
begin
Call_Me (D);
end Foo;
| 35.347826 | 73 | 0.714637 |
205f85d69c2306db33831e133a71f327bb33fac1 | 858 | ads | Ada | source/tasking/a-taster.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 33 | 2015-04-04T09:19:36.000Z | 2021-11-10T05:33:34.000Z | source/tasking/a-taster.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 8 | 2017-11-14T13:05:07.000Z | 2018-08-09T15:28:49.000Z | source/tasking/a-taster.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 9 | 2015-02-03T17:09:53.000Z | 2021-11-12T01:16:05.000Z | pragma License (Unrestricted);
with Ada.Exceptions;
with Ada.Task_Identification;
package Ada.Task_Termination is
pragma Preelaborate;
type Cause_Of_Termination is (Normal, Abnormal, Unhandled_Exception);
type Termination_Handler is access protected procedure (
Cause : Cause_Of_Termination;
T : Task_Identification.Task_Id;
X : Exceptions.Exception_Occurrence);
procedure Set_Dependents_Fallback_Handler (Handler : Termination_Handler);
function Current_Task_Fallback_Handler return Termination_Handler;
procedure Set_Specific_Handler (
T : Task_Identification.Task_Id;
Handler : Termination_Handler);
function Specific_Handler (T : Task_Identification.Task_Id)
return Termination_Handler;
pragma Inline (Set_Specific_Handler);
pragma Inline (Specific_Handler);
end Ada.Task_Termination;
| 31.777778 | 77 | 0.784382 |
23231aab6b3c607afe41189abffd0e21b674601f | 3,041 | adb | Ada | llvm-gcc-4.2-2.9/gcc/ada/s-mantis.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | 1 | 2016-04-09T02:58:13.000Z | 2016-04-09T02:58:13.000Z | llvm-gcc-4.2-2.9/gcc/ada/s-mantis.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | llvm-gcc-4.2-2.9/gcc/ada/s-mantis.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- S Y S T E M . M A N T I S S A --
-- --
-- B o d y --
-- --
-- Copyright (C) 1996-2005 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 2, 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 COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body System.Mantissa is
--------------------
-- Mantissa_Value --
--------------------
function Mantissa_Value (First, Last : Integer) return Natural is
Result : Natural := 0;
Val : Integer := Integer'Max (abs First - 1, abs Last);
-- Note: First-1 allows for twos complement largest neg number
begin
while Val /= 0 loop
Val := Val / 2;
Result := Result + 1;
end loop;
return Result;
end Mantissa_Value;
end System.Mantissa;
| 54.303571 | 78 | 0.432752 |
c56a2fad880c64650b7777b14133e168e5741232 | 6,609 | adb | Ada | bb-runtimes/arm/stm32l/stm32l5x2/s-stm32.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/arm/stm32l/stm32l5x2/s-stm32.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | bb-runtimes/arm/stm32l/stm32l5x2/s-stm32.adb | JCGobbi/Nucleo-STM32F334R8 | 2a0b1b4b2664c92773703ac5e95dcb71979d051c | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- Copyright (C) 2012-2021, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.BB.Parameters;
with Interfaces.STM32; use Interfaces.STM32;
with Interfaces.STM32.RCC; use Interfaces.STM32.RCC;
package body System.STM32 is
package Params renames System.BB.Parameters;
subtype Divisor is UInt32;
HPRE_Prescaler_Divisors : constant array (AHB_Prescalers) of Divisor :=
(1, 2, 4, 8, 16, 64, 128, 256, 512);
-- per RM0438 Rev 6 pg 353/2194
PPRE_Prescaler_Divisors : constant array (APB_Prescalers) of Divisor :=
(1, 2, 4, 8, 16);
MSI_Range_Table : constant array (UInt4) of UInt32 :=
(0 => 100_000,
1 => 200_000,
2 => 400_000,
3 => 800_000,
4 => 1_000_000,
5 => 2_000_000,
6 => 4_000_000,
7 => 8_000_000,
8 => 16_000_000,
9 => 24_000_000,
10 => 32_000_000,
11 => 48_000_000,
others => 0);
procedure Get_All_But_SYSCLK (This : in out RCC_System_Clocks);
-------------------
-- System_Clocks --
-------------------
function System_Clocks return RCC_System_Clocks is
Result : RCC_System_Clocks;
begin
case SYSCLK_Source'Enum_Val (RCC_Periph.CFGR.SWS) is
when SYSCLK_SRC_MSI =>
Result.SYSCLK := Params.MSI_Clock;
when SYSCLK_SRC_HSI =>
Result.SYSCLK := HSICLK;
when SYSCLK_SRC_HSE =>
Result.SYSCLK := Params.HSE_Clock; -- note: HSE is optional
when SYSCLK_SRC_PLL =>
Result.SYSCLK := Computed_SYSCLK_From_PLL;
end case;
Get_All_But_SYSCLK (Result);
return Result;
end System_Clocks;
------------------------------
-- Computed_SYSCLK_From_PLL --
------------------------------
function Computed_SYSCLK_From_PLL return Frequency is
PLLM : constant UInt32 := UInt32 (RCC_Periph.PLLCFGR.PLLM) + 1;
PLLN : constant UInt32 := UInt32 (RCC_Periph.PLLCFGR.PLLN);
PLLR : constant UInt32 := (case RCC_Periph.PLLCFGR.PLLR is
when 2#00# => 2,
when 2#01# => 4,
when 2#10# => 6,
when 2#11# => 8);
MSI_Value : UInt32;
MSI_Index : UInt4;
PLL_VCO : UInt32;
Result : Frequency;
begin
if PLL_Source'Enum_Val (RCC_Periph.PLLCFGR.PLLSRC) = PLL_SRC_MSI then
if not RCC_Periph.CR.MSIRGSEL then
-- MSISRANGE from RCC_CSR applies
MSI_Index := RCC_Periph.CSR.MSISRANGE;
else
-- MSIRANGE from RCC_CR applies
MSI_Index := RCC_Periph.CR.MSIRANGE;
end if;
MSI_Value := MSI_Range_Table (MSI_Index);
end if;
-- See RM0438 Rev 6, pg 354/2194, section 9.8.4 RCC PLL configuration
case PLL_Source'Enum_Val (RCC_Periph.PLLCFGR.PLLSRC) is
when PLL_SRC_None =>
PLL_VCO := 0;
when PLL_SRC_HSE =>
PLL_VCO := Params.HSE_Clock;
when PLL_SRC_HSI =>
PLL_VCO := HSICLK;
when PLL_SRC_MSI =>
PLL_VCO := MSI_Value;
end case;
if PLL_VCO = 0 then
-- the PLL is not really selected as the SYSCLK source
Result := 0;
else
Result := ((PLL_VCO / PLLM) * PLLN) / PLLR;
end if;
return Result;
end Computed_SYSCLK_From_PLL;
------------------------
-- Get_All_But_SYSCLK --
------------------------
procedure Get_All_But_SYSCLK (This : in out RCC_System_Clocks) is
HPRE : constant AHB_Prescalers :=
AHB_Prescalers'Enum_Val (RCC_Periph.CFGR.HPRE);
HPRE_Div : constant Divisor := HPRE_Prescaler_Divisors (HPRE);
PPRE1 : constant APB_Prescalers :=
APB_Prescalers'Enum_Val (RCC_Periph.CFGR.PPRE.Arr (1));
PPRE1_Div : constant Divisor := PPRE_Prescaler_Divisors (PPRE1);
PPRE2 : constant APB_Prescalers :=
APB_Prescalers'Enum_Val (RCC_Periph.CFGR.PPRE.Arr (2));
PPRE2_Div : constant Divisor := PPRE_Prescaler_Divisors (PPRE2);
begin
This.HCLK := This.SYSCLK / HPRE_Div;
This.PCLK1 := This.HCLK / PPRE1_Div;
This.PCLK2 := This.HCLK / PPRE2_Div;
if PPRE1 = RCC_HCLK_DIV1 then
This.TIMCLK1 := This.PCLK1;
else
This.TIMCLK1 := This.PCLK1 * 2;
end if;
if PPRE2 = RCC_HCLK_DIV1 then
This.TIMCLK2 := This.PCLK2;
else
This.TIMCLK2 := This.PCLK2 * 2;
end if;
end Get_All_But_SYSCLK;
end System.STM32;
| 37.551136 | 78 | 0.516417 |
df15475c0f27286ff95ea399cdff2e918580bb9c | 5,630 | ads | Ada | src/asf-servlets-faces.ads | Letractively/ada-asf | da9f85f85666eba7e23fefea661160863b74154d | [
"Apache-2.0"
] | null | null | null | src/asf-servlets-faces.ads | Letractively/ada-asf | da9f85f85666eba7e23fefea661160863b74154d | [
"Apache-2.0"
] | null | null | null | src/asf-servlets-faces.ads | Letractively/ada-asf | da9f85f85666eba7e23fefea661160863b74154d | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- asf.servlets.faces -- Faces servlet
-- Copyright (C) 2010 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ASF.Applications.Main;
package ASF.Servlets.Faces is
-- The <b>Servlet</b> represents the component that will handle
-- an HTTP request received by the server.
type Faces_Servlet is new Servlet with private;
-- Called by the servlet container to indicate to a servlet that the servlet
-- is being placed into service.
overriding
procedure Initialize (Server : in out Faces_Servlet;
Context : in Servlet_Registry'Class);
-- Called by the server (via the service method) to allow a servlet to handle
-- a GET request.
--
-- Overriding this method to support a GET request also automatically supports
-- an HTTP HEAD request. A HEAD request is a GET request that returns no body
-- in the response, only the request header fields.
--
-- When overriding this method, read the request data, write the response headers,
-- get the response's writer or output stream object, and finally, write the
-- response data. It's best to include content type and encoding.
-- When using a PrintWriter object to return the response, set the content type
-- before accessing the PrintWriter object.
--
-- The servlet container must write the headers before committing the response,
-- because in HTTP the headers must be sent before the response body.
--
-- Where possible, set the Content-Length header (with the
-- Response.Set_Content_Length method), to allow the servlet container
-- to use a persistent connection to return its response to the client,
-- improving performance. The content length is automatically set if the entire
-- response fits inside the response buffer.
--
-- When using HTTP 1.1 chunked encoding (which means that the response has a
-- Transfer-Encoding header), do not set the Content-Length header.
--
-- The GET method should be safe, that is, without any side effects for which
-- users are held responsible. For example, most form queries have no side effects.
-- If a client request is intended to change stored data, the request should use
-- some other HTTP method.
--
-- The GET method should also be idempotent, meaning that it can be safely repeated.
-- Sometimes making a method safe also makes it idempotent. For example, repeating
-- queries is both safe and idempotent, but buying a product online or modifying
-- data is neither safe nor idempotent.
--
-- If the request is incorrectly formatted, Do_Get returns an HTTP "Bad Request"
procedure Do_Get (Server : in Faces_Servlet;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class);
-- Called by the server (via the service method) to allow a servlet to handle
-- a POST request. The HTTP POST method allows the client to send data of unlimited
-- length to the Web server a single time and is useful when posting information
-- such as credit card numbers.
--
-- When overriding this method, read the request data, write the response headers,
-- get the response's writer or output stream object, and finally, write the
-- response data. It's best to include content type and encoding. When using
-- a PrintWriter object to return the response, set the content type before
-- accessing the PrintWriter object.
--
-- The servlet container must write the headers before committing the response,
-- because in HTTP the headers must be sent before the response body.
--
-- Where possible, set the Content-Length header (with the
-- Response.Set_Content_Length method), to allow the servlet container to use
-- a persistent connection to return its response to the client, improving
-- performance. The content length is automatically set if the entire response
-- fits inside the response buffer.
--
-- When using HTTP 1.1 chunked encoding (which means that the response has a
-- Transfer-Encoding header), do not set the Content-Length header.
--
-- This method does not need to be either safe or idempotent. Operations
-- requested through POST can have side effects for which the user can be held
-- accountable, for example, updating stored data or buying items online.
--
-- If the HTTP POST request is incorrectly formatted, doPost returns
-- an HTTP "Bad Request" message.
procedure Do_Post (Server : in Faces_Servlet;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class);
private
type Faces_Servlet is new Servlet with record
App : ASF.Applications.Main.Application_Access;
end record;
end ASF.Servlets.Faces;
| 49.823009 | 88 | 0.690941 |
dcd8c5e93be0198d60c6731fbdb8da3abe7d9622 | 1,470 | ads | Ada | tier-1/xcb/source/thin/xcb-xcb_render_query_pict_formats_cookie_t.ads | charlie5/cBound | 741be08197a61ad9c72553e3302f3b669902216d | [
"0BSD"
] | 2 | 2015-11-12T11:16:20.000Z | 2021-08-24T22:32:04.000Z | tier-1/xcb/source/thin/xcb-xcb_render_query_pict_formats_cookie_t.ads | charlie5/cBound | 741be08197a61ad9c72553e3302f3b669902216d | [
"0BSD"
] | 1 | 2018-06-05T05:19:35.000Z | 2021-11-20T01:13:23.000Z | tier-1/xcb/source/thin/xcb-xcb_render_query_pict_formats_cookie_t.ads | charlie5/cBound | 741be08197a61ad9c72553e3302f3b669902216d | [
"0BSD"
] | null | null | null | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces.C;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_render_query_pict_formats_cookie_t is
-- Item
--
type Item is record
sequence : aliased Interfaces.C.unsigned;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_render_query_pict_formats_cookie_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_render_query_pict_formats_cookie_t.Item,
Element_Array => xcb.xcb_render_query_pict_formats_cookie_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_render_query_pict_formats_cookie_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_render_query_pict_formats_cookie_t.Pointer,
Element_Array =>
xcb.xcb_render_query_pict_formats_cookie_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_render_query_pict_formats_cookie_t;
| 26.25 | 77 | 0.682313 |
cb712b22f72a154a368c13a9fc57b4108a33bb7f | 1,527 | ads | Ada | tools/SPARK2005/packages/polypaver/pp_lf_exact.ads | michalkonecny/polypaver | 7a1541a85523f5ecbef44b7f5e09680d9a5c1ca6 | [
"BSD-3-Clause"
] | 1 | 2015-07-01T14:50:00.000Z | 2015-07-01T14:50:00.000Z | tools/SPARK2005/packages/polypaver/pp_lf_exact.ads | michalkonecny/polypaver | 7a1541a85523f5ecbef44b7f5e09680d9a5c1ca6 | [
"BSD-3-Clause"
] | null | null | null | tools/SPARK2005/packages/polypaver/pp_lf_exact.ads | michalkonecny/polypaver | 7a1541a85523f5ecbef44b7f5e09680d9a5c1ca6 | [
"BSD-3-Clause"
] | null | null | null | package PP_LF_Exact is
-- Various SPARK functions for use in SPARK assertions.
-- These functions are then featured in VCs and PolyPaver will
-- understand their meaning. For each of these functions,
-- its semantics is the exact real interpretation of its name.
--
-- The LF in the package name stands for the Long_Float type.
--
-- Ideally all occurences of Long_Float in this package would be
-- replaced with Real and all floating point types would
-- be subtypes of Real.
-- Unfortunately, such type Real is not available in SPARK.
--# function Square (X : Long_Float) return Long_Float;
--# function Int_Power (X : Long_Float; N : Integer) return Long_Float;
--# function Sqrt (X : Long_Float) return Long_Float;
--# function Exp (X : Long_Float) return Long_Float;
--# function Pi return Long_Float;
--# function Integral (Lo,Hi,Integrand : Long_Float) return Long_Float;
--# function Integration_Variable return Long_Float;
--# function Interval(Low, High : Long_Float) return Long_Float;
--# function Contained_In(Inner, Outer : Long_Float) return Boolean;
--# function Is_Range(Variable : Long_Float; Min : Long_Float; Max : Long_Float) return Boolean;
--# function Eps_Abs(Prec : Integer) return Long_Float;
--# function Eps_Rel(Prec : Integer) return Long_Float;
--# function Plus_Minus_Eps_Abs(Prec : Integer) return Long_Float;
--# function Plus_Minus_Eps_Rel(Prec : Integer) return Long_Float;
end PP_LF_Exact;
| 46.272727 | 100 | 0.712508 |
4a61cd152a1263536c9d0d334dd3d00f10924302 | 1,148 | ads | Ada | source/environment/machine-apple-darwin/s-naenva.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 33 | 2015-04-04T09:19:36.000Z | 2021-11-10T05:33:34.000Z | source/environment/machine-apple-darwin/s-naenva.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 8 | 2017-11-14T13:05:07.000Z | 2018-08-09T15:28:49.000Z | source/environment/machine-apple-darwin/s-naenva.ads | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 9 | 2015-02-03T17:09:53.000Z | 2021-11-12T01:16:05.000Z | pragma License (Unrestricted);
-- implementation unit specialized for POSIX (Darwin, FreeBSD, or Linux)
package System.Native_Environment_Variables is
pragma Preelaborate;
subtype Cursor is Address;
function Value (Name : String) return String;
function Value (Name : String; Default : String) return String;
function Exists (Name : String) return Boolean;
procedure Set (Name : String; Value : String);
procedure Clear (Name : String);
procedure Clear;
function Has_Element (Position : Cursor) return Boolean;
pragma Inline (Has_Element);
function Name (Position : Cursor) return String;
function Value (Position : Cursor) return String;
Disable_Controlled : constant Boolean := True;
function Get_Block return Address is (Null_Address);
procedure Release_Block (Block : Address) is null;
pragma Inline (Release_Block);
-- [gcc-7] can not skip calling null procedure
function First (Block : Address) return Cursor;
function Next (Block : Address; Position : Cursor) return Cursor;
pragma Inline (First);
pragma Inline (Next);
end System.Native_Environment_Variables;
| 30.210526 | 73 | 0.730836 |
cb1bc226992b67493c1e86c765aa33b1138d0a72 | 899 | ads | Ada | src/mysql/mysql.ads | My-Colaborations/ada-ado | cebf1f9b38c0c259c44935e8bca05a5bff12aace | [
"Apache-2.0"
] | null | null | null | src/mysql/mysql.ads | My-Colaborations/ada-ado | cebf1f9b38c0c259c44935e8bca05a5bff12aace | [
"Apache-2.0"
] | null | null | null | src/mysql/mysql.ads | My-Colaborations/ada-ado | cebf1f9b38c0c259c44935e8bca05a5bff12aace | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- ADO Mysql -- Mysql Interface
-- Copyright (C) 2009, 2010, 2013 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
package Mysql is
pragma Pure;
end Mysql;
| 40.863636 | 76 | 0.612903 |
df475fe116853091e66245fadf22fd37bb09188c | 450 | ads | Ada | src/tests/histogramdescriptortests.ads | sebsgit/textproc | 2f12d6a030425e937ee0c6a67dcff6828fc1331f | [
"MIT"
] | null | null | null | src/tests/histogramdescriptortests.ads | sebsgit/textproc | 2f12d6a030425e937ee0c6a67dcff6828fc1331f | [
"MIT"
] | null | null | null | src/tests/histogramdescriptortests.ads | sebsgit/textproc | 2f12d6a030425e937ee0c6a67dcff6828fc1331f | [
"MIT"
] | null | null | null | with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
package HistogramDescriptorTests is
type TestCase is new AUnit.Test_Cases.Test_Case with null record;
procedure Register_Tests(T: in out TestCase);
function Name(T: TestCase) return Message_String;
procedure testBasicDescriptor(T : in out Test_Cases.Test_Case'Class);
procedure testDivergence(T : in out Test_Cases.Test_Case'Class);
end HistogramDescriptorTests;
| 32.142857 | 72 | 0.795556 |
23bcb0b5dc80b5234274d14cf5b38c179c6cd651 | 3,142 | ads | Ada | stm32f4/stm32f411xx/svd/stm32_svd-interrupts.ads | ekoeppen/STM32_Generic_Ada_Drivers | 4ff29c3026c4b24280baf22a5b81ea9969375466 | [
"MIT"
] | 1 | 2021-04-06T07:57:56.000Z | 2021-04-06T07:57:56.000Z | stm32f4/stm32f411xx/svd/stm32_svd-interrupts.ads | ekoeppen/STM32_Generic_Ada_Drivers | 4ff29c3026c4b24280baf22a5b81ea9969375466 | [
"MIT"
] | null | null | null | stm32f4/stm32f411xx/svd/stm32_svd-interrupts.ads | ekoeppen/STM32_Generic_Ada_Drivers | 4ff29c3026c4b24280baf22a5b81ea9969375466 | [
"MIT"
] | 2 | 2018-05-29T13:59:31.000Z | 2019-02-03T19:48:08.000Z | -- This spec has been automatically generated from STM32F411xx.svd
-- Definition of the device's interrupts
package STM32_SVD.Interrupts is
----------------
-- Interrupts --
----------------
-- PVD through EXTI line detection interrupt
PVD : constant := 1;
-- Tamper and TimeStamp interrupts through the EXTI line
TAMP_STAMP : constant := 2;
-- RTC Wakeup interrupt through the EXTI line
RTC_WKUP : constant := 3;
-- FLASH global interrupt
FLASH : constant := 4;
-- RCC global interrupt
RCC : constant := 5;
-- EXTI Line0 interrupt
EXTI0 : constant := 6;
-- EXTI Line1 interrupt
EXTI1 : constant := 7;
-- EXTI Line2 interrupt
EXTI2 : constant := 8;
-- EXTI Line3 interrupt
EXTI3 : constant := 9;
-- EXTI Line4 interrupt
EXTI4 : constant := 10;
-- ADC1 global interrupt
ADC : constant := 18;
-- EXTI Line[9:5] interrupts
EXTI9_5 : constant := 23;
-- TIM1 Break interrupt and TIM9 global interrupt
TIM1_BRK_TIM9 : constant := 24;
-- TIM1 Update interrupt and TIM10 global interrupt
TIM1_UP_TIM10 : constant := 25;
-- TIM1 Trigger and Commutation interrupts and TIM11 global interrupt
TIM1_TRG_COM_TIM11 : constant := 26;
-- TIM1 Capture Compare interrupt
TIM1_CC : constant := 27;
-- TIM2 global interrupt
TIM2 : constant := 28;
-- TIM3 global interrupt
TIM3 : constant := 29;
-- I2C1 event interrupt
I2C1_EV : constant := 31;
-- I2C1 error interrupt
I2C1_ER : constant := 32;
-- I2C2 event interrupt
I2C2_EV : constant := 33;
-- I2C2 error interrupt
I2C2_ER : constant := 34;
-- SPI1 global interrupt
SPI1 : constant := 35;
-- SPI2 global interrupt
SPI2 : constant := 36;
-- EXTI Line[15:10] interrupts
EXTI15_10 : constant := 40;
-- RTC Alarms (A and B) through EXTI line interrupt
RTC_Alarm : constant := 41;
-- USB On-The-Go FS Wakeup through EXTI line interrupt
OTG_FS_WKUP : constant := 42;
-- SDIO global interrupt
SDIO : constant := 49;
-- SPI3 global interrupt
SPI3 : constant := 51;
-- USB On The Go FS global interrupt
OTG_FS : constant := 67;
-- I2C3 event interrupt
I2C3_EV : constant := 72;
-- I2C3 error interrupt
I2C3_ER : constant := 73;
-- SPI4 global interrupt
SPI4 : constant := 84;
end STM32_SVD.Interrupts;
| 28.563636 | 73 | 0.480586 |
0e1c68acead4b952dcb805a97d1e33cbe70c19a7 | 680 | adb | Ada | ga_common/mouse_manager.adb | rogermc2/GA_Ada | 0b55eb5691ac1c543c79c9a06ffdbe2e47e8f1be | [
"ISC"
] | 3 | 2019-04-12T01:09:55.000Z | 2021-02-24T18:17:32.000Z | ga_common/mouse_manager.adb | rogermc2/GA_Ada | 0b55eb5691ac1c543c79c9a06ffdbe2e47e8f1be | [
"ISC"
] | 1 | 2020-08-12T10:10:25.000Z | 2020-08-12T10:10:25.000Z | ga_common/mouse_manager.adb | rogermc2/GA_Ada | 0b55eb5691ac1c543c79c9a06ffdbe2e47e8f1be | [
"ISC"
] | 1 | 2019-04-12T01:14:15.000Z | 2019-04-12T01:14:15.000Z |
with E2GA;
package body Mouse_Manager is
-- mouse position on last call to MouseButton() / MouseMotion()
Prev_Mouse_Pos : E2GA.Vector;
-- when true, MouseMotion() will rotate the model
Rotate_Model : Boolean := False;
Rotate_Model_Out_OfPPlane : Boolean := False;
-- rotation of the model
M_Model_Rotor : E2GA.Rotor;
-- -------------------------------------------------------------------------
procedure Mouse_Button (Button : Integer; State : Integer; X, Y : Integer) is
begin
null;
end Mouse_Button;
-- -------------------------------------------------------------------------
end Mouse_Manager;
| 26.153846 | 80 | 0.5 |
dfcc8148282dbe36b9e5dda77c6e7dedb33fb75c | 666 | ads | Ada | Lab5/date_package.ads | albinjal/ada_basic | 2ee5963f18496870ee9efc2e6466917c87482ddc | [
"MIT"
] | 3 | 2020-01-27T10:04:20.000Z | 2022-02-11T23:17:00.000Z | Lab5/date_package.ads | albinjal/ada_basic | 2ee5963f18496870ee9efc2e6466917c87482ddc | [
"MIT"
] | null | null | null | Lab5/date_package.ads | albinjal/ada_basic | 2ee5963f18496870ee9efc2e6466917c87482ddc | [
"MIT"
] | null | null | null | package Date_Package is
YEAR_ERROR: exception;
MONTH_ERROR: exception;
DAY_ERROR: exception;
FORMAT_ERROR: exception;
type Date_Type is private;
procedure Get(Date: out Date_Type);
procedure Put(Date: in Date_Type);
procedure Test_Leap_Years;
function "="(Date1, Date2: in Date_Type) return Boolean;
function ">"(Date1, Date2: in Date_Type) return Boolean;
function "<"(Date2, Date1: in Date_Type) return Boolean;
function Next_Date(Date: in Date_Type) return Date_Type;
function Previous_Date(Date: in Date_Type) return Date_Type;
private
type Date_Type is
record
Year: Integer;
Month: Integer;
Day: Integer;
end record;
end Date_Package;
| 28.956522 | 61 | 0.764264 |
4a3c18b434329b67d2468a6e8b1cd0f6b6bb6f66 | 6,910 | ads | Ada | source/amf/uml/amf-uml-generalizations.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/amf/uml/amf-uml-generalizations.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/amf/uml/amf-uml-generalizations.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
-- A generalization is a taxonomic relationship between a more general
-- classifier and a more specific classifier. Each instance of the specific
-- classifier is also an indirect instance of the general classifier. Thus,
-- the specific classifier inherits the features of the more general
-- classifier.
--
-- A generalization relates a specific classifier to a more general
-- classifier, and is owned by the specific classifier.
------------------------------------------------------------------------------
limited with AMF.UML.Classifiers;
with AMF.UML.Directed_Relationships;
limited with AMF.UML.Generalization_Sets.Collections;
package AMF.UML.Generalizations is
pragma Preelaborate;
type UML_Generalization is limited interface
and AMF.UML.Directed_Relationships.UML_Directed_Relationship;
type UML_Generalization_Access is
access all UML_Generalization'Class;
for UML_Generalization_Access'Storage_Size use 0;
not overriding function Get_General
(Self : not null access constant UML_Generalization)
return AMF.UML.Classifiers.UML_Classifier_Access is abstract;
-- Getter of Generalization::general.
--
-- References the general classifier in the Generalization relationship.
not overriding procedure Set_General
(Self : not null access UML_Generalization;
To : AMF.UML.Classifiers.UML_Classifier_Access) is abstract;
-- Setter of Generalization::general.
--
-- References the general classifier in the Generalization relationship.
not overriding function Get_Generalization_Set
(Self : not null access constant UML_Generalization)
return AMF.UML.Generalization_Sets.Collections.Set_Of_UML_Generalization_Set is abstract;
-- Getter of Generalization::generalizationSet.
--
-- Designates a set in which instances of Generalization is considered
-- members.
not overriding function Get_Is_Substitutable
(Self : not null access constant UML_Generalization)
return AMF.Optional_Boolean is abstract;
-- Getter of Generalization::isSubstitutable.
--
-- Indicates whether the specific classifier can be used wherever the
-- general classifier can be used. If true, the execution traces of the
-- specific classifier will be a superset of the execution traces of the
-- general classifier.
not overriding procedure Set_Is_Substitutable
(Self : not null access UML_Generalization;
To : AMF.Optional_Boolean) is abstract;
-- Setter of Generalization::isSubstitutable.
--
-- Indicates whether the specific classifier can be used wherever the
-- general classifier can be used. If true, the execution traces of the
-- specific classifier will be a superset of the execution traces of the
-- general classifier.
not overriding function Get_Specific
(Self : not null access constant UML_Generalization)
return AMF.UML.Classifiers.UML_Classifier_Access is abstract;
-- Getter of Generalization::specific.
--
-- References the specializing classifier in the Generalization
-- relationship.
not overriding procedure Set_Specific
(Self : not null access UML_Generalization;
To : AMF.UML.Classifiers.UML_Classifier_Access) is abstract;
-- Setter of Generalization::specific.
--
-- References the specializing classifier in the Generalization
-- relationship.
end AMF.UML.Generalizations;
| 53.565891 | 96 | 0.559624 |
23e4dc085bf7e88fc395be4ad55115023580964c | 1,180 | adb | Ada | demo/tutorial/components-attackers.adb | csb6/libtcod-ada | 89c2a75eb357a8468ccb0a6476391a6b388f00b4 | [
"BSD-3-Clause"
] | null | null | null | demo/tutorial/components-attackers.adb | csb6/libtcod-ada | 89c2a75eb357a8468ccb0a6476391a6b388f00b4 | [
"BSD-3-Clause"
] | null | null | null | demo/tutorial/components-attackers.adb | csb6/libtcod-ada | 89c2a75eb357a8468ccb0a6476391a6b388f00b4 | [
"BSD-3-Clause"
] | null | null | null | with Actors, Engines, Components.Destructibles, Libtcod.Color;
package body Components.Attackers is
use Destructibles;
------------
-- attack --
------------
procedure attack(self : in out Attacker; owner : in out Actors.Actor;
target : in out Actors.Actor; engine : in out Engines.Engine) is
use Actors, Libtcod;
real_damage : Health;
target_destructible : access Destructible := target.destructible;
msg_header : constant String := owner.get_name & " attacks " & target.get_name & " ";
msg_color : constant RGB_Color := (if owner = engine.player then Color.red else Color.light_grey);
begin
if target.is_destructible and then not target_destructible.is_dead then
real_damage := target_destructible.take_damage(target, self.power, engine);
if real_damage = 0 then
engine.gui.log(msg_header & "for no damage", msg_color);
else
engine.gui.log(msg_header & "for" & real_damage'Image & " damage", msg_color);
end if;
else
engine.gui.log(msg_header & "in vain", msg_color);
end if;
end attack;
end Components.Attackers;
| 35.757576 | 104 | 0.644915 |
20dfafc74846b79389a24da7542ce95e2e27de7f | 4,049 | adb | Ada | src/tests/ahven/ahven-slist.adb | yrashk/ada-util | 2aaa1d87e92a7137e1c63dce90f0722c549dfafd | [
"Apache-2.0"
] | 60 | 2015-01-18T23:05:34.000Z | 2022-03-20T18:56:30.000Z | src/tests/ahven/ahven-slist.adb | yrashk/ada-util | 2aaa1d87e92a7137e1c63dce90f0722c549dfafd | [
"Apache-2.0"
] | 20 | 2016-09-15T16:41:30.000Z | 2022-03-29T22:02:32.000Z | src/tests/ahven/ahven-slist.adb | yrashk/ada-util | 2aaa1d87e92a7137e1c63dce90f0722c549dfafd | [
"Apache-2.0"
] | 10 | 2015-02-13T04:00:45.000Z | 2022-03-20T18:57:54.000Z | --
-- Copyright (c) 2008-2009 Tero Koskinen <[email protected]>
--
-- 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.Unchecked_Deallocation;
package body Ahven.SList is
procedure Remove (Ptr : Node_Access) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => Node,
Name => Node_Access);
My_Ptr : Node_Access := Ptr;
begin
Ptr.Next := null;
Free (My_Ptr);
end Remove;
procedure Append (Target : in out List;
Node_Data : Element_Type) is
New_Node : Node_Access := null;
begin
if Target.Size = Count_Type'Last then
raise List_Full;
end if;
New_Node := new Node'(Data => Node_Data, Next => null);
if Target.Last = null then
Target.First := New_Node;
else
Target.Last.Next := New_Node;
end if;
Target.Last := New_Node;
Target.Size := Target.Size + 1;
end Append;
procedure Clear (Target : in out List) is
Current_Node : Node_Access := Target.First;
Next_Node : Node_Access := null;
begin
while Current_Node /= null loop
Next_Node := Current_Node.Next;
Remove (Current_Node);
Current_Node := Next_Node;
end loop;
Target.First := null;
Target.Last := null;
Target.Size := 0;
end Clear;
function First (Target : List) return Cursor is
begin
return Cursor (Target.First);
end First;
function Next (Position : Cursor) return Cursor is
begin
if Position = null then
raise Invalid_Cursor;
end if;
return Cursor (Position.Next);
end Next;
function Data (Position : Cursor) return Element_Type is
begin
if Position = null then
raise Invalid_Cursor;
end if;
return Position.Data;
end Data;
function Is_Valid (Position : Cursor) return Boolean is
begin
return Position /= null;
end Is_Valid;
function Length (Target : List) return Count_Type is
begin
return Target.Size;
end Length;
procedure For_Each (Target : List) is
Current_Node : Node_Access := Target.First;
begin
while Current_Node /= null loop
Action (Current_Node.Data);
Current_Node := Current_Node.Next;
end loop;
end For_Each;
procedure Initialize (Target : in out List) is
begin
Target.Last := null;
Target.First := null;
Target.Size := 0;
end Initialize;
procedure Finalize (Target : in out List) is
begin
Clear (Target);
end Finalize;
procedure Adjust (Target : in out List) is
Target_Last : Node_Access := null;
Target_First : Node_Access := null;
Current : Node_Access := Target.First;
New_Node : Node_Access;
begin
-- Recreate the list using the same data
while Current /= null loop
New_Node := new Node'(Data => Current.Data, Next => null);
if Target_Last = null then
Target_First := New_Node;
else
Target_Last.Next := New_Node;
end if;
Target_Last := New_Node;
Current := Current.Next;
end loop;
Target.First := Target_First;
Target.Last := Target_Last;
-- No need to adjust size, it is same as before copying
end Adjust;
end Ahven.SList;
| 28.514085 | 75 | 0.634231 |
18fec9db362cfdbaeb0b11a6fe890547223c03aa | 13,063 | ads | Ada | src/gen/pixtend-wiringpi_h.ads | persan/a-piextend | 2b8ffe9ce1735789088e51f6321685759f269cf4 | [
"MIT"
] | null | null | null | src/gen/pixtend-wiringpi_h.ads | persan/a-piextend | 2b8ffe9ce1735789088e51f6321685759f269cf4 | [
"MIT"
] | null | null | null | src/gen/pixtend-wiringpi_h.ads | persan/a-piextend | 2b8ffe9ce1735789088e51f6321685759f269cf4 | [
"MIT"
] | null | null | null | pragma Ada_2012;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with System;
package Pixtend.wiringPi_h is
-- TRUE : constant := 1; -- wiringPi.h:32
-- unsupported macro: FALSE (!TRUE)
-- unsupported macro: UNU __attribute__((unused))
PI_GPIO_MASK : constant := (16#FFFFFFC0#); -- wiringPi.h:43
WPI_MODE_PINS : constant := 0; -- wiringPi.h:49
WPI_MODE_GPIO : constant := 1; -- wiringPi.h:50
WPI_MODE_GPIO_SYS : constant := 2; -- wiringPi.h:51
WPI_MODE_PHYS : constant := 3; -- wiringPi.h:52
WPI_MODE_PIFACE : constant := 4; -- wiringPi.h:53
WPI_MODE_UNINITIALISED : constant := -1; -- wiringPi.h:54
INPUT : constant := 0; -- wiringPi.h:58
OUTPUT : constant := 1; -- wiringPi.h:59
PWM_OUTPUT : constant := 2; -- wiringPi.h:60
GPIO_CLOCK : constant := 3; -- wiringPi.h:61
SOFT_PWM_OUTPUT : constant := 4; -- wiringPi.h:62
SOFT_TONE_OUTPUT : constant := 5; -- wiringPi.h:63
PWM_TONE_OUTPUT : constant := 6; -- wiringPi.h:64
LOW : constant := 0; -- wiringPi.h:66
HIGH : constant := 1; -- wiringPi.h:67
PUD_OFF : constant := 0; -- wiringPi.h:71
PUD_DOWN : constant := 1; -- wiringPi.h:72
PUD_UP : constant := 2; -- wiringPi.h:73
PWM_MODE_MS : constant := 0; -- wiringPi.h:77
PWM_MODE_BAL : constant := 1; -- wiringPi.h:78
INT_EDGE_SETUP : constant := 0; -- wiringPi.h:82
INT_EDGE_FALLING : constant := 1; -- wiringPi.h:83
INT_EDGE_RISING : constant := 2; -- wiringPi.h:84
INT_EDGE_BOTH : constant := 3; -- wiringPi.h:85
PI_MODEL_A : constant := 0; -- wiringPi.h:90
PI_MODEL_B : constant := 1; -- wiringPi.h:91
PI_MODEL_AP : constant := 2; -- wiringPi.h:92
PI_MODEL_BP : constant := 3; -- wiringPi.h:93
PI_MODEL_2 : constant := 4; -- wiringPi.h:94
PI_ALPHA : constant := 5; -- wiringPi.h:95
PI_MODEL_CM : constant := 6; -- wiringPi.h:96
PI_MODEL_07 : constant := 7; -- wiringPi.h:97
PI_MODEL_3B : constant := 8; -- wiringPi.h:98
PI_MODEL_ZERO : constant := 9; -- wiringPi.h:99
PI_MODEL_CM3 : constant := 10; -- wiringPi.h:100
PI_MODEL_ZERO_W : constant := 12; -- wiringPi.h:101
PI_MODEL_3BP : constant := 13; -- wiringPi.h:102
PI_MODEL_3AP : constant := 14; -- wiringPi.h:103
PI_MODEL_CM3P : constant := 16; -- wiringPi.h:104
PI_VERSION_1 : constant := 0; -- wiringPi.h:106
PI_VERSION_1_1 : constant := 1; -- wiringPi.h:107
PI_VERSION_1_2 : constant := 2; -- wiringPi.h:108
PI_VERSION_2 : constant := 3; -- wiringPi.h:109
PI_MAKER_SONY : constant := 0; -- wiringPi.h:111
PI_MAKER_EGOMAN : constant := 1; -- wiringPi.h:112
PI_MAKER_EMBEST : constant := 2; -- wiringPi.h:113
PI_MAKER_UNKNOWN : constant := 3; -- wiringPi.h:114
-- arg-macro: procedure PI_THREAD (X)
-- void *X (UNU void *dummy)
WPI_FATAL : constant := 1; -- wiringPi.h:130
WPI_ALMOST : constant := 0; -- wiringPi.h:131
piModelNames : array (0 .. 19) of Interfaces.C.Strings.chars_ptr -- wiringPi.h:116
with Import => True,
Convention => C,
External_Name => "piModelNames";
piRevisionNames : array (0 .. 15) of Interfaces.C.Strings.chars_ptr -- wiringPi.h:117
with Import => True,
Convention => C,
External_Name => "piRevisionNames";
piMakerNames : array (0 .. 15) of Interfaces.C.Strings.chars_ptr -- wiringPi.h:118
with Import => True,
Convention => C,
External_Name => "piMakerNames";
piMemorySize : aliased array (0 .. 7) of aliased int -- wiringPi.h:119
with Import => True,
Convention => C,
External_Name => "piMemorySize";
type wiringPiNodeStruct;
type wiringPiNodeStruct is record
pinBase : aliased int; -- wiringPi.h:144
pinMax : aliased int; -- wiringPi.h:145
fd : aliased int; -- wiringPi.h:147
data0 : aliased unsigned; -- wiringPi.h:148
data1 : aliased unsigned; -- wiringPi.h:149
data2 : aliased unsigned; -- wiringPi.h:150
data3 : aliased unsigned; -- wiringPi.h:151
pinMode : access procedure
(arg1 : access wiringPiNodeStruct;
arg2 : int;
arg3 : int); -- wiringPi.h:153
pullUpDnControl : access procedure
(arg1 : access wiringPiNodeStruct;
arg2 : int;
arg3 : int); -- wiringPi.h:154
digitalRead : access function (arg1 : access wiringPiNodeStruct; arg2 : int) return int; -- wiringPi.h:155
digitalWrite : access procedure
(arg1 : access wiringPiNodeStruct;
arg2 : int;
arg3 : int); -- wiringPi.h:157
pwmWrite : access procedure
(arg1 : access wiringPiNodeStruct;
arg2 : int;
arg3 : int); -- wiringPi.h:159
analogRead : access function (arg1 : access wiringPiNodeStruct; arg2 : int) return int; -- wiringPi.h:160
analogWrite : access procedure
(arg1 : access wiringPiNodeStruct;
arg2 : int;
arg3 : int); -- wiringPi.h:161
next : access wiringPiNodeStruct; -- wiringPi.h:163
end record
with Convention => C_Pass_By_Copy; -- wiringPi.h:142
wiringPiNodes : access wiringPiNodeStruct -- wiringPi.h:166
with Import => True,
Convention => C,
External_Name => "wiringPiNodes";
function wiringPiFailure (fatal : int; message : Interfaces.C.Strings.chars_ptr -- , ...
) return int -- wiringPi.h:190
with Import => True,
Convention => C,
External_Name => "wiringPiFailure";
function wiringPiFindNode (pin : int) return access wiringPiNodeStruct -- wiringPi.h:194
with Import => True,
Convention => C,
External_Name => "wiringPiFindNode";
function wiringPiNewNode (pinBase : int; numPins : int) return access wiringPiNodeStruct -- wiringPi.h:195
with Import => True,
Convention => C,
External_Name => "wiringPiNewNode";
procedure wiringPiVersion (major : access int; minor : access int) -- wiringPi.h:197
with Import => True,
Convention => C,
External_Name => "wiringPiVersion";
function wiringPiSetup return int -- wiringPi.h:198
with Import => True,
Convention => C,
External_Name => "wiringPiSetup";
function wiringPiSetupSys return int -- wiringPi.h:199
with Import => True,
Convention => C,
External_Name => "wiringPiSetupSys";
function wiringPiSetupGpio return int -- wiringPi.h:200
with Import => True,
Convention => C,
External_Name => "wiringPiSetupGpio";
function wiringPiSetupPhys return int -- wiringPi.h:201
with Import => True,
Convention => C,
External_Name => "wiringPiSetupPhys";
procedure pinModeAlt (pin : int; mode : int) -- wiringPi.h:203
with Import => True,
Convention => C,
External_Name => "pinModeAlt";
procedure pinMode (pin : int; mode : int) -- wiringPi.h:204
with Import => True,
Convention => C,
External_Name => "pinMode";
procedure pullUpDnControl (pin : int; pud : int) -- wiringPi.h:205
with Import => True,
Convention => C,
External_Name => "pullUpDnControl";
function digitalRead (pin : int) return int -- wiringPi.h:206
with Import => True,
Convention => C,
External_Name => "digitalRead";
procedure digitalWrite (pin : int; value : int) -- wiringPi.h:207
with Import => True,
Convention => C,
External_Name => "digitalWrite";
function digitalRead8 (pin : int) return unsigned -- wiringPi.h:208
with Import => True,
Convention => C,
External_Name => "digitalRead8";
procedure digitalWrite8 (pin : int; value : int) -- wiringPi.h:209
with Import => True,
Convention => C,
External_Name => "digitalWrite8";
procedure pwmWrite (pin : int; value : int) -- wiringPi.h:210
with Import => True,
Convention => C,
External_Name => "pwmWrite";
function analogRead (pin : int) return int -- wiringPi.h:211
with Import => True,
Convention => C,
External_Name => "analogRead";
procedure analogWrite (pin : int; value : int) -- wiringPi.h:212
with Import => True,
Convention => C,
External_Name => "analogWrite";
function wiringPiSetupPiFace return int -- wiringPi.h:217
with Import => True,
Convention => C,
External_Name => "wiringPiSetupPiFace";
function wiringPiSetupPiFaceForGpioProg return int -- wiringPi.h:218
with Import => True,
Convention => C,
External_Name => "wiringPiSetupPiFaceForGpioProg";
function piGpioLayout return int -- wiringPi.h:222
with Import => True,
Convention => C,
External_Name => "piGpioLayout";
function piBoardRev return int -- wiringPi.h:223
with Import => True,
Convention => C,
External_Name => "piBoardRev";
procedure piBoardId
(model : access int;
rev : access int;
mem : access int;
maker : access int;
overVolted : access int) -- wiringPi.h:224
with Import => True,
Convention => C,
External_Name => "piBoardId";
function wpiPinToGpio (wpiPin : int) return int -- wiringPi.h:225
with Import => True,
Convention => C,
External_Name => "wpiPinToGpio";
function physPinToGpio (physPin : int) return int -- wiringPi.h:226
with Import => True,
Convention => C,
External_Name => "physPinToGpio";
procedure setPadDrive (group : int; value : int) -- wiringPi.h:227
with Import => True,
Convention => C,
External_Name => "setPadDrive";
function getAlt (pin : int) return int -- wiringPi.h:228
with Import => True,
Convention => C,
External_Name => "getAlt";
procedure pwmToneWrite (pin : int; freq : int) -- wiringPi.h:229
with Import => True,
Convention => C,
External_Name => "pwmToneWrite";
procedure pwmSetMode (mode : int) -- wiringPi.h:230
with Import => True,
Convention => C,
External_Name => "pwmSetMode";
procedure pwmSetRange (c_range : unsigned) -- wiringPi.h:231
with Import => True,
Convention => C,
External_Name => "pwmSetRange";
procedure pwmSetClock (divisor : int) -- wiringPi.h:232
with Import => True,
Convention => C,
External_Name => "pwmSetClock";
procedure gpioClockSet (pin : int; freq : int) -- wiringPi.h:233
with Import => True,
Convention => C,
External_Name => "gpioClockSet";
function digitalReadByte return unsigned -- wiringPi.h:234
with Import => True,
Convention => C,
External_Name => "digitalReadByte";
function digitalReadByte2 return unsigned -- wiringPi.h:235
with Import => True,
Convention => C,
External_Name => "digitalReadByte2";
procedure digitalWriteByte (value : int) -- wiringPi.h:236
with Import => True,
Convention => C,
External_Name => "digitalWriteByte";
procedure digitalWriteByte2 (value : int) -- wiringPi.h:237
with Import => True,
Convention => C,
External_Name => "digitalWriteByte2";
function waitForInterrupt (pin : int; mS : int) return int -- wiringPi.h:242
with Import => True,
Convention => C,
External_Name => "waitForInterrupt";
function wiringPiISR
(pin : int;
mode : int;
c_function : access procedure) return int -- wiringPi.h:243
with Import => True,
Convention => C,
External_Name => "wiringPiISR";
function piThreadCreate (fn : access function (arg1 : System.Address) return System.Address) return int -- wiringPi.h:247
with Import => True,
Convention => C,
External_Name => "piThreadCreate";
procedure piLock (key : int) -- wiringPi.h:248
with Import => True,
Convention => C,
External_Name => "piLock";
procedure piUnlock (key : int) -- wiringPi.h:249
with Import => True,
Convention => C,
External_Name => "piUnlock";
function piHiPri (pri : int) return int -- wiringPi.h:253
with Import => True,
Convention => C,
External_Name => "piHiPri";
procedure c_delay (howLong : unsigned) -- wiringPi.h:257
with Import => True,
Convention => C,
External_Name => "delay";
procedure delayMicroseconds (howLong : unsigned) -- wiringPi.h:258
with Import => True,
Convention => C,
External_Name => "delayMicroseconds";
function millis return unsigned -- wiringPi.h:259
with Import => True,
Convention => C,
External_Name => "millis";
function micros return unsigned -- wiringPi.h:260
with Import => True,
Convention => C,
External_Name => "micros";
end Pixtend.wiringPi_h;
| 34.649867 | 125 | 0.613106 |
2318225ae151dc3d636930ee3665f5e9cb1d4470 | 13,180 | adb | Ada | tools/ayacc/src/parser.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | tools/ayacc/src/parser.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | tools/ayacc/src/parser.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | -- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- The primary authors of ayacc were David Taback and Deepak Tolani.
-- Enhancements were made by Ronald J. Schmalz.
--
-- Send requests for ayacc information to [email protected]
-- Send bug reports for ayacc to [email protected]
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- Module : parser_body.ada
-- Component of : ayacc
-- Version : 1.2
-- Date : 11/21/86 12:32:43
-- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxparser_body.ada
-- $Header: parser_body.a,v 0.1 86/04/01 15:10:24 ada Exp $
-- $Log: parser_body.a,v $
-- Revision 0.1 86/04/01 15:10:24 ada
-- This version fixes some minor bugs with empty grammars
-- and $$ expansion. It also uses vads5.1b enhancements
-- such as pragma inline.
--
--
-- Revision 0.0 86/02/19 18:40:31 ada
--
-- These files comprise the initial version of Ayacc
-- designed and implemented by David Taback and Deepak Tolani.
-- Ayacc has been compiled and tested under the Verdix Ada compiler
-- version 4.06 on a vax 11/750 running Unix 4.2BSD.
--
-- --
-- The body of the parser for the specification file --
-- --
with Text_IO; use Text_IO;
with Lexical_Analyzer; use Lexical_Analyzer;
-- with STR_Pack; use STR_Pack;
with Symbol_Table; use Symbol_Table;
with Rule_Table; use Rule_Table;
with Actions_File; use Actions_File;
with Tokens_File; use Tokens_File;
with String_Pkg;
package body Parser is
Found_Error : Boolean := False;
Start_Defined : Boolean := False;
procedure Nonfatal_Error(Message: in String) is
begin
Print_Context_Lines;
--RJS Put_Line("--- " & Message);
New_Line;
Put_Line ("Ayacc: " & Message);
Found_Error := True;
end Nonfatal_Error;
procedure Fatal_Error(Message: in String) is
begin
Print_Context_Lines;
--RJS Put_Line("--- " & Message);
New_Line;
Put_Line ("Ayacc: " & Message);
raise Syntax_Error;
end Fatal_Error;
procedure Augment_Grammar(Users_Start_Symbol : in Grammar_Symbol) is
-- Inserts S' -> S $end as a rule in the rule table.
Start_Sym : Grammar_Symbol;
Augmented_Rule : Rule;
begin
Start_Defined := True;
Augmented_Rule := Make_Rule(Start_Symbol);
Append_RHS(Augmented_Rule, Users_Start_Symbol);
Append_RHS(Augmented_Rule, End_Symbol);
end Augment_Grammar;
-- --
-- A recursive descent parser for the rules in the --
-- grammar. --
procedure Parse_Rules is
T : Ayacc_Token;
Current_Rule : Rule;
LHS : Grammar_Symbol;
-- --
-- Gets an action from the file and writes it to --
-- the actions file. --
-- --
-- --
-- Parses a sequence of Symbols --
-- --
procedure Symbols is
ID : Grammar_Symbol;
Got_Action : Boolean := False;
Precedence_Level : Precedence;
begin
loop
T := Get_Token;
exit when T = Vertical_Bar or T = Semicolon or T = Prec;
-- Do we have an action in the middle of a rule?
if Got_Action then
Got_Action := T = Left_Brace;
Handle_Nested_Rule(Current_Rule);
end if;
case T is
-- Update the current rule
when Character_Literal =>
ID := Insert_Terminal(Get_Lexeme_Text);
Append_RHS(Current_Rule, ID);
-- Update the current rule and add to symbol table
when Identifier =>
ID := Insert_Identifier(Get_Lexeme_Text);
Append_RHS(Current_Rule, ID);
-- Got an action
when Left_Brace =>
Handle_Action(Integer(Current_Rule),
Integer(Length_of(Current_Rule)));
Got_Action := True;
when others =>
Fatal_Error("Unexpected symbol");
end case;
end loop;
if T = Prec then
if Got_Action then
Fatal_Error("%prec cannot be preceded by an action");
raise Syntax_Error;
end if;
T := Get_Token;
if T /= Identifier and T /= Character_Literal then
Fatal_Error("Expecting a terminal after %prec");
end if;
ID := Insert_Identifier(Get_Lexeme_Text);
if Is_Nonterminal(ID) then
Fatal_Error("Expecting a terminal after %prec");
end if;
Precedence_Level := Get_Precedence(ID);
if Precedence_Level = 0 then
Fatal_Error("Terminal following %prec has no precedence");
else
Set_Rule_Precedence(Current_Rule, Precedence_Level);
end if;
T := Get_Token;
case T is
when Left_Brace =>
Handle_Action(Integer(Current_Rule),
Integer(Length_of(Current_Rule)));
T := Get_Token;
when Semicolon | Vertical_Bar =>
null;
when others =>
Fatal_Error("Illegal token following %prec");
end case;
end if;
end Symbols;
-- --
-- Parse an Ayacc grammar rule --
-- --
procedure Rule is
begin
T := Get_Token;
if T /= Colon then
Fatal_Error("Expecting a colon after the LHS of the rule");
else
Current_Rule := Make_Rule(LHS);
Symbols;
end if;
while (T = Vertical_Bar) loop
-- Make a new rule with the current LHS grammar symbol
Current_Rule := Make_Rule(LHS);
Symbols;
end loop;
if T /= Semicolon then
Fatal_Error("Expecting a semicolon");
end if;
end Rule;
-- --
-- Parse a sequence of grammar rules --
-- --
procedure Rules is
begin
T := Get_Token;
if T = Identifier then
-- Make the left hand side of the rule
LHS := Insert_Identifier(Get_Lexeme_Text);
if Is_Terminal(LHS) then
Fatal_Error("Terminals cannot be on the LHS of a rule");
end if;
if not Start_Defined then
Augment_Grammar(LHS);
end if;
Rule;
Rules;
elsif T /= Mark then
Fatal_Error("Expecting next section");
end if;
end Rules;
begin -- parse_rules
Actions_File.Initialize;
Rules;
Actions_File.Finish;
-- Check for empty grammars. If the grammar is empty then
-- create a rule S -> $end.
if not Start_Defined then
Append_RHS(Make_Rule(Start_Symbol), End_Symbol);
end if;
exception
when Illegal_Token =>
Fatal_Error("illegal token");
end Parse_Rules;
-- --
-- Parse the declarations section of the source --
-- --
procedure Parse_Declarations is
Precedence_Level : Precedence := 0;
Next_Token : Ayacc_Token;
ID : Grammar_Symbol;
procedure Parse_Start_Symbol is
Users_Start_Symbol : Grammar_Symbol;
begin
if Start_Defined then
Fatal_Error("The start symbol has been defined already.");
end if;
if Next_Token /= Identifier then
if Next_Token = Lexical_Analyzer.Eof_Token then
Fatal_Error("Unexpected end of file before first '%%'");
else
Fatal_Error("Expecting identifier");
end if;
end if;
Users_Start_Symbol := Insert_Identifier(Get_Lexeme_Text);
if Is_Nonterminal(Users_Start_Symbol) then
Augment_Grammar(Users_Start_Symbol);
else
Fatal_Error("Attempt to define terminal as start_symbol");
end if;
Next_Token := Get_Token;
end Parse_Start_Symbol;
procedure Parse_Token_List(Precedence_Value : in Precedence;
Associativity_Value : in Associativity) is
Temp_Sym : Grammar_Symbol;
begin
loop
if Next_Token /= Identifier and then
Next_Token /= Character_Literal then
if Next_Token = Lexical_Analyzer.Eof_Token then
Fatal_Error("Unexpected end of file before first '%%'");
else
Fatal_Error("Expecting token declaration");
end if;
end if;
Temp_Sym := Insert_Terminal(Get_Lexeme_Text,
Precedence_Value,
Associativity_Value);
Next_Token := Get_Token;
if Next_Token = Comma then
Next_Token := Get_Token;
elsif Next_Token = Semicolon then
Next_Token := Get_Token;
exit;
elsif Next_Token /= Identifier and then
Next_Token /= Character_Literal then
exit;
end if;
end loop;
exception
when Illegal_Entry =>
-- I think only trying to insert the "start symbol"
-- in a token list will cause this exception
Fatal_Error("Illegal symbol as token");
end Parse_Token_List;
procedure Parse_Package_Name_List(Context_Clause : in Ayacc_Token) is
use String_Pkg;
begin
if Tokens_Package_Header_Has_Been_Generated then
Fatal_Error ("Context Clause Specifications May Not " &
"Appear After Ada Declarations.");
else
case Context_Clause is
when With_Clause =>
Tokens_File.Write ("with ");
when Use_Clause =>
Tokens_File.Write ("use ");
when others =>
Fatal_Error ("Illegal Context Clause Specification");
end case;
loop
if Next_Token /= Identifier then
if Next_Token = Lexical_Analyzer.Eof_Token then
Fatal_Error("Unexpected end of file before first '%%'");
else
Fatal_Error("Expecting Package Name");
end if;
end if;
Tokens_File.Write (' ' & Value (Mixed (Get_Lexeme_Text)));
Next_Token := Get_Token;
if Next_Token = Comma then
Next_Token := Get_Token;
Tokens_File.Write (",");
elsif Next_Token = Semicolon then
Next_Token := Get_Token;
Tokens_File.Writeln (";");
exit;
elsif Next_Token /= Identifier then
Tokens_File.Writeln (";");
exit;
else
Tokens_File.Write (",");
end if;
end loop;
end if;
end Parse_Package_Name_List;
begin
Next_Token := Get_Token;
loop
case Next_Token is
when Start =>
Next_Token := Get_Token;
Parse_Start_Symbol;
if Next_Token = Semicolon then
Next_Token := Get_Token;
end if;
when Token =>
Next_Token := Get_Token;
Parse_Token_List(0, Undefined);
when Nonassoc =>
Next_Token := Get_Token;
Precedence_Level := Precedence_Level + 1;
Parse_Token_List(Precedence_Level, Nonassociative);
when Right =>
Next_Token := Get_Token;
Precedence_Level := Precedence_Level + 1;
Parse_Token_List(Precedence_Level, Right_Associative);
when Left =>
Next_Token := Get_Token;
Precedence_Level := Precedence_Level + 1;
Parse_Token_List(Precedence_Level, Left_Associative);
when Mark =>
exit;
when Lexical_Analyzer.Eof_Token =>
Fatal_Error("Unexpected end of file before first %%");
when Left_Brace =>
Start_Tokens_Package;
Dump_Declarations; -- to the TOKENS file.
Next_Token := Get_Token;
when With_Clause =>
Next_Token := Get_Token;
Parse_Package_Name_List (With_Clause);
when Use_Clause =>
Next_Token := Get_Token;
Parse_Package_Name_List (Use_Clause);
when others =>
Fatal_Error("Unexpected symbol");
end case;
end loop;
exception
when Illegal_Token =>
Fatal_Error("Bad symbol");
when Redefined_Precedence_Error =>
Fatal_Error("Attempt to redefine precedence");
end Parse_Declarations;
end Parser;
| 30.651163 | 76 | 0.585129 |
c54091a3a7af50fb839e170f754fb87e6dacfbf6 | 1,465 | adb | Ada | src/ether.adb | Lucretia/ether | 4e03f83382d6b495f4316674f5a668bd71000f69 | [
"BSD-3-Clause"
] | 4 | 2015-01-03T01:43:24.000Z | 2021-01-30T11:33:06.000Z | src/ether.adb | Lucretia/ether | 4e03f83382d6b495f4316674f5a668bd71000f69 | [
"BSD-3-Clause"
] | null | null | null | src/ether.adb | Lucretia/ether | 4e03f83382d6b495f4316674f5a668bd71000f69 | [
"BSD-3-Clause"
] | null | null | null | -- -*- Mode: Ada -*-
-- Filename : ether.adb
-- Description : Body root of the Ether SCGI library.
-- Author : Luke A. Guest
-- Created On : Thu May 3 15:32:35 2012
with Ada.Directories;
package body Ether is
procedure Initialise
(Bytes : in Positive;
Upload_Dir : in String;
Temp_Dir : in String) is
package Dirs renames Ada.Directories;
begin
Max_Request_Bytes := Bytes;
if Dirs.Exists (Upload_Dir) then
Uploads := US.To_Unbounded_String (Upload_Dir);
if Dirs.Exists (Temp_Dir) then
Temps := US.To_Unbounded_String (Temp_Dir);
Initialised := True;
else
raise Initialisation_Error with
"[Ether] Temporary directory """ & Temp_Dir & """ does not exist!";
end if;
else
raise Initialisation_Error with
"[Ether] Upload directory """ & Upload_Dir & """ does not exist!";
end if;
end Initialise;
function Is_Initialised return Boolean is
begin
return Initialised;
end Is_Initialised;
function Max_Request_Size return Positive is
begin
return Max_Request_Bytes;
end Max_Request_Size;
function Upload_Dir return String is
begin
return US.To_String (Uploads);
end Upload_Dir;
function Temp_Dir return String is
begin
return US.To_String (Temps);
end Temp_Dir;
end Ether;
| 27.12963 | 81 | 0.610239 |
dc76ce0b80767cd3d85411f03adf98d901736ab6 | 16,418 | adb | Ada | source/amf/uml/amf-internals-uml_action_execution_specifications.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/amf/uml/amf-internals-uml_action_execution_specifications.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/amf/uml/amf-internals-uml_action_execution_specifications.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Elements;
with AMF.Internals.Element_Collections;
with AMF.Internals.Helpers;
with AMF.Internals.Tables.UML_Attributes;
with AMF.Visitors.UML_Iterators;
with AMF.Visitors.UML_Visitors;
with League.Strings.Internals;
with Matreshka.Internals.Strings;
package body AMF.Internals.UML_Action_Execution_Specifications is
-------------------
-- Enter_Element --
-------------------
overriding procedure Enter_Element
(Self : not null access constant UML_Action_Execution_Specification_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Enter_Action_Execution_Specification
(AMF.UML.Action_Execution_Specifications.UML_Action_Execution_Specification_Access (Self),
Control);
end if;
end Enter_Element;
-------------------
-- Leave_Element --
-------------------
overriding procedure Leave_Element
(Self : not null access constant UML_Action_Execution_Specification_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Visitor in AMF.Visitors.UML_Visitors.UML_Visitor'Class then
AMF.Visitors.UML_Visitors.UML_Visitor'Class
(Visitor).Leave_Action_Execution_Specification
(AMF.UML.Action_Execution_Specifications.UML_Action_Execution_Specification_Access (Self),
Control);
end if;
end Leave_Element;
-------------------
-- Visit_Element --
-------------------
overriding procedure Visit_Element
(Self : not null access constant UML_Action_Execution_Specification_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control) is
begin
if Iterator in AMF.Visitors.UML_Iterators.UML_Iterator'Class then
AMF.Visitors.UML_Iterators.UML_Iterator'Class
(Iterator).Visit_Action_Execution_Specification
(Visitor,
AMF.UML.Action_Execution_Specifications.UML_Action_Execution_Specification_Access (Self),
Control);
end if;
end Visit_Element;
----------------
-- Get_Action --
----------------
overriding function Get_Action
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.UML.Actions.UML_Action_Access is
begin
return
AMF.UML.Actions.UML_Action_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Action
(Self.Element)));
end Get_Action;
----------------
-- Set_Action --
----------------
overriding procedure Set_Action
(Self : not null access UML_Action_Execution_Specification_Proxy;
To : AMF.UML.Actions.UML_Action_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Action
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Action;
----------------
-- Get_Finish --
----------------
overriding function Get_Finish
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access is
begin
return
AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Finish
(Self.Element)));
end Get_Finish;
----------------
-- Set_Finish --
----------------
overriding procedure Set_Finish
(Self : not null access UML_Action_Execution_Specification_Proxy;
To : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Finish
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Finish;
---------------
-- Get_Start --
---------------
overriding function Get_Start
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access is
begin
return
AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Start
(Self.Element)));
end Get_Start;
---------------
-- Set_Start --
---------------
overriding procedure Set_Start
(Self : not null access UML_Action_Execution_Specification_Proxy;
To : AMF.UML.Occurrence_Specifications.UML_Occurrence_Specification_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Start
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Start;
-----------------
-- Get_Covered --
-----------------
overriding function Get_Covered
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.UML.Lifelines.Collections.Set_Of_UML_Lifeline is
begin
return
AMF.UML.Lifelines.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Covered
(Self.Element)));
end Get_Covered;
-------------------------------
-- Get_Enclosing_Interaction --
-------------------------------
overriding function Get_Enclosing_Interaction
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.UML.Interactions.UML_Interaction_Access is
begin
return
AMF.UML.Interactions.UML_Interaction_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Enclosing_Interaction
(Self.Element)));
end Get_Enclosing_Interaction;
-------------------------------
-- Set_Enclosing_Interaction --
-------------------------------
overriding procedure Set_Enclosing_Interaction
(Self : not null access UML_Action_Execution_Specification_Proxy;
To : AMF.UML.Interactions.UML_Interaction_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Enclosing_Interaction
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Enclosing_Interaction;
---------------------------
-- Get_Enclosing_Operand --
---------------------------
overriding function Get_Enclosing_Operand
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access is
begin
return
AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Enclosing_Operand
(Self.Element)));
end Get_Enclosing_Operand;
---------------------------
-- Set_Enclosing_Operand --
---------------------------
overriding procedure Set_Enclosing_Operand
(Self : not null access UML_Action_Execution_Specification_Proxy;
To : AMF.UML.Interaction_Operands.UML_Interaction_Operand_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Enclosing_Operand
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Enclosing_Operand;
--------------------------
-- Get_General_Ordering --
--------------------------
overriding function Get_General_Ordering
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.UML.General_Orderings.Collections.Set_Of_UML_General_Ordering is
begin
return
AMF.UML.General_Orderings.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_General_Ordering
(Self.Element)));
end Get_General_Ordering;
---------------------------
-- Get_Client_Dependency --
---------------------------
overriding function Get_Client_Dependency
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is
begin
return
AMF.UML.Dependencies.Collections.Wrap
(AMF.Internals.Element_Collections.Wrap
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Client_Dependency
(Self.Element)));
end Get_Client_Dependency;
-------------------------
-- Get_Name_Expression --
-------------------------
overriding function Get_Name_Expression
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access is
begin
return
AMF.UML.String_Expressions.UML_String_Expression_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Name_Expression
(Self.Element)));
end Get_Name_Expression;
-------------------------
-- Set_Name_Expression --
-------------------------
overriding procedure Set_Name_Expression
(Self : not null access UML_Action_Execution_Specification_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access) is
begin
AMF.Internals.Tables.UML_Attributes.Internal_Set_Name_Expression
(Self.Element,
AMF.Internals.Helpers.To_Element
(AMF.Elements.Element_Access (To)));
end Set_Name_Expression;
-------------------
-- Get_Namespace --
-------------------
overriding function Get_Namespace
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
return
AMF.UML.Namespaces.UML_Namespace_Access
(AMF.Internals.Helpers.To_Element
(AMF.Internals.Tables.UML_Attributes.Internal_Get_Namespace
(Self.Element)));
end Get_Namespace;
------------------------
-- Get_Qualified_Name --
------------------------
overriding function Get_Qualified_Name
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.Optional_String is
begin
declare
use type Matreshka.Internals.Strings.Shared_String_Access;
Aux : constant Matreshka.Internals.Strings.Shared_String_Access
:= AMF.Internals.Tables.UML_Attributes.Internal_Get_Qualified_Name (Self.Element);
begin
if Aux = null then
return (Is_Empty => True);
else
return (False, League.Strings.Internals.Create (Aux));
end if;
end;
end Get_Qualified_Name;
-------------------------
-- All_Owning_Packages --
-------------------------
overriding function All_Owning_Packages
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "All_Owning_Packages unimplemented");
raise Program_Error with "Unimplemented procedure UML_Action_Execution_Specification_Proxy.All_Owning_Packages";
return All_Owning_Packages (Self);
end All_Owning_Packages;
-----------------------------
-- Is_Distinguishable_From --
-----------------------------
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Action_Execution_Specification_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Is_Distinguishable_From unimplemented");
raise Program_Error with "Unimplemented procedure UML_Action_Execution_Specification_Proxy.Is_Distinguishable_From";
return Is_Distinguishable_From (Self, N, Ns);
end Is_Distinguishable_From;
---------------
-- Namespace --
---------------
overriding function Namespace
(Self : not null access constant UML_Action_Execution_Specification_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access is
begin
-- Generated stub: replace with real body!
pragma Compile_Time_Warning (Standard.True, "Namespace unimplemented");
raise Program_Error with "Unimplemented procedure UML_Action_Execution_Specification_Proxy.Namespace";
return Namespace (Self);
end Namespace;
end AMF.Internals.UML_Action_Execution_Specifications;
| 39.946472 | 122 | 0.6153 |
2083bb961849d439c4f823f97a9b8f2abeda2432 | 11,287 | adb | Ada | makestem.adb | ddugovic/words | 13c2fc67d5b75259318cb4c9d23d3abcb7e5efbe | [
"MIT"
] | 4 | 2016-10-30T13:30:55.000Z | 2021-09-25T21:29:17.000Z | makestem.adb | ddugovic/words | 13c2fc67d5b75259318cb4c9d23d3abcb7e5efbe | [
"MIT"
] | 1 | 2020-09-29T02:56:42.000Z | 2020-10-06T18:50:42.000Z | makestem.adb | ddugovic/words | 13c2fc67d5b75259318cb4c9d23d3abcb7e5efbe | [
"MIT"
] | 7 | 2016-07-07T20:40:08.000Z | 2021-10-18T21:11:06.000Z | with Text_Io;
with Strings_Package; use Strings_Package;
with Latin_File_Names; use Latin_File_Names;
with Inflections_Package; use Inflections_Package;
with Dictionary_Package; use Dictionary_Package;
with Word_Support_Package; use Word_Support_Package;
procedure MAKESTEM is
use Integer_Io;
use STEM_KEY_TYPE_IO;
use COUNT_IO;
use Text_IO;
use STEM_IO;
use MNPC_IO;
use Part_Entry_IO;
D_K : Dictionary_Kind := XXX; -- ######################
I : STEM_IO.COUNT := 0;
Line, Blanks : String(1..200) := (others => ' ');
Last, Ll : Integer := 0;
M : STEM_IO.Positive_Count := 1;
Ds : Dictionary_Stem;
Fc, Ofc : Character := ' ';
Sc, Osc : Character := ' ';
procedure Put_Indices(Ch : String;
D_K : Dictionary_Kind) is
Wd : String(1..2) := Ch(1..2);
begin
--Put_Line("Put_Indices");
if Ch = " " then
if (Bblf(Ch(1), Ch(2), D_K) > 0) and then
(Bbll(Ch(1), Ch(2), D_K) >= Bblf(Ch(1), Ch(2), D_K)) then
Put("CH = ("); Put(Ch); Put(") index is of range ");
Put(Bblf(Ch(1), Ch(2), D_K)); Put(".."); Put(Bbll(Ch(1), Ch(2), D_K));
Put(" number ");
Put(Bbll(Ch(1), Ch(2), D_K) - Bblf(Ch(1), Ch(2), D_K) + 1);
New_Line;
end if;
elsif Ch(2) = ' ' then
if (Bdlf(Ch(1), Ch(2), D_K) > 0) and then
(Bdll(Ch(1), Ch(2), D_K) >= Bdlf(Ch(1), Ch(2), D_K)) then
Put("CH = ("); Put(Ch); Put(") index is of range ");
Put(Bdlf(Ch(1), Ch(2), D_K)); Put(".."); Put(Bdll(Ch(1), Ch(2), D_K));
Put(" number ");
Put(Bdll(Ch(1), Ch(2), D_K) - Bdlf(Ch(1), Ch(2), D_K) + 1);
New_Line;
end if;
else
if (First_Index(Wd, D_K) > 0) and then
(Last_Index(Wd, D_K) >= First_Index(Wd, D_K)) then
Put("CH = ("); Put(Wd); Put(") index is of range ");
Put(First_Index(Wd, D_K)); Put(".."); Put(Last_Index(Wd, D_K));
Put(" number ");
Put(Last_Index(Wd, D_K) - First_Index(Wd, D_K) + 1);
New_Line;
end if;
end if;
end Put_Indices;
begin
Put_Line("Creates STEMFILE.D_K and INDXFILE.D_K from STEMLIST.D_K");
Put("What dictionary to load, GENERAL or SPECIAL =>");
Get_Line(Line, Last);
if Last > 0 then
if Trim(Line(1..Last))(1) = 'G' or else
Trim(Line(1..Last))(1) = 'g' then
D_K := General;
elsif Trim(Line(1..Last))(1) = 'S' or else
Trim(Line(1..Last))(1) = 's' then
D_K := Special;
else
Put_Line("No such dictionary");
raise Text_Io.Data_Error;
end if;
end if;
Open( STEM_List(D_K), In_File,
Add_File_Name_Extension(STEM_List_Name,
Dictionary_Kind'Image(D_K)));
Create(STEM_File(D_K), Inout_File,
Add_File_Name_Extension(STEM_File_Name,
Dictionary_Kind'Image(D_K)));
Create(Indx_File(D_K), Out_File,
Add_File_Name_Extension(Indx_File_Name,
Dictionary_Kind'Image(D_K)));
------------------------------------------------------------------
-- This section assumes the blank ESSE stem is first - D_K GENERAL
if D_K = General then
I := I + 1;
Bblf(' ', ' ', General) := I;
Bbll(' ', ' ', General) := 0;
Line := Blanks;
Get_Line(STEM_List(D_K), Line, Last);
PUT_LINE(LINE(1..LAST));
Fc := Line(1);
Sc := Line(2);
Ds.Stem := Line(1..Max_Stem_Size);
--PUT_LINE("#" & LINE(MAX_STEM_SIZE+1..LAST));
Get(Line(Max_Stem_Size+1..Last), Ds.Part, Ll);
--PUT(DS.PART); NEW_LINE;
--PUT_LINE("#" & LINE(LL+1..LAST));
Get(Line(Ll+1..Last), Ds.Key , Ll);
--PUT(DS.KEY ); NEW_LINE;
--PUT_LINE("#" & LINE(LL+1..LAST));
Get(Line(Ll+1..Last), Ds.mnpc , Ll);
--PUT(DS.AAMNPC); NEW_LINE;
Write(STEM_File(D_K), Ds);
Bbll(Fc, Sc, General) := I; -- 1
Put(Indx_File(D_K), " ");
Put(Indx_File(D_K), ' ');
Put(Indx_File(D_K), Bblf(' ', ' ', General));
Put(Indx_File(D_K), ' ');
Put(Indx_File(D_K), Bbll(' ', ' ', General));
Put(Indx_File(D_K), ' ');
New_Line(Indx_File(D_K));
Put_Indices(" ", General);
end if;
------------------------------------------------------------------
Fc := 'a';
Ofc := 'a';
Sc := ' ';
Osc := ' ';
Bdlf(Ofc, ' ', D_K) := I + 1;
--DEBUG.PUT(" bf1 BDLF("); DEBUG.PUT(OFC);
--DEBUG.PUT(' '); DEBUG.PUT(") "); DEBUG.PUT(BDLF(OFC, ' ', D_K));
--DEBUG.NEW_LINE;
First_Character_Loop:
while not End_Of_File(STEM_List(D_K)) loop
--OSC := ' ';
Osc := Sc;
Second_Character_Loop:
while not End_Of_File(STEM_List(D_K)) loop
Inner_Loop:
while not End_Of_File(STEM_List(D_K)) loop
Line := Blanks;
Get_Line(STEM_List(D_K), Line, Last);
--Put_Line("* " & Line(1..Last));
if Trim(Line(1..Last)) = "" then Put_Line("Trim(Line(1..Last)) BLANK"); end if;
exit First_Character_Loop when Trim(Line(1..Last)) = "";
Fc := Lower_Case(Line(1));
Sc := Lower_Case(Line(2));
--------------------------------------------------------------------
if Fc = 'v' then Fc := 'u'; end if;
if Sc = 'v' then Sc := 'u'; end if;
if Fc = 'j' then Fc := 'i'; end if;
if Sc = 'j' then Sc := 'i'; end if;
--------------------------------------------------------------------
I := I + 1;
if Sc = ' ' then
--Put("BDL I -> "); Put(I ); New_Line;
if Fc /= Ofc then
Bdlf(Fc, ' ', D_K) := I;
--Put(" bf2 BDLF("); Put(Fc);Put(' '); Put(") ");
--Put(Bdlf(Fc, ' ', D_K)); New_Line;
end if;
else
null;
--Put("I -> "); Put(I); New_Line;
end if;
Ds.Stem := Line(1..Max_Stem_Size);
Get(Line(Max_Stem_Size+1..Last), Ds.Part, Ll);
Get(Line(Ll+1..Last), Ds.Key , Ll);
Get(Line(Ll+1..Last), Ds.mnpc , Ll);
Write(STEM_File(D_K), Ds);
--Put_Line("Wrote STEMfile");
if Fc /= Ofc then -- Jumped FC, effectively must have jumped a SC
--Put_Line("Jumped FC");
if Osc = ' ' then
Bdll(Ofc, Osc, D_K) := I - 1;
else
Ddll(Ofc, Osc, D_K) := I - 1;
end if;
if Sc = ' ' then
--Put("BDLF "); Put(Bdlf(Fc, Sc, D_K)); New_Line;
Bdlf(Fc, Sc, D_K) := I;
else
Ddlf(Fc, Sc, D_K) := I;
end if;
--Put_Line("if Sc done");
--Put("Ofc = '"); Put(Ofc); Put("' Osc = '"); Put(Osc); Put_Line("'");
Put_Indices(Ofc & Osc, D_K);
Ofc := Fc;
Osc := Sc;
--Put_Line("exit Second_Character_Loop");
exit Second_Character_Loop;
else
if Sc /= Osc then -- Jumped a SC, but not a FC
if Osc = ' ' then -- Jumped a SC from ' ' to something
Bdll(Fc, Osc, D_K) := I - 1; -- So set BDLL
--DEBUG.PUT(" bl1 BDLL("); DEBUG.PUT(FC); DEBUG.PUT(OSC); DEBUG.PUT(") ");
--DEBUG.PUT(BDLL(FC, OSC, D_K)); DEBUG.NEW_LINE;
Ddlf(Fc, Sc, D_K) := I;
--DEBUG.PUT(" df1 DDLF("); DEBUG.PUT( FC); DEBUG.PUT( SC); DEBUG.PUT(") ");
--DEBUG.PUT(DDLF( FC, SC, D_K)); DEBUG.NEW_LINE;
Put_Indices(Fc & Osc, D_K);
Osc := Sc;
exit Inner_Loop;
else -- Jumped a SL from something, not ' '
Ddll(Fc, Osc, D_K) := I - 1; -- So set DDLL
--DEBUG.PUT(" dl2 DDLL("); DEBUG.PUT(FC); DEBUG.PUT(OSC); DEBUG.PUT(") ");
--DEBUG.PUT(DDLL(FC, OSC, D_K)); DEBUG.NEW_LINE;
Ddlf(Fc, Sc, D_K) := I;
--DEBUG.PUT(" df2 DDLF("); DEBUG.PUT( FC); DEBUG.PUT( SC); DEBUG.PUT(") ");
--DEBUG.PUT(DDLF( FC, SC, D_K)); DEBUG.NEW_LINE;
Put_Indices(Fc & Osc, D_K);
Osc := Sc;
exit Inner_Loop;
end if;
end if;
end if;
end loop Inner_Loop;
--Put_Line("Exitted Inner_Loop");
end loop Second_Character_Loop;
--Put_Line("Exitted Second_Character_Loop");
end loop First_Character_Loop;
--Put_Line("Exitted First_Character_Loop");
Ddll(Ofc, Osc, D_K) := I;
-- To reprint correctly the last letter information
--Put_Line("-- To reprint correctly the last letter information");
Put_Indices(Ofc & Osc, D_K);
Close(STEM_File(D_K));
for I in Character'('a')..Character'('z') loop
for J in Character'(' ')..Character'(' ') loop
Text_Io.Put(Indx_File(D_K), (I, J));
Put(Indx_File(D_K), ' ');
Put(Indx_File(D_K), Bdlf(I, J, D_K));
Put(Indx_File(D_K), ' ');
Put(Indx_File(D_K), Bdll(I, J, D_K));
Put(Indx_File(D_K), ' ');
New_Line(Indx_File(D_K));
end loop;
end loop;
for I in Character'('a')..Character'('z') loop
for J in Character'('a')..Character'('z') loop
Text_Io.Put(Indx_File(D_K), (I, J));
Put(Indx_File(D_K), ' ');
Put(Indx_File(D_K), Ddlf(I, J, D_K));
Put(Indx_File(D_K), ' ');
Put(Indx_File(D_K), Ddll(I, J, D_K));
Put(Indx_File(D_K), ' ');
New_Line(Indx_File(D_K));
end loop;
end loop;
Close(Indx_File(D_K));
end MAKESTEM;
| 40.600719 | 99 | 0.41251 |
c5a5720e46fbd1c51df02a35acfb78b6e34da67d | 16,156 | adb | Ada | source/strings/a-stnama.adb | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 33 | 2015-04-04T09:19:36.000Z | 2021-11-10T05:33:34.000Z | source/strings/a-stnama.adb | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 8 | 2017-11-14T13:05:07.000Z | 2018-08-09T15:28:49.000Z | source/strings/a-stnama.adb | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 9 | 2015-02-03T17:09:53.000Z | 2021-11-12T01:16:05.000Z | with Ada.Characters.Conversions;
with Ada.Exception_Identification.From_Here;
package body Ada.Strings.Naked_Maps is
use Exception_Identification.From_Here;
type Long_Boolean is new Boolean;
for Long_Boolean'Size use Long_Integer'Size;
function expect (exp, c : Long_Boolean) return Long_Boolean
with Import,
Convention => Intrinsic, External_Name => "__builtin_expect";
-- implementation of alternative conversions functions
function To_Character (Item : Wide_Wide_Character)
return Character is
begin
if Characters.Conversions.Is_Character (Item) then
return Character'Val (Wide_Wide_Character'Pos (Item));
else
raise Constraint_Error;
end if;
end To_Character;
function To_Wide_Character (Item : Wide_Wide_Character)
return Wide_Character is
begin
if Characters.Conversions.Is_Wide_Character (Item) then
return Wide_Character'Val (Wide_Wide_Character'Pos (Item));
else
raise Constraint_Error;
end if;
end To_Wide_Character;
function To_Wide_Wide_Character (Item : Character)
return Wide_Wide_Character is
begin
if Characters.Conversions.Is_Wide_Wide_Character (Item) then
return Wide_Wide_Character'Val (Character'Pos (Item));
else
raise Constraint_Error;
end if;
end To_Wide_Wide_Character;
function To_Wide_Wide_Character (Item : Wide_Character)
return Wide_Wide_Character is
begin
if Characters.Conversions.Is_Wide_Wide_Character (Item) then
return Wide_Wide_Character'Val (Wide_Character'Pos (Item));
else
raise Constraint_Error;
end if;
end To_Wide_Wide_Character;
-- sets
procedure Append (
Target : in out Character_Ranges;
Last : in out Natural;
Item : Character_Range);
procedure Append (
Target : in out Character_Ranges;
Last : in out Natural;
Item : Character_Range) is
begin
if Last >= Target'First
and then Target (Last).High >= Wide_Wide_Character'Pred (Item.Low)
then
if Item.High > Target (Last).High then
Target (Last).High := Item.High;
end if;
else
Last := Last + 1;
Target (Last) := Item;
end if;
end Append;
function Search (A : Character_Ranges; L, H : Character_Type)
return Positive;
function Search (A : Character_Ranges; L, H : Character_Type)
return Positive
is
First : Positive := A'First;
Last : Natural := A'Last;
begin
while First <= Last loop
declare
type Unsigned is mod 2 ** Integer'Size;
Middle : constant Positive :=
Integer (Unsigned (First + Last) / 2);
Middle_Item : Character_Range
renames A (Middle);
begin
if H < Middle_Item.Low then
Last := Middle - 1;
elsif expect (Long_Boolean (L > Middle_Item.High), True) then
First := Middle + 1;
else
return Middle;
end if;
end;
end loop;
return First; -- the insertion position when not found
end Search;
-- implementation of sets
function Is_In (Element : Character_Type; Set : Character_Set_Data)
return Boolean
is
Index : constant Integer := Search (Set.Items, Element, Element);
begin
return Index <= Set.Items'Last
and then Element >= Set.Items (Index).Low
and then Element <= Set.Items (Index).High;
end Is_In;
procedure Add (
A : in out Character_Ranges;
Last : in out Natural;
L, H : Character_Type) is
begin
if Last < A'First then
Last := Last + 1;
A (Last).Low := L;
A (Last).High := H;
else
declare
Index : Positive := Search (A (A'First .. Last), L, H);
J : Positive;
New_Last : Natural;
begin
if Index > Last then
-- append to last
pragma Assert (L > A (Last).High);
if L = Wide_Wide_Character'Succ (A (Last).High) then
A (Last).High := H;
else
Last := Last + 1;
A (Last).Low := L;
A (Last).High := H;
end if;
elsif (Index = A'First
or else L > Wide_Wide_Character'Succ (A (Index - 1).High))
and then H < Wide_Wide_Character'Pred (A (Index).Low)
then
-- insert
New_Last := Last + 1;
A (A'First + 1 .. New_Last) := A (A'First .. Last);
Last := New_Last;
A (Index).Low := L;
A (Index).High := H;
else
-- back while includable
while Index > A'First
and then Wide_Wide_Character'Succ (A (Index - 1).High) >= L
loop
Index := Index - 1;
end loop;
-- front while includable
J := Index;
while J < Last
and then Wide_Wide_Character'Pred (A (J + 1).Low) <= H
loop
J := J + 1;
end loop;
-- merge
A (Index).Low := Wide_Wide_Character'Min (A (Index).Low, L);
A (Index).High := Wide_Wide_Character'Max (A (J).High, H);
-- remove merged
if J > Index then
New_Last := Last - (J - Index);
A (Index + 1 .. New_Last) := A (J + 1 .. Last);
Last := New_Last;
end if;
end if;
end;
end if;
end Add;
procedure Intersection (
Result : out Character_Ranges;
Last : out Natural;
Left, Right : Character_Ranges)
is
I : Positive := Left'First;
J : Positive := Right'First;
begin
Last := Result'First - 1;
while I <= Left'Last and then J <= Right'Last loop
if Left (I).High < Right (J).Low then
I := I + 1;
elsif Right (J).High < Left (I).Low then
J := J + 1;
else
Last := Last + 1;
Result (Last).Low :=
Wide_Wide_Character'Max (Left (I).Low, Right (J).Low);
Result (Last).High :=
Wide_Wide_Character'Min (Left (I).High, Right (J).High);
if Left (I).High < Right (J).High then
I := I + 1;
else
J := J + 1;
end if;
end if;
end loop;
end Intersection;
procedure Union (
Target : out Character_Ranges;
Last : out Natural;
Left, Right : Character_Ranges)
is
I : Positive := Left'First;
J : Positive := Right'First;
begin
Last := Target'First - 1;
loop
if J > Right'Last then
while I <= Left'Last loop
Append (Target, Last, Left (I));
I := I + 1;
end loop;
exit;
elsif I > Left'Last then
while J <= Right'Last loop
Append (Target, Last, Right (J));
J := J + 1;
end loop;
exit;
elsif Left (I).Low < Right (J).Low then
Append (Target, Last, Left (I));
I := I + 1;
else
Append (Target, Last, Right (J));
J := J + 1;
end if;
end loop;
end Union;
procedure Union (
Target : out Character_Ranges;
Last : out Natural;
Source : in out Character_Set_Array)
is
Source_Indexes : array (Source'Range) of Positive := (others => 1);
Source_Last : Natural := Source'Last;
begin
Last := Target'First - 1;
while Source_Last >= Source'First loop
declare
Min_Index : Positive;
begin
-- select the lowest range
Min_Index := Source'First;
for I in Source'First + 1 .. Source_Last loop
if Source (I).Items (Source_Indexes (I)).Low <
Source (Min_Index).Items (Source_Indexes (Min_Index)).Low
then
Min_Index := I;
end if;
end loop;
-- merge the lowest range
Append (
Target,
Last,
Source (Min_Index).Items (Source_Indexes (Min_Index)));
-- increment the index
Source_Indexes (Min_Index) := Source_Indexes (Min_Index) + 1;
if Source_Indexes (Min_Index) > Source (Min_Index).Length then
-- remove the finished source
Source (Min_Index) := Source (Source_Last);
Source_Indexes (Min_Index) := Source_Indexes (Source_Last);
Source_Last := Source_Last - 1;
end if;
end;
end loop;
end Union;
-- implementation of maps
function Value (Map : Character_Mapping_Data; Element : Character_Type)
return Character_Type
is
L : Positive := Map.From'First;
H : Natural := Map.From'Last;
begin
while L <= H loop
declare
type Unsigned is mod 2 ** Integer'Size;
M : constant Positive := Integer (Unsigned (L + H) / 2);
M_Key : constant Wide_Wide_Character := Map.From (M);
begin
if Element < M_Key then
H := M - 1;
elsif expect (Long_Boolean (Element > M_Key), True) then
L := M + 1;
else
return Map.To (M);
end if;
end;
end loop;
return Element;
end Value;
function Translate (
Source : String;
Mapping : Character_Mapping_Data)
return String
is
Result : String (
1 ..
Source'Length * Characters.Conversions.Max_Length_In_String);
Source_Last : Natural := Source'First - 1;
Result_Last : Natural := Result'First - 1;
begin
while Source_Last < Source'Last loop
declare
Source_Index : constant Positive := Source_Last + 1;
Index : constant Positive := Result_Last + 1;
Code : Wide_Wide_Character;
Is_Illegal_Sequence : Boolean;
begin
-- get single unicode character
Characters.Conversions.Get (
Source (Source_Index .. Source'Last),
Source_Last,
Code,
Is_Illegal_Sequence => Is_Illegal_Sequence);
if Is_Illegal_Sequence then
-- keep illegal sequence
Result_Last := Index + (Source_Last - Source_Index);
Result (Index .. Result_Last) :=
Source (Source_Index .. Source_Last);
else
-- map it
Code := Value (Mapping, Code);
-- put it
Characters.Conversions.Put (
Code,
Result (Index .. Result'Last),
Result_Last);
end if;
end;
end loop;
return Result (1 .. Result_Last);
end Translate;
function Translate (
Source : Wide_String;
Mapping : Character_Mapping_Data)
return Wide_String
is
Result : Wide_String (
1 ..
Source'Length * Characters.Conversions.Max_Length_In_Wide_String);
Source_Last : Natural := Source'First - 1;
Result_Last : Natural := Result'First - 1;
begin
while Source_Last < Source'Last loop
declare
Source_Index : constant Positive := Source_Last + 1;
Index : constant Positive := Result_Last + 1;
Code : Wide_Wide_Character;
Is_Illegal_Sequence : Boolean;
begin
-- get single unicode character
Characters.Conversions.Get (
Source (Source_Index .. Source'Last),
Source_Last,
Code,
Is_Illegal_Sequence => Is_Illegal_Sequence);
if Is_Illegal_Sequence then
-- keep illegal sequence
Result_Last := Index + (Source_Last - Source_Index);
Result (Index .. Result_Last) :=
Source (Source_Index .. Source_Last);
else
-- map it
Code := Value (Mapping, Code);
-- put it
Characters.Conversions.Put (
Code,
Result (Index .. Result'Last),
Result_Last);
end if;
end;
end loop;
return Result (1 .. Result_Last);
end Translate;
function Translate (
Source : Wide_Wide_String;
Mapping : Character_Mapping_Data)
return Wide_Wide_String
is
Result : Wide_Wide_String (1 .. Source'Length);
Source_Last : Natural := Source'First - 1;
Result_Last : Natural := Result'First - 1;
begin
while Source_Last < Source'Last loop
declare
Source_Index : constant Positive := Source_Last + 1;
Index : constant Positive := Result_Last + 1;
Code : Wide_Wide_Character;
Is_Illegal_Sequence : Boolean;
begin
-- get single unicode character
Characters.Conversions.Get (
Source (Source_Index .. Source'Last),
Source_Last,
Code,
Is_Illegal_Sequence => Is_Illegal_Sequence);
if Is_Illegal_Sequence then
-- keep illegal sequence
Result_Last := Index + (Source_Last - Source_Index);
Result (Index .. Result_Last) :=
Source (Source_Index .. Source_Last);
else
-- map it
Code := Value (Mapping, Code);
-- put it
Characters.Conversions.Put (
Code,
Result (Index .. Result'Last),
Result_Last);
end if;
end;
end loop;
return Result (1 .. Result_Last);
end Translate;
procedure To_Mapping (
From, To : Character_Sequence;
Out_From, Out_To : out Character_Sequence; -- should have same 'First
Out_Last : out Natural)
is
From_Length : constant Natural := From'Length;
begin
if From_Length /= To'Length then
Raise_Exception (Translation_Error'Identity);
else
pragma Assert (Out_From'First = Out_To'First);
declare
Out_First : constant Positive := Out_From'First;
begin
Out_Last := Out_First + From_Length - 1;
Out_From (Out_First .. Out_Last) := From;
Out_To (Out_First .. Out_Last) := To;
for I in reverse Out_First .. Out_Last loop
if Out_From (I) = Out_To (I) then
Out_From (I) := Out_From (Out_Last);
Out_To (I) := Out_To (Out_Last);
Out_Last := Out_Last - 1;
end if;
end loop;
Sort (
From => Out_From (Out_First .. Out_Last),
To => Out_To (Out_First .. Out_Last));
end;
end if;
end To_Mapping;
procedure Sort (From, To : in out Character_Sequence) is
pragma Assert (From'First = To'First);
begin
for I in From'First + 1 .. From'Last loop
for J in reverse From'First .. I - 1 loop
declare
Temp_F : Character_Type;
Temp_T : Character_Type;
K : constant Positive := J + 1;
begin
if From (J) = From (K) then
Raise_Exception (Translation_Error'Identity);
end if;
exit when From (J) <= From (K);
Temp_F := From (J);
Temp_T := To (J);
From (J) := From (K);
To (J) := To (K);
From (K) := Temp_F;
To (K) := Temp_T;
end;
end loop;
end loop;
end Sort;
end Ada.Strings.Naked_Maps;
| 32.904277 | 77 | 0.523459 |
dccb56cb0ccecd108251f316fc2f3432787337a2 | 8,831 | ads | Ada | llvm-gcc-4.2-2.9/gcc/ada/a-cohase.ads | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | 1 | 2016-04-09T02:58:13.000Z | 2016-04-09T02:58:13.000Z | llvm-gcc-4.2-2.9/gcc/ada/a-cohase.ads | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | llvm-gcc-4.2-2.9/gcc/ada/a-cohase.ads | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . H A S H E D _ S E T S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, 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 COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
with Ada.Containers.Hash_Tables;
with Ada.Streams;
with Ada.Finalization;
generic
type Element_Type is private;
with function Hash (Element : Element_Type) return Hash_Type;
with function Equivalent_Elements (Left, Right : Element_Type)
return Boolean;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Hashed_Sets is
pragma Preelaborate;
type Set is tagged private;
type Cursor is private;
Empty_Set : constant Set;
No_Element : constant Cursor;
function "=" (Left, Right : Set) return Boolean;
function Equivalent_Sets (Left, Right : Set) return Boolean;
function To_Set (New_Item : Element_Type) return Set;
function Capacity (Container : Set) return Count_Type;
procedure Reserve_Capacity
(Container : in out Set;
Capacity : Count_Type);
function Length (Container : Set) return Count_Type;
function Is_Empty (Container : Set) return Boolean;
procedure Clear (Container : in out Set);
function Element (Position : Cursor) return Element_Type;
procedure Replace_Element
(Container : in out Set;
Position : Cursor;
New_Item : Element_Type);
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Element : Element_Type));
procedure Move (Target : in out Set; Source : in out Set);
procedure Insert
(Container : in out Set;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean);
procedure Insert (Container : in out Set; New_Item : Element_Type);
procedure Include (Container : in out Set; New_Item : Element_Type);
procedure Replace (Container : in out Set; New_Item : Element_Type);
procedure Exclude (Container : in out Set; Item : Element_Type);
procedure Delete (Container : in out Set; Item : Element_Type);
procedure Delete (Container : in out Set; Position : in out Cursor);
procedure Union (Target : in out Set; Source : Set);
function Union (Left, Right : Set) return Set;
function "or" (Left, Right : Set) return Set renames Union;
procedure Intersection (Target : in out Set; Source : Set);
function Intersection (Left, Right : Set) return Set;
function "and" (Left, Right : Set) return Set renames Intersection;
procedure Difference (Target : in out Set; Source : Set);
function Difference (Left, Right : Set) return Set;
function "-" (Left, Right : Set) return Set renames Difference;
procedure Symmetric_Difference (Target : in out Set; Source : Set);
function Symmetric_Difference (Left, Right : Set) return Set;
function "xor" (Left, Right : Set) return Set
renames Symmetric_Difference;
function Overlap (Left, Right : Set) return Boolean;
function Is_Subset (Subset : Set; Of_Set : Set) return Boolean;
function First (Container : Set) return Cursor;
function Next (Position : Cursor) return Cursor;
procedure Next (Position : in out Cursor);
function Find
(Container : Set;
Item : Element_Type) return Cursor;
function Contains (Container : Set; Item : Element_Type) return Boolean;
function Has_Element (Position : Cursor) return Boolean;
function Equivalent_Elements (Left, Right : Cursor) return Boolean;
function Equivalent_Elements
(Left : Cursor;
Right : Element_Type) return Boolean;
function Equivalent_Elements
(Left : Element_Type;
Right : Cursor) return Boolean;
procedure Iterate
(Container : Set;
Process : not null access procedure (Position : Cursor));
generic
type Key_Type (<>) is private;
with function Key (Element : Element_Type) return Key_Type;
with function Hash (Key : Key_Type) return Hash_Type;
with function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
package Generic_Keys is
function Key (Position : Cursor) return Key_Type;
function Element (Container : Set; Key : Key_Type) return Element_Type;
procedure Replace
(Container : in out Set;
Key : Key_Type;
New_Item : Element_Type);
procedure Exclude (Container : in out Set; Key : Key_Type);
procedure Delete (Container : in out Set; Key : Key_Type);
function Find (Container : Set; Key : Key_Type) return Cursor;
function Contains (Container : Set; Key : Key_Type) return Boolean;
procedure Update_Element_Preserving_Key
(Container : in out Set;
Position : Cursor;
Process : not null access
procedure (Element : in out Element_Type));
end Generic_Keys;
private
type Node_Type;
type Node_Access is access Node_Type;
type Node_Type is
limited record
Element : Element_Type;
Next : Node_Access;
end record;
package HT_Types is new Hash_Tables.Generic_Hash_Table_Types
(Node_Type,
Node_Access);
type Set is new Ada.Finalization.Controlled with record
HT : HT_Types.Hash_Table_Type;
end record;
procedure Adjust (Container : in out Set);
procedure Finalize (Container : in out Set);
use HT_Types;
use Ada.Finalization;
use Ada.Streams;
type Set_Access is access all Set;
for Set_Access'Storage_Size use 0;
type Cursor is
record
Container : Set_Access;
Node : Node_Access;
end record;
procedure Write
(Stream : access Root_Stream_Type'Class;
Item : Cursor);
for Cursor'Write use Write;
procedure Read
(Stream : access Root_Stream_Type'Class;
Item : out Cursor);
for Cursor'Read use Read;
No_Element : constant Cursor := (Container => null, Node => null);
procedure Write
(Stream : access Root_Stream_Type'Class;
Container : Set);
for Set'Write use Write;
procedure Read
(Stream : access Root_Stream_Type'Class;
Container : out Set);
for Set'Read use Read;
Empty_Set : constant Set := (Controlled with HT => (null, 0, 0, 0));
end Ada.Containers.Hashed_Sets;
| 33.074906 | 78 | 0.59846 |
20d154a3e9bf8c559bb2d3679a823203d1ba82be | 840 | adb | Ada | src/gdb/gdb-8.3/gdb/testsuite/gdb.ada/tagged_access/p.adb | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 31 | 2018-08-01T21:25:24.000Z | 2022-02-14T07:52:34.000Z | src/gdb/gdb-8.3/gdb/testsuite/gdb.ada/tagged_access/p.adb | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 40 | 2018-12-03T19:48:52.000Z | 2021-03-10T06:34:26.000Z | src/gdb/gdb-8.3/gdb/testsuite/gdb.ada/tagged_access/p.adb | alrooney/unum-sdk | bbccb10b0cd3500feccbbef22e27ea111c3d18eb | [
"Apache-2.0"
] | 20 | 2018-11-16T21:19:22.000Z | 2021-10-18T23:08:24.000Z | -- Copyright 2014-2019 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pack;
procedure P is
C : Pack.Interactive_Command_Access := Pack.New_Command;
begin
Pack.Id (C); -- BREAK
end P;
| 36.521739 | 73 | 0.732143 |
18ad64ccd47dfeb52d2302e3d0afb5956036220d | 1,517 | adb | Ada | applet/aide/source/aide-style.adb | charlie5/aIDE | fab406dbcd9b72a4cb215ffebb05166c788d6365 | [
"MIT"
] | 3 | 2017-04-29T14:25:22.000Z | 2017-09-29T10:15:28.000Z | applet/aide/source/aide-style.adb | charlie5/aIDE | fab406dbcd9b72a4cb215ffebb05166c788d6365 | [
"MIT"
] | null | null | null | applet/aide/source/aide-style.adb | charlie5/aIDE | fab406dbcd9b72a4cb215ffebb05166c788d6365 | [
"MIT"
] | null | null | null | with
Gtk.Container,
Gtk.Style_Provider,
Gtk.Style_Context,
Gtk.Css_Provider,
Glib.Error,
Glib,
Ada.Text_IO;
package body aIDE.Style
is
use Gtk.Style_Provider,
Gtk.Style_Context,
Gtk.Css_Provider,
Ada.Text_IO,
Gtk.Container;
Provider : Gtk_Css_Provider;
procedure define
is
Error : aliased Glib.Error.GError;
begin
Provider := Gtk_Css_Provider_New;
if not Provider.Load_From_Path ("./css_accordion.css", Error'Access)
then
Put_Line ("Failed to load css_accordion.css !");
Put_Line (Glib.Error.Get_Message (Error));
return;
end if;
end define;
procedure Apply_Css_recursive (Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class;
Provider : Gtk_Style_Provider)
is
package FA is new Forall_User_Data (Gtk_Style_Provider);
begin
Get_Style_Context (Widget).Add_Provider (Provider, Glib.Guint'Last);
if Widget.all in Gtk_Container_Record'Class
then
declare
Container : constant Gtk_Container := Gtk_Container (Widget);
begin
FA.Forall (Container, Apply_Css_recursive'Unrestricted_Access, Provider);
end;
end if;
end Apply_Css_recursive;
procedure apply_CSS (Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class)
is
begin
Apply_Css_recursive (Widget, +Provider);
end apply_CSS;
end aIDE.Style;
| 22.984848 | 96 | 0.641397 |
209e2a67d8a9496a4b49749122846b0eaf503278 | 17,817 | adb | Ada | apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_shifts/conv2d_b2b/conv2d_b2b/hls_target/.autopilot/db/linebuffer_2.bind.adb | dillonhuff/Halide-HLS | e9f4c3ac7915e5a52f211ce65004ae17890515a0 | [
"MIT"
] | 1 | 2020-06-18T16:51:39.000Z | 2020-06-18T16:51:39.000Z | apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_shifts/conv2d_b2b/conv2d_b2b/hls_target/.autopilot/db/linebuffer_2.bind.adb | dillonhuff/Halide-HLS | e9f4c3ac7915e5a52f211ce65004ae17890515a0 | [
"MIT"
] | null | null | null | apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_shifts/conv2d_b2b/conv2d_b2b/hls_target/.autopilot/db/linebuffer_2.bind.adb | dillonhuff/Halide-HLS | e9f4c3ac7915e5a52f211ce65004ae17890515a0 | [
"MIT"
] | 1 | 2020-03-18T00:43:22.000Z | 2020-03-18T00:43:22.000Z | <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="14">
<syndb class_id="0" tracking_level="0" version="0">
<userIPLatency>-1</userIPLatency>
<userIPName></userIPName>
<cdfg class_id="1" tracking_level="1" version="0" object_id="_0">
<name>linebuffer_2</name>
<ret_bitwidth>0</ret_bitwidth>
<ports class_id="2" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="3" tracking_level="1" version="0" object_id="_1">
<Value class_id="4" tracking_level="0" version="0">
<Obj class_id="5" tracking_level="0" version="0">
<type>1</type>
<id>1</id>
<name>in_stream_V_value_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo class_id="6" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>in_stream.V.value.V</originalName>
<rtlName></rtlName>
<coreName>FIFO_SRL</coreName>
</Obj>
<bitwidth>32</bitwidth>
</Value>
<direction>0</direction>
<if_type>3</if_type>
<array_size>0</array_size>
<bit_vecs class_id="7" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
<item class_id_reference="3" object_id="_2">
<Value>
<Obj>
<type>1</type>
<id>2</id>
<name>out_stream_V_value_V</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName>out_stream.V.value.V</originalName>
<rtlName></rtlName>
<coreName>FIFO_SRL</coreName>
</Obj>
<bitwidth>128</bitwidth>
</Value>
<direction>1</direction>
<if_type>3</if_type>
<array_size>0</array_size>
<bit_vecs>
<count>0</count>
<item_version>0</item_version>
</bit_vecs>
</item>
</ports>
<nodes class_id="8" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="9" tracking_level="1" version="0" object_id="_3">
<Value>
<Obj>
<type>0</type>
<id>12</id>
<name></name>
<fileName>../../../lib_files/Linebuffer.h</fileName>
<fileDirectory>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_shifts/conv2d_b2b</fileDirectory>
<lineNumber>403</lineNumber>
<contextFuncName>linebuffer_2D&lt;1918, 1078, 1, 1, 1, 1, 2, 2, int&gt;</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item class_id="10" tracking_level="0" version="0">
<first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_shifts/conv2d_b2b</first>
<second class_id="11" tracking_level="0" version="0">
<count>4</count>
<item_version>0</item_version>
<item class_id="12" tracking_level="0" version="0">
<first class_id="13" tracking_level="0" version="0">
<first>../../../lib_files/Linebuffer.h</first>
<second>linebuffer&lt;1918, 1078, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, int&gt;</second>
</first>
<second>530</second>
</item>
<item>
<first>
<first>../../../lib_files/Linebuffer.h</first>
<second>linebuffer_2D&lt;1918, 1078, 1, 1, 1, 1, 2, 2, int&gt;</second>
</first>
<second>403</second>
</item>
<item>
<first>
<first>../../../lib_files/Linebuffer.h</first>
<second>linebuffer_3D&lt;1918, 1078, 1, 1, 1, 2, 2, 1, 1, int&gt;</second>
</first>
<second>492</second>
</item>
<item>
<first>
<first>../../../lib_files/Linebuffer.h</first>
<second>linebuffer_4D&lt;1918, 1078, 1, 1, 1, 1, 1, 2, 2, 1, 1, int&gt;</second>
</first>
<second>505</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>3</count>
<item_version>0</item_version>
<item>16</item>
<item>17</item>
<item>18</item>
</oprand_edges>
<opcode>call</opcode>
<m_Display>0</m_Display>
</item>
<item class_id_reference="9" object_id="_4">
<Value>
<Obj>
<type>0</type>
<id>13</id>
<name></name>
<fileName>../../../lib_files/Linebuffer.h</fileName>
<fileDirectory>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_shifts/conv2d_b2b</fileDirectory>
<lineNumber>531</lineNumber>
<contextFuncName>linebuffer&lt;1918, 1078, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, int&gt;</contextFuncName>
<inlineStackInfo>
<count>1</count>
<item_version>0</item_version>
<item>
<first>/home/dhuff/Halide-HLS/apps/hls_examples/camera_ready_synthesis/app_files/big_apps_32_shifts/conv2d_b2b</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>
<first>../../../lib_files/Linebuffer.h</first>
<second>linebuffer&lt;1918, 1078, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, int&gt;</second>
</first>
<second>531</second>
</item>
</second>
</item>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<oprand_edges>
<count>0</count>
<item_version>0</item_version>
</oprand_edges>
<opcode>ret</opcode>
<m_Display>0</m_Display>
</item>
</nodes>
<consts class_id="15" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="16" tracking_level="1" version="0" object_id="_5">
<Value>
<Obj>
<type>2</type>
<id>15</id>
<name>call_1</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<bitwidth>0</bitwidth>
</Value>
<const_type>6</const_type>
<content><constant:call.1></content>
</item>
</consts>
<blocks class_id="17" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="18" tracking_level="1" version="0" object_id="_6">
<Obj>
<type>3</type>
<id>14</id>
<name>linebuffer.2</name>
<fileName></fileName>
<fileDirectory></fileDirectory>
<lineNumber>0</lineNumber>
<contextFuncName></contextFuncName>
<inlineStackInfo>
<count>0</count>
<item_version>0</item_version>
</inlineStackInfo>
<originalName></originalName>
<rtlName></rtlName>
<coreName></coreName>
</Obj>
<node_objs>
<count>2</count>
<item_version>0</item_version>
<item>12</item>
<item>13</item>
</node_objs>
</item>
</blocks>
<edges class_id="19" tracking_level="0" version="0">
<count>3</count>
<item_version>0</item_version>
<item class_id="20" tracking_level="1" version="0" object_id="_7">
<id>16</id>
<edge_type>1</edge_type>
<source_obj>15</source_obj>
<sink_obj>12</sink_obj>
</item>
<item class_id_reference="20" object_id="_8">
<id>17</id>
<edge_type>1</edge_type>
<source_obj>1</source_obj>
<sink_obj>12</sink_obj>
</item>
<item class_id_reference="20" object_id="_9">
<id>18</id>
<edge_type>1</edge_type>
<source_obj>2</source_obj>
<sink_obj>12</sink_obj>
</item>
</edges>
</cdfg>
<cdfg_regions class_id="21" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="22" tracking_level="1" version="0" object_id="_10">
<mId>1</mId>
<mTag>linebuffer.2</mTag>
<mType>0</mType>
<sub_regions>
<count>0</count>
<item_version>0</item_version>
</sub_regions>
<basic_blocks>
<count>1</count>
<item_version>0</item_version>
<item>14</item>
</basic_blocks>
<mII>-1</mII>
<mDepth>-1</mDepth>
<mMinTripCount>-1</mMinTripCount>
<mMaxTripCount>-1</mMaxTripCount>
<mMinLatency>2071917</mMinLatency>
<mMaxLatency>-1</mMaxLatency>
<mIsDfPipe>1</mIsDfPipe>
<mDfPipe class_id="23" tracking_level="1" version="0" object_id="_11">
<port_list class_id="24" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</port_list>
<process_list class_id="25" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="26" tracking_level="1" version="0" object_id="_12">
<type>0</type>
<name>call_1_U0</name>
<ssdmobj_id>12</ssdmobj_id>
<pins class_id="27" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="28" tracking_level="1" version="0" object_id="_13">
<port class_id="29" tracking_level="1" version="0" object_id="_14">
<name>in_stream_V_value_V</name>
<dir>0</dir>
<type>0</type>
</port>
<inst class_id="30" tracking_level="1" version="0" object_id="_15">
<type>0</type>
<name>call_1_U0</name>
<ssdmobj_id>12</ssdmobj_id>
</inst>
</item>
<item class_id_reference="28" object_id="_16">
<port class_id_reference="29" object_id="_17">
<name>out_stream_V_value_V</name>
<dir>0</dir>
<type>1</type>
</port>
<inst class_id_reference="30" object_id_reference="_15"></inst>
</item>
</pins>
</item>
</process_list>
<channel_list class_id="31" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</channel_list>
<net_list class_id="32" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</net_list>
</mDfPipe>
</item>
</cdfg_regions>
<fsm class_id="33" tracking_level="1" version="0" object_id="_18">
<states class_id="34" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="35" tracking_level="1" version="0" object_id="_19">
<id>1</id>
<operations class_id="36" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="37" tracking_level="1" version="0" object_id="_20">
<id>12</id>
<stage>2</stage>
<latency>2</latency>
</item>
</operations>
</item>
<item class_id_reference="35" object_id="_21">
<id>2</id>
<operations>
<count>11</count>
<item_version>0</item_version>
<item class_id_reference="37" object_id="_22">
<id>3</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_23">
<id>4</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_24">
<id>5</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_25">
<id>6</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_26">
<id>7</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_27">
<id>8</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_28">
<id>9</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_29">
<id>10</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_30">
<id>11</id>
<stage>1</stage>
<latency>1</latency>
</item>
<item class_id_reference="37" object_id="_31">
<id>12</id>
<stage>1</stage>
<latency>2</latency>
</item>
<item class_id_reference="37" object_id="_32">
<id>13</id>
<stage>1</stage>
<latency>1</latency>
</item>
</operations>
</item>
</states>
<transitions class_id="38" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="39" tracking_level="1" version="0" object_id="_33">
<inState>1</inState>
<outState>2</outState>
<condition class_id="40" tracking_level="0" version="0">
<id>0</id>
<sop class_id="41" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="42" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</item>
</sop>
</condition>
</item>
</transitions>
</fsm>
<res class_id="-1"></res>
<node_label_latency class_id="44" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="45" tracking_level="0" version="0">
<first>12</first>
<second class_id="46" tracking_level="0" version="0">
<first>0</first>
<second>1</second>
</second>
</item>
<item>
<first>13</first>
<second>
<first>1</first>
<second>0</second>
</second>
</item>
</node_label_latency>
<bblk_ent_exit class_id="47" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="48" tracking_level="0" version="0">
<first>14</first>
<second class_id="49" tracking_level="0" version="0">
<first>0</first>
<second>1</second>
</second>
</item>
</bblk_ent_exit>
<regions class_id="50" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="51" tracking_level="1" version="0" object_id="_34">
<region_name>linebuffer.2</region_name>
<basic_blocks>
<count>1</count>
<item_version>0</item_version>
<item>14</item>
</basic_blocks>
<nodes>
<count>11</count>
<item_version>0</item_version>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
<item>13</item>
</nodes>
<anchor_node>-1</anchor_node>
<region_type>16</region_type>
<interval>0</interval>
<pipe_depth>0</pipe_depth>
</item>
</regions>
<dp_fu_nodes class_id="52" tracking_level="0" version="0">
<count>1</count>
<item_version>0</item_version>
<item class_id="53" tracking_level="0" version="0">
<first>36</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>12</item>
<item>12</item>
</second>
</item>
</dp_fu_nodes>
<dp_fu_nodes_expression class_id="55" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_expression>
<dp_fu_nodes_module>
<count>1</count>
<item_version>0</item_version>
<item class_id="56" tracking_level="0" version="0">
<first>grp_call_1_fu_36</first>
<second>
<count>2</count>
<item_version>0</item_version>
<item>12</item>
<item>12</item>
</second>
</item>
</dp_fu_nodes_module>
<dp_fu_nodes_io>
<count>0</count>
<item_version>0</item_version>
</dp_fu_nodes_io>
<return_ports>
<count>0</count>
<item_version>0</item_version>
</return_ports>
<dp_mem_port_nodes class_id="57" tracking_level="0" version="0">
<count>0</count>
<item_version>0</item_version>
</dp_mem_port_nodes>
<dp_reg_nodes>
<count>0</count>
<item_version>0</item_version>
</dp_reg_nodes>
<dp_regname_nodes>
<count>0</count>
<item_version>0</item_version>
</dp_regname_nodes>
<dp_reg_phi>
<count>0</count>
<item_version>0</item_version>
</dp_reg_phi>
<dp_regname_phi>
<count>0</count>
<item_version>0</item_version>
</dp_regname_phi>
<dp_port_io_nodes class_id="58" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="59" tracking_level="0" version="0">
<first>in_stream_V_value_V</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>call</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
</second>
</item>
<item>
<first>out_stream_V_value_V</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>
<first>call</first>
<second>
<count>1</count>
<item_version>0</item_version>
<item>12</item>
</second>
</item>
</second>
</item>
</dp_port_io_nodes>
<port2core class_id="60" tracking_level="0" version="0">
<count>2</count>
<item_version>0</item_version>
<item class_id="61" tracking_level="0" version="0">
<first>1</first>
<second>FIFO_SRL</second>
</item>
<item>
<first>2</first>
<second>FIFO_SRL</second>
</item>
</port2core>
<node2core>
<count>0</count>
<item_version>0</item_version>
</node2core>
</syndb>
</boost_serialization>
| 29.645591 | 140 | 0.610148 |
d0b161570334dc136fb0bfed01421ee9b46961bc | 14,566 | adb | Ada | awa/regtests/awa-events-services-tests.adb | fuzzysloth/ada-awa | f9b921eeea29841667a028f2fc4528e4385d247a | [
"Apache-2.0"
] | null | null | null | awa/regtests/awa-events-services-tests.adb | fuzzysloth/ada-awa | f9b921eeea29841667a028f2fc4528e4385d247a | [
"Apache-2.0"
] | null | null | null | awa/regtests/awa-events-services-tests.adb | fuzzysloth/ada-awa | f9b921eeea29841667a028f2fc4528e4385d247a | [
"Apache-2.0"
] | null | null | null | -----------------------------------------------------------------------
-- events-tests -- Unit tests for AWA events
-- Copyright (C) 2012, 2015 Stephane Carrez
-- Written by Stephane Carrez ([email protected])
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Test_Caller;
with Util.Beans.Methods;
with Util.Log.Loggers;
with Util.Measures;
with Util.Concurrent.Counters;
with EL.Beans;
with EL.Expressions;
with EL.Contexts.Default;
with ASF.Applications;
with ASF.Servlets.Faces;
with AWA.Applications;
with AWA.Applications.Configs;
with AWA.Applications.Factory;
with AWA.Events.Action_Method;
with AWA.Services.Contexts;
with AWA.Events.Queues;
with AWA.Events.Services;
package body AWA.Events.Services.Tests is
use AWA.Events.Services;
use Util.Log;
Log : constant Loggers.Logger := Loggers.Create ("AWA.Events.Tests");
package Event_Test_4 is new AWA.Events.Definition (Name => "event-test-4");
package Event_Test_1 is new AWA.Events.Definition (Name => "event-test-1");
package Event_Test_3 is new AWA.Events.Definition (Name => "event-test-3");
package Event_Test_2 is new AWA.Events.Definition (Name => "event-test-2");
package Event_Test_5 is new AWA.Events.Definition (Name => "event-test-5");
package Caller is new Util.Test_Caller (Test, "Events.Tests");
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test AWA.Events.Get_Event_Name",
Test_Get_Event_Name'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Find_Event_Index",
Test_Find_Event'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Initialize",
Test_Initialize'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Add_Action",
Test_Add_Action'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Dispatch_Synchronous",
Test_Dispatch_Synchronous'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Dispatch_Fifo",
Test_Dispatch_Fifo'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Dispatch_Persist",
Test_Dispatch_Persist'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Dispatch_Synchronous_Dyn",
Test_Dispatch_Synchronous_Dyn'Access);
Caller.Add_Test (Suite, "Test AWA.Events.Dispatch_Synchronous_Raise",
Test_Dispatch_Synchronous_Raise'Access);
end Add_Tests;
type Action_Bean is new Util.Beans.Basic.Bean
and Util.Beans.Methods.Method_Bean with record
Count : Natural := 0;
Priority : Integer := 0;
Raise_Exception : Boolean := False;
end record;
type Action_Bean_Access is access all Action_Bean'Class;
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
overriding
function Get_Value (From : in Action_Bean;
Name : in String) return Util.Beans.Objects.Object;
-- Set the value identified by the name.
-- If the name cannot be found, the method should raise the No_Value
-- exception.
overriding
procedure Set_Value (From : in out Action_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object);
overriding
function Get_Method_Bindings (From : in Action_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access;
procedure Event_Action (From : in out Action_Bean;
Event : in AWA.Events.Module_Event'Class);
function Create_Action_Bean return Util.Beans.Basic.Readonly_Bean_Access;
package Event_Action_Binding is
new AWA.Events.Action_Method.Bind (Bean => Action_Bean,
Method => Event_Action,
Name => "send");
Binding_Array : aliased constant Util.Beans.Methods.Method_Binding_Array
:= (1 => Event_Action_Binding.Proxy'Access);
-- ------------------------------
-- Get the value identified by the name.
-- If the name cannot be found, the method should return the Null object.
-- ------------------------------
overriding
function Get_Value (From : in Action_Bean;
Name : in String) return Util.Beans.Objects.Object is
pragma Unreferenced (From, Name);
begin
return Util.Beans.Objects.Null_Object;
end Get_Value;
-- ------------------------------
-- Set the value identified by the name.
-- If the name cannot be found, the method should raise the No_Value
-- exception.
-- ------------------------------
overriding
procedure Set_Value (From : in out Action_Bean;
Name : in String;
Value : in Util.Beans.Objects.Object) is
begin
if Name = "priority" then
From.Priority := Util.Beans.Objects.To_Integer (Value);
elsif Name = "raise_exception" then
From.Raise_Exception := Util.Beans.Objects.To_Boolean (Value);
end if;
end Set_Value;
overriding
function Get_Method_Bindings (From : in Action_Bean)
return Util.Beans.Methods.Method_Binding_Array_Access is
pragma Unreferenced (From);
begin
return Binding_Array'Access;
end Get_Method_Bindings;
Action_Exception : exception;
Global_Counter : Util.Concurrent.Counters.Counter;
procedure Event_Action (From : in out Action_Bean;
Event : in AWA.Events.Module_Event'Class) is
pragma Unreferenced (Event);
begin
if From.Raise_Exception then
raise Action_Exception with "Raising an exception from the event action bean";
end if;
From.Count := From.Count + 1;
Util.Concurrent.Counters.Increment (Global_Counter);
end Event_Action;
function Create_Action_Bean return Util.Beans.Basic.Readonly_Bean_Access is
Result : constant Action_Bean_Access := new Action_Bean;
begin
return Result.all'Access;
end Create_Action_Bean;
-- ------------------------------
-- Test searching an event name in the definition list.
-- ------------------------------
procedure Test_Find_Event (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, Integer (Event_Test_4.Kind),
Integer (Find_Event_Index ("event-test-4")), "Find_Event");
Util.Tests.Assert_Equals (T, Integer (Event_Test_5.Kind),
Integer (Find_Event_Index ("event-test-5")), "Find_Event");
Util.Tests.Assert_Equals (T, Integer (Event_Test_1.Kind),
Integer (Find_Event_Index ("event-test-1")), "Find_Event");
end Test_Find_Event;
-- ------------------------------
-- Test the Get_Event_Type_Name internal operation.
-- ------------------------------
procedure Test_Get_Event_Name (T : in out Test) is
begin
Util.Tests.Assert_Equals (T, "event-test-1", Get_Event_Type_Name (Event_Test_1.Kind).all,
"Get_Event_Type_Name");
Util.Tests.Assert_Equals (T, "event-test-2", Get_Event_Type_Name (Event_Test_2.Kind).all,
"Get_Event_Type_Name");
Util.Tests.Assert_Equals (T, "event-test-3", Get_Event_Type_Name (Event_Test_3.Kind).all,
"Get_Event_Type_Name");
Util.Tests.Assert_Equals (T, "event-test-4", Get_Event_Type_Name (Event_Test_4.Kind).all,
"Get_Event_Type_Name");
Util.Tests.Assert_Equals (T, "event-test-5", Get_Event_Type_Name (Event_Test_5.Kind).all,
"Get_Event_Type_Name");
end Test_Get_Event_Name;
-- ------------------------------
-- Test creation and initialization of event manager.
-- ------------------------------
procedure Test_Initialize (T : in out Test) is
App : constant AWA.Applications.Application_Access := AWA.Tests.Get_Application;
Manager : Event_Manager;
begin
Manager.Initialize (App.all'Access);
T.Assert (Manager.Actions /= null, "Initialization failed");
end Test_Initialize;
-- ------------------------------
-- Test adding an action.
-- ------------------------------
procedure Test_Add_Action (T : in out Test) is
App : constant AWA.Applications.Application_Access := AWA.Tests.Get_Application;
Manager : Event_Manager;
Ctx : EL.Contexts.Default.Default_Context;
Action : constant EL.Expressions.Method_Expression
:= EL.Expressions.Create_Expression ("#{a.send}", Ctx);
Props : EL.Beans.Param_Vectors.Vector;
Queue : Queue_Ref;
Index : constant Event_Index := Find_Event_Index ("event-test-4");
begin
Manager.Initialize (App.all'Access);
Queue := AWA.Events.Queues.Create_Queue ("test", "fifo", Props, Ctx);
Manager.Add_Queue (Queue);
for I in 1 .. 10 loop
Manager.Add_Action (Event => "event-test-4",
Queue => Queue,
Action => Action,
Params => Props);
Util.Tests.Assert_Equals (T, 1, Integer (Manager.Actions (Index).Queues.Length),
"Add_Action failed");
end loop;
end Test_Add_Action;
-- ------------------------------
-- Test dispatching events
-- ------------------------------
procedure Dispatch_Event (T : in out Test;
Kind : in Event_Index;
Expect_Count : in Natural;
Expect_Prio : in Natural) is
Factory : AWA.Applications.Factory.Application_Factory;
Conf : ASF.Applications.Config;
Ctx : aliased EL.Contexts.Default.Default_Context;
Path : constant String := Util.Tests.Get_Test_Path ("regtests/config/event-test.xml");
Action : aliased Action_Bean;
begin
Conf.Set ("database", Util.Tests.Get_Parameter ("database"));
declare
App : aliased AWA.Tests.Test_Application;
S : Util.Measures.Stamp;
Faces : aliased ASF.Servlets.Faces.Faces_Servlet;
SC : AWA.Services.Contexts.Service_Context;
begin
App.Initialize (Conf => Conf,
Factory => Factory);
App.Set_Global ("event_test",
Util.Beans.Objects.To_Object (Action'Unchecked_Access,
Util.Beans.Objects.STATIC));
SC.Set_Context (App'Unchecked_Access, null);
App.Add_Servlet (Name => "faces", Server => Faces'Unchecked_Access);
App.Register_Class ("AWA.Events.Tests.Event_Action",
Create_Action_Bean'Access);
AWA.Applications.Configs.Read_Configuration (App => App,
File => Path,
Context => Ctx'Unchecked_Access,
Override_Context => True);
Util.Measures.Report (S, "Initialize AWA application and read config");
App.Start;
Util.Measures.Report (S, "Start event tasks");
for I in 1 .. 100 loop
declare
Event : Module_Event;
begin
Event.Set_Event_Kind (Kind);
Event.Set_Parameter ("prio", "3");
Event.Set_Parameter ("template", "def");
App.Send_Event (Event);
end;
end loop;
Util.Measures.Report (S, "Send 100 events");
-- Wait for the dispatcher to process the events but do not wait more than 10 secs.
for I in 1 .. 10_000 loop
exit when Action.Count = Expect_Count;
delay 0.1;
end loop;
end;
Log.Info ("Action count: {0}", Natural'Image (Action.Count));
Log.Info ("Priority: {0}", Integer'Image (Action.Priority));
Util.Tests.Assert_Equals (T, Expect_Count, Action.Count,
"invalid number of calls for the action (global bean)");
Util.Tests.Assert_Equals (T, Expect_Prio, Action.Priority,
"prio parameter not transmitted (global bean)");
end Dispatch_Event;
-- ------------------------------
-- Test dispatching synchronous event to a global bean.
-- ------------------------------
procedure Test_Dispatch_Synchronous (T : in out Test) is
begin
T.Dispatch_Event (Event_Test_1.Kind, 500, 3);
end Test_Dispatch_Synchronous;
-- ------------------------------
-- Test dispatching event through a fifo queue.
-- ------------------------------
procedure Test_Dispatch_Fifo (T : in out Test) is
begin
T.Dispatch_Event (Event_Test_2.Kind, 200, 3);
end Test_Dispatch_Fifo;
-- ------------------------------
-- Test dispatching event through a database queue.
-- ------------------------------
procedure Test_Dispatch_Persist (T : in out Test) is
begin
T.Dispatch_Event (Event_Test_5.Kind, 100, 3);
end Test_Dispatch_Persist;
-- ------------------------------
-- Test dispatching synchronous event to a dynamic bean (created on demand).
-- ------------------------------
procedure Test_Dispatch_Synchronous_Dyn (T : in out Test) is
begin
T.Dispatch_Event (Event_Test_3.Kind, 0, 0);
end Test_Dispatch_Synchronous_Dyn;
-- ------------------------------
-- Test dispatching synchronous event to a dynamic bean and raise an exception in the action.
-- ------------------------------
procedure Test_Dispatch_Synchronous_Raise (T : in out Test) is
begin
T.Dispatch_Event (Event_Test_4.Kind, 0, 0);
end Test_Dispatch_Synchronous_Raise;
end AWA.Events.Services.Tests;
| 41.030986 | 97 | 0.588562 |
20711b6f55203eff0daa16e4256f97036da9c224 | 4,770 | ads | Ada | source/nodes/program-nodes-qualified_expressions.ads | reznikmm/gela | 20134f1d154fb763812e73860c6f4b04f353df79 | [
"MIT"
] | null | null | null | source/nodes/program-nodes-qualified_expressions.ads | reznikmm/gela | 20134f1d154fb763812e73860c6f4b04f353df79 | [
"MIT"
] | null | null | null | source/nodes/program-nodes-qualified_expressions.ads | reznikmm/gela | 20134f1d154fb763812e73860c6f4b04f353df79 | [
"MIT"
] | 1 | 2019-10-16T09:05:27.000Z | 2019-10-16T09:05:27.000Z | -- SPDX-FileCopyrightText: 2019 Max Reznik <[email protected]>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Expressions;
with Program.Lexical_Elements;
with Program.Elements.Qualified_Expressions;
with Program.Element_Visitors;
package Program.Nodes.Qualified_Expressions is
pragma Preelaborate;
type Qualified_Expression is
new Program.Nodes.Node
and Program.Elements.Qualified_Expressions.Qualified_Expression
and Program.Elements.Qualified_Expressions.Qualified_Expression_Text
with private;
function Create
(Subtype_Mark : not null Program.Elements.Expressions
.Expression_Access;
Apostrophe_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Operand : not null Program.Elements.Expressions
.Expression_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Qualified_Expression;
type Implicit_Qualified_Expression is
new Program.Nodes.Node
and Program.Elements.Qualified_Expressions.Qualified_Expression
with private;
function Create
(Subtype_Mark : not null Program.Elements.Expressions
.Expression_Access;
Operand : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Qualified_Expression
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Qualified_Expression is
abstract new Program.Nodes.Node
and Program.Elements.Qualified_Expressions.Qualified_Expression
with record
Subtype_Mark : not null Program.Elements.Expressions.Expression_Access;
Operand : not null Program.Elements.Expressions.Expression_Access;
end record;
procedure Initialize (Self : in out Base_Qualified_Expression'Class);
overriding procedure Visit
(Self : not null access Base_Qualified_Expression;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Subtype_Mark
(Self : Base_Qualified_Expression)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Operand
(Self : Base_Qualified_Expression)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Is_Qualified_Expression
(Self : Base_Qualified_Expression)
return Boolean;
overriding function Is_Expression
(Self : Base_Qualified_Expression)
return Boolean;
type Qualified_Expression is
new Base_Qualified_Expression
and Program.Elements.Qualified_Expressions.Qualified_Expression_Text
with record
Apostrophe_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Left_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Right_Bracket_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Qualified_Expression_Text
(Self : in out Qualified_Expression)
return Program.Elements.Qualified_Expressions
.Qualified_Expression_Text_Access;
overriding function Apostrophe_Token
(Self : Qualified_Expression)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Left_Bracket_Token
(Self : Qualified_Expression)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Right_Bracket_Token
(Self : Qualified_Expression)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Qualified_Expression is
new Base_Qualified_Expression
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Qualified_Expression_Text
(Self : in out Implicit_Qualified_Expression)
return Program.Elements.Qualified_Expressions
.Qualified_Expression_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Qualified_Expression)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Qualified_Expression)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Qualified_Expression)
return Boolean;
end Program.Nodes.Qualified_Expressions;
| 34.817518 | 79 | 0.74109 |
203ce2fed104f68eab9cb002a3d2ed24ebc9c122 | 4,109 | adb | Ada | source/numerics/i386/sse2/a-nudsge.adb | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 33 | 2015-04-04T09:19:36.000Z | 2021-11-10T05:33:34.000Z | source/numerics/i386/sse2/a-nudsge.adb | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 8 | 2017-11-14T13:05:07.000Z | 2018-08-09T15:28:49.000Z | source/numerics/i386/sse2/a-nudsge.adb | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 9 | 2015-02-03T17:09:53.000Z | 2021-11-12T01:16:05.000Z | with Ada.Unchecked_Conversion;
package body Ada.Numerics.dSFMT.Generating is
-- SSE2 version
use type Interfaces.Unsigned_64;
type v2df is array (0 .. 1) of Long_Float;
for v2df'Alignment use 16;
pragma Machine_Attribute (v2df, "vector_type");
pragma Machine_Attribute (v2df, "may_alias");
pragma Suppress_Initialization (v2df);
function mm_add_pd (a, b : v2df) return v2df
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_addpd";
function mm_sub_pd (a, b : v2df) return v2df
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_subpd";
type v4si is array (0 .. 3) of Unsigned_32;
for v4si'Alignment use 16;
pragma Machine_Attribute (v4si, "vector_type");
pragma Machine_Attribute (v4si, "may_alias");
pragma Suppress_Initialization (v4si);
function mm_shuffle_epi32 (a : v4si; b : Integer) return v4si
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_pshufd";
type v2di is array (0 .. 1) of Unsigned_64;
for v2di'Alignment use 16;
pragma Machine_Attribute (v2di, "vector_type");
pragma Machine_Attribute (v2di, "may_alias");
pragma Suppress_Initialization (v2di);
function mm_and_si128 (a, b : v2di) return v2di
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_pand128";
function mm_or_si128 (a, b : v2di) return v2di
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_por128";
function mm_xor_si128 (a, b : v2di) return v2di
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_pxor128";
function mm_slli_epi64 (a : v2di; b : Integer) return v2di
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_psllqi128";
function mm_srli_epi64 (a : v2di; b : Integer) return v2di
with Import,
Convention => Intrinsic, External_Name => "__builtin_ia32_psrlqi128";
function To_v2df is new Unchecked_Conversion (v2di, v2df);
function To_v2df is new Unchecked_Conversion (w128_t, v2df);
function To_v2di is new Unchecked_Conversion (v4si, v2di);
function To_v2di is new Unchecked_Conversion (w128_t, v2di);
function To_w128_t is new Unchecked_Conversion (v2df, w128_t);
function To_w128_t is new Unchecked_Conversion (v2di, w128_t);
SSE2_SHUFF : constant := 16#1b#;
-- 1 in 64bit for sse2
sse2_int_one : constant v2di := (1, 1);
-- 2.0 double for sse2
sse2_double_two : constant v2df := (2.0, 2.0);
-- -1.0 double for sse2
sse2_double_m_one : constant v2df := (-1.0, -1.0);
-- implementation
procedure do_recursion (
r : aliased out w128_t;
a, b : aliased w128_t;
lung : aliased in out w128_t)
is
type v4si_Access is access all v4si;
type w128_t_Access is access all w128_t;
function To_v4si is
new Unchecked_Conversion (w128_t_Access, v4si_Access);
-- mask data for sse2
sse2_param_mask : constant v2di := (MSK1, MSK2);
v, w, x, y, z : v2di;
begin
x := To_v2di (a);
z := mm_slli_epi64 (x, SL1);
y := To_v2di (mm_shuffle_epi32 (To_v4si (lung'Access).all, SSE2_SHUFF));
z := mm_xor_si128 (z, To_v2di (b));
y := mm_xor_si128 (y, z);
v := mm_srli_epi64 (y, SR);
w := mm_and_si128 (y, sse2_param_mask);
v := mm_xor_si128 (v, x);
v := mm_xor_si128 (v, w);
r := To_w128_t (v);
lung := To_w128_t (y);
end do_recursion;
procedure convert_c0o1 (w : aliased in out w128_t) is
begin
w := To_w128_t (mm_add_pd (To_v2df (w), sse2_double_m_one));
end convert_c0o1;
procedure convert_o0c1 (w : aliased in out w128_t) is
begin
w := To_w128_t (mm_sub_pd (sse2_double_two, To_v2df (w)));
end convert_o0c1;
procedure convert_o0o1 (w : aliased in out w128_t) is
begin
w := To_w128_t (
mm_add_pd (
To_v2df (mm_or_si128 (To_v2di (w), sse2_int_one)),
sse2_double_m_one));
end convert_o0o1;
end Ada.Numerics.dSFMT.Generating;
| 35.730435 | 78 | 0.668046 |
0e7f3b753e059ac202289a9a28d34c1d694dcedd | 13,006 | adb | Ada | source/league/matreshka-cldr-collation_data.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/league/matreshka-cldr-collation_data.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/league/matreshka-cldr-collation_data.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
package body Matreshka.CLDR.Collation_Data is
use type Matreshka.Internals.Unicode.Ucd.Collation_Weight;
procedure Free is
new Ada.Unchecked_Deallocation
(Collation_Record, Collation_Record_Access);
procedure Free is
new Ada.Unchecked_Deallocation
(Collation_Element_Array, Collation_Element_Array_Access);
function Lookup
(Data : Collation_Information;
Item : Code_Point_Array) return Collation_Record_Access;
procedure Attach
(Data : in out Collation_Information;
After : Collation_Record_Access;
Item : Collation_Record_Access);
-- Attach given collation record into the list of relative position of
-- collation records immidiately after specified collation record.
procedure Detach
(Data : in out Collation_Information;
Item : Collation_Record_Access);
-- Detach given collation record from the list of relative position of
-- collation records.
procedure Recompute_Trinary (Current_Record : Collation_Record_Access);
-- Resolves conflict at trinary level.
------------
-- Attach --
------------
procedure Attach
(Data : in out Collation_Information;
After : Collation_Record_Access;
Item : Collation_Record_Access) is
begin
if Data.Greater_Record = After then
Data.Greater_Record := Item;
end if;
Item.Greater_Or_Equal := After.Greater_Or_Equal;
Item.Less_Or_Equal := After;
if After.Greater_Or_Equal /= null then
After.Greater_Or_Equal.Less_Or_Equal := Item;
end if;
After.Greater_Or_Equal := Item;
end Attach;
------------
-- Detach --
------------
procedure Detach
(Data : in out Collation_Information;
Item : Collation_Record_Access) is
begin
-- Remove all other collation records.
if Data.Lower_Record = Item then
Data.Lower_Record := Item.Greater_Or_Equal;
end if;
if Data.Greater_Record = Item then
Data.Greater_Record := Item.Less_Or_Equal;
end if;
if Item.Less_Or_Equal /= null then
Item.Less_Or_Equal.Greater_Or_Equal := Item.Greater_Or_Equal;
end if;
if Item.Greater_Or_Equal /= null then
Item.Greater_Or_Equal.Less_Or_Equal := Item.Less_Or_Equal;
end if;
Item.Less_Or_Equal := null;
Item.Greater_Or_Equal := null;
end Detach;
------------
-- Lookup --
------------
function Lookup
(Data : Collation_Information;
Item : Code_Point_Array) return Collation_Record_Access
is
Current : Collation_Record_Access := Data.Collations (Item (Item'First));
begin
while Current /= null loop
exit when Current.Contractors.all = Item;
Current := Current.Next;
end loop;
return Current;
end Lookup;
-----------------------
-- Recompute_Trinary --
-----------------------
procedure Recompute_Trinary (Current_Record : Collation_Record_Access) is
Next_Record : constant Collation_Record_Access
:= Current_Record.Greater_Or_Equal;
begin
Current_Record.Collations (1).Trinary :=
Current_Record.Collations (1).Trinary + 1;
if Next_Record.Collations (1).Primary
= Current_Record.Collations (1).Primary
and Next_Record.Collations (1).Secondary
= Current_Record.Collations (1).Secondary
and Next_Record.Collations (1).Trinary
<= Current_Record.Collations (1).Trinary
then
raise Program_Error;
end if;
end Recompute_Trinary;
-------------
-- Reorder --
-------------
procedure Reorder
(Data : in out Collation_Information;
Reset_Code : Matreshka.Internals.Unicode.Code_Point;
Operator : Collation_Operator;
Relation_Code : Matreshka.Internals.Unicode.Code_Point)
is
Reset_Record : constant Collation_Record_Access
:= Lookup (Data, (1 => Reset_Code));
Relation_Record : constant Collation_Record_Access
:= Lookup (Data, (1 => Relation_Code));
Next_Record : Collation_Record_Access;
begin
-- Detach relation collation record.
Detach (Data, Relation_Record);
-- Constructs collation elements.
Free (Relation_Record.Collations);
Relation_Record.Collations :=
new Collation_Element_Array'(Reset_Record.Collations.all);
if Relation_Record.Collations'Length /= 1 then
raise Program_Error;
end if;
case Operator is
when Identically =>
raise Program_Error;
when Primary =>
Relation_Record.Collations (1).Primary :=
Relation_Record.Collations (1).Primary + 1;
Relation_Record.Collations (1).Secondary := 16#0020#;
Relation_Record.Collations (1).Trinary := 16#0002#;
-- Skip all elements with primary weight equal to reset position.
Next_Record := Reset_Record.Greater_Or_Equal;
while Next_Record.Collations (1).Primary
= Reset_Record.Collations (1).Primary
loop
Next_Record := Next_Record.Greater_Or_Equal;
end loop;
-- And insert new collation record before it.
Attach (Data, Next_Record.Less_Or_Equal, Relation_Record);
if Next_Record.Collations (1).Primary
<= Relation_Record.Collations (1).Primary
then
-- Reordering of the following records are not supported (and
-- generally not need to be supported due to construction of
-- initial data).
raise Program_Error;
end if;
when Secondary =>
Relation_Record.Collations (1).Secondary :=
Relation_Record.Collations (1).Secondary + 1;
Next_Record := Reset_Record.Greater_Or_Equal;
-- Skip all elements with primary and secondary weights equal to
-- reset positon.
while Next_Record.Collations (1).Primary
= Reset_Record.Collations (1).Primary
and Next_Record.Collations (1).Secondary
= Reset_Record.Collations (1).Secondary
loop
Next_Record := Next_Record.Greater_Or_Equal;
end loop;
-- And insert new collation record before it.
Attach (Data, Next_Record.Less_Or_Equal, Relation_Record);
if Next_Record.Collations (1).Primary
= Relation_Record.Collations (1).Primary
and Next_Record.Collations (1).Secondary
<= Relation_Record.Collations (1).Secondary
then
raise Program_Error;
end if;
when Trinary =>
Relation_Record.Collations (1).Trinary :=
Relation_Record.Collations (1).Trinary + 1;
Next_Record := Reset_Record.Greater_Or_Equal;
-- Skip all elements with primary, secondary and trinary weights
-- equal to reset positon.
while Next_Record.Collations (1).Primary
= Reset_Record.Collations (1).Primary
and Next_Record.Collations (1).Secondary
= Reset_Record.Collations (1).Secondary
and Next_Record.Collations (1).Trinary
= Reset_Record.Collations (1).Trinary
loop
Next_Record := Next_Record.Greater_Or_Equal;
end loop;
-- And insert new collation record before it.
Attach (Data, Next_Record.Less_Or_Equal, Relation_Record);
if Next_Record.Collations (1).Primary
= Relation_Record.Collations (1).Primary
and Next_Record.Collations (1).Secondary
= Relation_Record.Collations (1).Secondary
and Next_Record.Collations (1).Trinary
<= Relation_Record.Collations (1).Trinary
then
Recompute_Trinary (Next_Record);
end if;
end case;
end Reorder;
---------------------------
-- Suppress_Contractions --
---------------------------
procedure Suppress_Contractions
(Data : in out Collation_Information;
Code : Matreshka.Internals.Unicode.Code_Point)
is
Current : Collation_Record_Access;
Next : Collation_Record_Access;
begin
Current := Data.Collations (Code);
while Current /= null loop
Next := Current.Next;
if Current.Contractors'Length = 1 then
-- Only one collation record can be provides for single code
-- point by construction. Left this collation record.
Data.Collations (Code) := Current;
Current.Next := null;
else
-- Remove all other collation records.
if Data.Lower_Record = Current then
Data.Lower_Record := Current.Greater_Or_Equal;
end if;
if Data.Greater_Record = Current then
Data.Greater_Record := Current.Less_Or_Equal;
end if;
if Current.Less_Or_Equal /= null then
Current.Less_Or_Equal.Greater_Or_Equal :=
Current.Greater_Or_Equal;
end if;
if Current.Greater_Or_Equal /= null then
Current.Greater_Or_Equal.Less_Or_Equal := Current.Less_Or_Equal;
end if;
Free (Current);
end if;
Current := Next;
end loop;
end Suppress_Contractions;
end Matreshka.CLDR.Collation_Data;
| 36.63662 | 79 | 0.555436 |
df26f9bfb782e047d207c7583ed623d87cf8e334 | 5,813 | adb | Ada | source/web/servlet/http/servlet-http_requests.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/web/servlet/http/servlet-http_requests.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/web/servlet/http/servlet-http_requests.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015-2018, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Containers;
package body Servlet.HTTP_Requests is
use type League.Strings.Universal_String;
-----------------------
-- Change_Session_Id --
-----------------------
procedure Change_Session_Id (Self : HTTP_Servlet_Request'Class) is
Aux : constant League.Strings.Universal_String := Self.Change_Session_Id;
pragma Unreferenced (Aux);
begin
null;
end Change_Session_Id;
----------------------
-- Get_Context_Path --
----------------------
function Get_Context_Path
(Self : HTTP_Servlet_Request'Class) return League.Strings.Universal_String
is
Aux : constant League.String_Vectors.Universal_String_Vector
:= Self.Get_Context_Path;
begin
if Aux.Is_Empty then
return League.Strings.Empty_Universal_String;
else
return '/' & Aux.Join ('/');
end if;
end Get_Context_Path;
-------------------
-- Get_Parameter --
-------------------
function Get_Parameter
(Self : HTTP_Servlet_Request'Class;
Name : League.Strings.Universal_String)
return Servlet.HTTP_Parameters.HTTP_Parameter
is
use type Ada.Containers.Count_Type;
Parameters :
constant Servlet.HTTP_Parameter_Vectors.HTTP_Parameter_Vector
:= Self.Get_Parameter_Values (Name);
begin
if Parameters.Length /= 0 then
return Parameters.Element (1);
else
return X : Servlet.HTTP_Parameters.HTTP_Parameter;
end if;
end Get_Parameter;
-------------------
-- Get_Path_Info --
-------------------
function Get_Path_Info
(Self : HTTP_Servlet_Request'Class) return League.Strings.Universal_String
is
Aux : constant League.String_Vectors.Universal_String_Vector
:= Self.Get_Path_Info;
begin
if Aux.Is_Empty then
return League.Strings.Empty_Universal_String;
else
return '/' & Aux.Join ('/');
end if;
end Get_Path_Info;
----------------------
-- Get_Servlet_Path --
----------------------
function Get_Servlet_Path
(Self : HTTP_Servlet_Request'Class) return League.Strings.Universal_String
is
Aux : constant League.String_Vectors.Universal_String_Vector
:= Self.Get_Servlet_Path;
begin
if Aux.Is_Empty then
return League.Strings.Empty_Universal_String;
else
return '/' & Aux.Join ('/');
end if;
end Get_Servlet_Path;
end Servlet.HTTP_Requests;
| 40.368056 | 79 | 0.483571 |
4a29891de9319d5d3fc0caaacce2e0247554a254 | 2,704 | ads | Ada | resources/scripts/api/urlscan.ads | marcostolosa/Amass | 7a48ddae82eeac76fd6447de908f6b27002eace7 | [
"Apache-2.0"
] | 7,053 | 2018-07-13T09:40:12.000Z | 2022-03-31T15:26:10.000Z | resources/scripts/api/urlscan.ads | marcostolosa/Amass | 7a48ddae82eeac76fd6447de908f6b27002eace7 | [
"Apache-2.0"
] | 624 | 2018-07-17T12:01:23.000Z | 2022-03-28T13:59:17.000Z | resources/scripts/api/urlscan.ads | marcostolosa/Amass | 7a48ddae82eeac76fd6447de908f6b27002eace7 | [
"Apache-2.0"
] | 1,470 | 2018-07-17T06:01:21.000Z | 2022-03-31T18:02:17.000Z | -- 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 = "URLScan"
type = "api"
function start()
set_rate_limit(5)
end
function vertical(ctx, domain)
local url = "https://urlscan.io/api/v1/search/?q=domain:" .. domain
local resp, err = request(ctx, {['url']=url})
if (err ~= nil and err ~= "") then
log(ctx, "vertical request to service failed: " .. err)
return
end
local d = json.decode(resp)
if (d == nil or d.total == nil or d.results == nil or #(d.results) == 0) then
return
end
if d.total > 0 then
for _, r in pairs(d.results) do
subs(ctx, r['_id'])
end
return
end
subs(ctx, submission(ctx, domain))
end
function subs(ctx, id)
if id == "" then
return
end
local url = "https://urlscan.io/api/v1/result/" .. id .. "/"
local resp, err = request(ctx, {['url']=url})
if (err ~= nil and err ~= "") then
log(ctx, "result request to service failed: " .. err)
return
end
local d = json.decode(resp)
if (d == nil or d.lists == nil or
d.lists.linkDomains == nil or #(d.lists.linkDomains) == 0) then
return
end
for _, sub in pairs(d.lists.linkDomains) do
new_name(ctx, sub)
end
end
function submission(ctx, domain)
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 headers = {
['Content-Type']="application/json",
['API-Key']=c.key,
}
local resp, body, err
body, err = json.encode({
['url']=domain,
public="on",
customagent="OWASP Amass",
})
if (err ~= nil and err ~= "") then
return ""
end
resp, err = request(ctx, {
['method']="POST",
['data']=body,
['url']="https://urlscan.io/api/v1/scan/",
['headers']=headers,
})
if (err ~= nil and err ~= "") then
log(ctx, "scan request to service failed: " .. err)
return ""
end
local d = json.decode(resp)
if (d == nil or d.message ~= "Submission successful" or #(d.results) == 0) then
return ""
end
-- Keep this data source active while waiting for the scan to complete
while(true) do
_, err = request(ctx, {['url']=d.api})
if (err == nil or err ~= "404 Not Found") then
break
end
-- A large pause between these requests
for _=1,3 do check_rate_limit() end
end
return d.uuid
end
| 23.929204 | 97 | 0.553254 |
dfb293c34bb0d3087e95c53a34501a33291ac443 | 996 | adb | Ada | gdb/testsuite/gdb.ada/watch_arg/watch.adb | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | 1 | 2020-10-14T03:24:35.000Z | 2020-10-14T03:24:35.000Z | gdb/testsuite/gdb.ada/watch_arg/watch.adb | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | null | null | null | gdb/testsuite/gdb.ada/watch_arg/watch.adb | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | null | null | null | -- Copyright 2006-2021 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Watch is
procedure Foo (X : in out Integer) is
begin
-- Reference X in a way that does not change its value.
Do_Nothing (X'Address); -- BREAK1
end Foo;
X : Integer := 1;
begin
Foo (X);
X := 2; -- BREAK2
end Watch;
| 30.181818 | 73 | 0.696787 |
20db334d1e017881a9fb70198c8ced59dff77f60 | 4,630 | ads | Ada | src/ada/src/uxas-comms-lmcp_object_message_receiver_pipes.ads | pat-rogers/OpenUxAS | 2a58d63435d78203ea659198718a5c6c983a1a83 | [
"NASA-1.3"
] | null | null | null | src/ada/src/uxas-comms-lmcp_object_message_receiver_pipes.ads | pat-rogers/OpenUxAS | 2a58d63435d78203ea659198718a5c6c983a1a83 | [
"NASA-1.3"
] | null | null | null | src/ada/src/uxas-comms-lmcp_object_message_receiver_pipes.ads | pat-rogers/OpenUxAS | 2a58d63435d78203ea659198718a5c6c983a1a83 | [
"NASA-1.3"
] | null | null | null | -- see OpenUxAS\src\Communications\LmcpObjectMessageReceiverPipe.h
with AVTAS.LMCP.Object;
with UxAS.Comms.Data.LMCP_Messages;
with UxAS.Comms.Data.Addressed.Attributed;
with UxAS.Comms.Transport.Receiver.ZeroMQ.Addr_Attr_Msg_Receivers;
use AVTAS.LMCP.Object;
use UxAS.Comms.Data.LMCP_Messages;
use UxAS.Comms.Data.Addressed.Attributed;
use UxAS.Comms.Transport.Receiver.ZeroMQ.Addr_Attr_Msg_Receivers;
package UxAS.Comms.LMCP_Object_Message_Receiver_Pipes is
type LMCP_Object_Message_Receiver_Pipe is tagged limited private;
-- void
-- initializePull(uint32_t entityId, uint32_t serviceId);
procedure Initialize_Pull
(This : in out LMCP_Object_Message_Receiver_Pipe;
Entity_Id : UInt32;
Service_Id : UInt32);
-- void
-- initializeExternalSubscription(uint32_t entityId, uint32_t serviceId, const std::string& externalSocketAddress, bool isServer);
procedure Initialize_External_Subscription
(This : in out LMCP_Object_Message_Receiver_Pipe;
Entity_Id : UInt32;
Service_Id : UInt32;
External_Socket_Address : String;
Is_Server : Boolean);
-- void
-- initializeExternalPull(uint32_t entityId, uint32_t serviceId, const std::string& externalSocketAddress, bool isServer);
procedure Initialize_External_Pull
(This : in out LMCP_Object_Message_Receiver_Pipe;
Entity_Id : UInt32;
Service_Id : UInt32;
External_Socket_Address : String;
Is_Server : Boolean);
-- void
-- initializeSubscription(uint32_t entityId, uint32_t serviceId);
procedure Initialize_Subscription
(This : in out LMCP_Object_Message_Receiver_Pipe;
Entity_Id : UInt32;
Service_Id : UInt32);
-- void
-- initializeStream(uint32_t entityId, uint32_t serviceId, const std::string& socketAddress, bool isServer);
procedure Initialize_Stream
(This : in out LMCP_Object_Message_Receiver_Pipe;
Entity_Id : UInt32;
Service_Id : UInt32;
Socket_Address : String;
Is_Server : Boolean);
-- bool
-- addLmcpObjectSubscriptionAddress(const std::string& address);
procedure Add_Lmcp_Object_Subscription_Address
(This : in out LMCP_Object_Message_Receiver_Pipe;
Address : String;
Result : out Boolean);
-- bool
-- removeLmcpObjectSubscriptionAddress(const std::string& address);
procedure Remove_Lmcp_Object_Subscription_Address
(This : in out LMCP_Object_Message_Receiver_Pipe;
Address : String;
Result : out Boolean);
-- bool
-- removeAllLmcpObjectSubscriptionAddresses();
procedure Remove_All_Lmcp_Object_Subscription_Address
(This : in out LMCP_Object_Message_Receiver_Pipe;
Result : out Boolean);
-- std::unique_ptr<uxas::communications::data::LmcpMessage>
-- getNextMessageObject();
procedure Get_Next_Message_Object
(This : in out LMCP_Object_Message_Receiver_Pipe;
Message : out Any_Lmcp_Message);
-- std::unique_ptr<uxas::communications::data::AddressedAttributedMessage>
-- getNextSerializedMessage();
procedure Get_Next_Serialized_Message
(This : in out LMCP_Object_Message_Receiver_Pipe;
Message : out Addressed_Attributed_Message_Ref);
-- std::unique_ptr<avtas::lmcp::Object>
-- deserializeMessage(const std::string& payload);
procedure Deserialize_Message
(This : in out LMCP_Object_Message_Receiver_Pipe;
Payload : String;
Message : out not null AVTAS.LMCP.Object.Object_Any);
-- These attributes are public in the C++ version so we provide getters
-- (since that seems to be the need) rather than define the full ADT as a
-- public tagged record type with the4se two components visible, combined
-- with a component of a private type containing the private/protected
-- members
--
-- uint32_t m_entityId;
-- uint32_t m_serviceId;
function Entity_Id (This : LMCP_Object_Message_Receiver_Pipe) return UInt32;
function Service_Id (This : LMCP_Object_Message_Receiver_Pipe) return UInt32;
private
type LMCP_Object_Message_Receiver_Pipe is tagged limited record
Entity_Id : UInt32;
Service_Id : UInt32;
-- std::unique_ptr<uxas::communications::transport::ZeroMqAddressedAttributedMessageReceiver> m_transportReceiver;
Receiver : ZeroMq_Addressed_Attributed_Message_Receiver_Ref;
end record;
end UxAS.Comms.LMCP_Object_Message_Receiver_Pipes;
| 39.237288 | 134 | 0.712743 |
23ccc9c18e3bf84d286a98a320ad023efc1927d7 | 16,291 | ads | Ada | source/amf/uml/amf-internals-uml_opaque_expressions.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 24 | 2016-11-29T06:59:41.000Z | 2021-08-30T11:55:16.000Z | source/amf/uml/amf-internals-uml_opaque_expressions.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/amf/uml/amf-internals-uml_opaque_expressions.ads | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 4 | 2017-07-18T07:11:05.000Z | 2020-06-21T03:02:25.000Z | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2011-2012, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with AMF.Internals.UML_Packageable_Elements;
with AMF.String_Collections;
with AMF.UML.Behaviors;
with AMF.UML.Dependencies.Collections;
with AMF.UML.Named_Elements;
with AMF.UML.Namespaces;
with AMF.UML.Opaque_Expressions;
with AMF.UML.Packages.Collections;
with AMF.UML.Parameterable_Elements;
with AMF.UML.Parameters;
with AMF.UML.String_Expressions;
with AMF.UML.Template_Parameters;
with AMF.UML.Types;
with AMF.Visitors;
package AMF.Internals.UML_Opaque_Expressions is
type UML_Opaque_Expression_Proxy is
limited new AMF.Internals.UML_Packageable_Elements.UML_Packageable_Element_Proxy
and AMF.UML.Opaque_Expressions.UML_Opaque_Expression with null record;
overriding function Get_Behavior
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.UML.Behaviors.UML_Behavior_Access;
-- Getter of OpaqueExpression::behavior.
--
-- Specifies the behavior of the opaque expression.
overriding procedure Set_Behavior
(Self : not null access UML_Opaque_Expression_Proxy;
To : AMF.UML.Behaviors.UML_Behavior_Access);
-- Setter of OpaqueExpression::behavior.
--
-- Specifies the behavior of the opaque expression.
overriding function Get_Body
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.String_Collections.Sequence_Of_String;
-- Getter of OpaqueExpression::body.
--
-- The text of the expression, possibly in multiple languages.
overriding function Get_Language
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.String_Collections.Ordered_Set_Of_String;
-- Getter of OpaqueExpression::language.
--
-- Specifies the languages in which the expression is stated. The
-- interpretation of the expression body depends on the languages. If the
-- languages are unspecified, they might be implicit from the expression
-- body or the context. Languages are matched to body strings by order.
overriding function Get_Result
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.UML.Parameters.UML_Parameter_Access;
-- Getter of OpaqueExpression::result.
--
-- Restricts an opaque expression to return exactly one return result.
-- When the invocation of the opaque expression completes, a single set of
-- values is returned to its owner. This association is derived from the
-- single return result parameter of the associated behavior.
overriding function Get_Type
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.UML.Types.UML_Type_Access;
-- Getter of TypedElement::type.
--
-- The type of the TypedElement.
-- This information is derived from the return result for this Operation.
overriding procedure Set_Type
(Self : not null access UML_Opaque_Expression_Proxy;
To : AMF.UML.Types.UML_Type_Access);
-- Setter of TypedElement::type.
--
-- The type of the TypedElement.
-- This information is derived from the return result for this Operation.
overriding function Get_Client_Dependency
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency;
-- Getter of NamedElement::clientDependency.
--
-- Indicates the dependencies that reference the client.
overriding function Get_Name_Expression
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.UML.String_Expressions.UML_String_Expression_Access;
-- Getter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding procedure Set_Name_Expression
(Self : not null access UML_Opaque_Expression_Proxy;
To : AMF.UML.String_Expressions.UML_String_Expression_Access);
-- Setter of NamedElement::nameExpression.
--
-- The string expression used to define the name of this named element.
overriding function Get_Namespace
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Getter of NamedElement::namespace.
--
-- Specifies the namespace that owns the NamedElement.
overriding function Get_Qualified_Name
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.Optional_String;
-- Getter of NamedElement::qualifiedName.
--
-- A name which allows the NamedElement to be identified within a
-- hierarchy of nested Namespaces. It is constructed from the names of the
-- containing namespaces starting at the root of the hierarchy and ending
-- with the name of the NamedElement itself.
overriding function Get_Owning_Template_Parameter
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding procedure Set_Owning_Template_Parameter
(Self : not null access UML_Opaque_Expression_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::owningTemplateParameter.
--
-- The formal template parameter that owns this element.
overriding function Get_Template_Parameter
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.UML.Template_Parameters.UML_Template_Parameter_Access;
-- Getter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding procedure Set_Template_Parameter
(Self : not null access UML_Opaque_Expression_Proxy;
To : AMF.UML.Template_Parameters.UML_Template_Parameter_Access);
-- Setter of ParameterableElement::templateParameter.
--
-- The template parameter that exposes this element as a formal parameter.
overriding function Is_Integral
(Self : not null access constant UML_Opaque_Expression_Proxy)
return Boolean;
-- Operation OpaqueExpression::isIntegral.
--
-- The query isIntegral() tells whether an expression is intended to
-- produce an integer.
overriding function Is_Non_Negative
(Self : not null access constant UML_Opaque_Expression_Proxy)
return Boolean;
-- Operation OpaqueExpression::isNonNegative.
--
-- The query isNonNegative() tells whether an integer expression has a
-- non-negative value.
overriding function Is_Positive
(Self : not null access constant UML_Opaque_Expression_Proxy)
return Boolean;
-- Operation OpaqueExpression::isPositive.
--
-- The query isPositive() tells whether an integer expression has a
-- positive value.
overriding function Result
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.UML.Parameters.UML_Parameter_Access;
-- Operation OpaqueExpression::result.
--
-- Missing derivation for OpaqueExpression::/result : Parameter
overriding function Value
(Self : not null access constant UML_Opaque_Expression_Proxy)
return Integer;
-- Operation OpaqueExpression::value.
--
-- The query value() gives an integer value for an expression intended to
-- produce one.
overriding function Boolean_Value
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.Optional_Boolean;
-- Operation ValueSpecification::booleanValue.
--
-- The query booleanValue() gives a single Boolean value when one can be
-- computed.
overriding function Integer_Value
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.Optional_Integer;
-- Operation ValueSpecification::integerValue.
--
-- The query integerValue() gives a single Integer value when one can be
-- computed.
overriding function Is_Compatible_With
(Self : not null access constant UML_Opaque_Expression_Proxy;
P : AMF.UML.Parameterable_Elements.UML_Parameterable_Element_Access)
return Boolean;
-- Operation ValueSpecification::isCompatibleWith.
--
-- The query isCompatibleWith() determines if this parameterable element
-- is compatible with the specified parameterable element. By default
-- parameterable element P is compatible with parameterable element Q if
-- the kind of P is the same or a subtype as the kind of Q. In addition,
-- for ValueSpecification, the type must be conformant with the type of
-- the specified parameterable element.
overriding function Is_Computable
(Self : not null access constant UML_Opaque_Expression_Proxy)
return Boolean;
-- Operation ValueSpecification::isComputable.
--
-- The query isComputable() determines whether a value specification can
-- be computed in a model. This operation cannot be fully defined in OCL.
-- A conforming implementation is expected to deliver true for this
-- operation for all value specifications that it can compute, and to
-- compute all of those for which the operation is true. A conforming
-- implementation is expected to be able to compute the value of all
-- literals.
overriding function Is_Null
(Self : not null access constant UML_Opaque_Expression_Proxy)
return Boolean;
-- Operation ValueSpecification::isNull.
--
-- The query isNull() returns true when it can be computed that the value
-- is null.
overriding function Real_Value
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.Optional_Real;
-- Operation ValueSpecification::realValue.
--
-- The query realValue() gives a single Real value when one can be
-- computed.
overriding function String_Value
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.Optional_String;
-- Operation ValueSpecification::stringValue.
--
-- The query stringValue() gives a single String value when one can be
-- computed.
overriding function Unlimited_Value
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.Optional_Unlimited_Natural;
-- Operation ValueSpecification::unlimitedValue.
--
-- The query unlimitedValue() gives a single UnlimitedNatural value when
-- one can be computed.
overriding function All_Owning_Packages
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.UML.Packages.Collections.Set_Of_UML_Package;
-- Operation NamedElement::allOwningPackages.
--
-- The query allOwningPackages() returns all the directly or indirectly
-- owning packages.
overriding function Is_Distinguishable_From
(Self : not null access constant UML_Opaque_Expression_Proxy;
N : AMF.UML.Named_Elements.UML_Named_Element_Access;
Ns : AMF.UML.Namespaces.UML_Namespace_Access)
return Boolean;
-- Operation NamedElement::isDistinguishableFrom.
--
-- The query isDistinguishableFrom() determines whether two NamedElements
-- may logically co-exist within a Namespace. By default, two named
-- elements are distinguishable if (a) they have unrelated types or (b)
-- they have related types but different names.
overriding function Namespace
(Self : not null access constant UML_Opaque_Expression_Proxy)
return AMF.UML.Namespaces.UML_Namespace_Access;
-- Operation NamedElement::namespace.
--
-- Missing derivation for NamedElement::/namespace : Namespace
overriding function Is_Template_Parameter
(Self : not null access constant UML_Opaque_Expression_Proxy)
return Boolean;
-- Operation ParameterableElement::isTemplateParameter.
--
-- The query isTemplateParameter() determines if this parameterable
-- element is exposed as a formal template parameter.
overriding procedure Enter_Element
(Self : not null access constant UML_Opaque_Expression_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Leave_Element
(Self : not null access constant UML_Opaque_Expression_Proxy;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of visitor interface.
overriding procedure Visit_Element
(Self : not null access constant UML_Opaque_Expression_Proxy;
Iterator : in out AMF.Visitors.Abstract_Iterator'Class;
Visitor : in out AMF.Visitors.Abstract_Visitor'Class;
Control : in out AMF.Visitors.Traverse_Control);
-- Dispatch call to corresponding subprogram of iterator interface.
end AMF.Internals.UML_Opaque_Expressions;
| 45.761236 | 85 | 0.674606 |
dfd3147994e7c10af387d0de296c008fdc639db9 | 20,599 | adb | Ada | repositories.adb | annexi-strayline/AURA | fbbc4bc963ee82872a67e088b68f0565ba5b50a7 | [
"BSD-3-Clause"
] | 13 | 2021-09-28T18:14:32.000Z | 2022-02-09T17:48:53.000Z | repositories.adb | annexi-strayline/AURA | fbbc4bc963ee82872a67e088b68f0565ba5b50a7 | [
"BSD-3-Clause"
] | 9 | 2021-09-28T19:18:25.000Z | 2022-01-14T22:54:06.000Z | repositories.adb | annexi-strayline/AURA | fbbc4bc963ee82872a67e088b68f0565ba5b50a7 | [
"BSD-3-Clause"
] | 1 | 2021-10-21T21:19:08.000Z | 2021-10-21T21:19:08.000Z | ------------------------------------------------------------------------------
-- --
-- Ada User Repository Annex (AURA) --
-- Reference Implementation --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * Richard Wai (ANNEXI-STRAYLINE) --
-- --
-- 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 copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Assertions;
with Ada.Strings.Wide_Wide_Fixed;
with Ada.Streams;
with Ada.Directories;
with Ada.Containers.Ordered_Sets;
with Workers, Workers.Reporting;
with Unit_Names;
with Registrar.Source_Files;
with Registrar.Library_Units;
with Registrar.Subsystems;
with Registrar.Queries;
package body Repositories is
use type Ada.Containers.Count_Type;
use type Unit_Names.Unit_Name;
package Reg_Qs renames Registrar.Queries;
procedure Assert (Check : in Boolean; Message: in String)
renames Ada.Assertions.Assert;
function Expected_Unit_Name (Index: Repository_Index)
return Unit_Names.Unit_Name
is (Unit_Names.Set_Name
("aura.repository_"
& Ada.Strings.Wide_Wide_Fixed.Trim
(Source => Repository_Index'Wide_Wide_Image (Index),
Side => Ada.Strings.Both)));
-- Returns the unit name expected for a given repository index
New_Line: Character renames Workers.Reporting.New_Line;
Assertion_Error: exception renames Ada.Assertions.Assertion_Error;
--
-- Root_Repository (Repository_1) Definition
--
Repository_1: constant Repository
:= (Format => Local,
Location => UBS.To_Unbounded_String ("./"),
Snapshot => UBS.Null_Unbounded_String,
Cache_State => Available,
Cache_Path => UBs.To_Unbounded_String ("./"));
Root_Repository_Actual: Repository renames Repository_1;
--
-- All_Repositories
--
protected All_Repositories is
function Total return Repository_Count;
function Extract (Index: Repository_Index)
return Repository;
function Extract_All return Repository_Vectors.Vector;
procedure Add (New_Repo : in Repository;
New_Index: out Repository_Index);
procedure Update (Index : in Repository_Index;
Updated: in Repository);
procedure Update_Cache_State (Index : in Repository_Index;
New_State: in Repository_Cache_State);
procedure Request_Cache (Index: in Repository_Index);
procedure Clear;
private
Repo_Vec: Repository_Vectors.Vector;
end All_Repositories;
protected body All_Repositories is
-----------
-- Total --
-----------
function Total return Repository_Count is
(Repository_Count (Repo_Vec.Length));
-------------
-- Extract --
-------------
function Extract (Index: Repository_Index) return Repository is
(Repo_Vec(Index));
-----------------
-- Extract_All --
-----------------
function Extract_All return Repository_Vectors.Vector is
(Repo_Vec);
---------
-- Add --
---------
procedure Add (New_Repo : in Repository;
New_Index: out Repository_Index)
is begin
Repo_Vec.Append (New_Repo);
New_Index := Repository_Index (Repo_Vec.Length);
end Add;
-------------
-- Replace --
-------------
procedure Update (Index : in Repository_Index;
Updated: in Repository)
is begin
Repo_Vec (Index) := Updated;
end Update;
------------------------
-- Update_Cache_State --
------------------------
procedure Update_Cache_State (Index : in Repository_Index;
New_State: in Repository_Cache_State)
is begin
Repo_Vec (Index).Cache_State := New_State;
end Update_Cache_State;
-------------------
-- Request_Cache --
-------------------
procedure Request_Cache (Index: in Repository_Index) is
begin
if Repo_Vec (Index).Cache_State = Standby then
Repo_Vec (Index).Cache_State := Requested;
end if;
end Request_Cache;
-----------
-- Clear --
-----------
procedure Clear is
begin
Repo_Vec.Clear;
end Clear;
end All_Repositories;
--
-- Generation and Parsing Operations
--
procedure Validate_AURA_Spec
(Stream: not null access Ada.Streams.Root_Stream_Type'Class)
is separate;
-- Verifies the correct format of the AURA package, as well as
-- checking that the Repository_Format type matches the definition
-- within this build.
--
-- An exception, typically Assertion_Error is raised if this validation
-- fails.
procedure Generate_AURA_Spec is separate;
-- Generates a new AURA spec in the current directory, and then
-- submits it to the Registrar
procedure Parse_Repo_Spec
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Expected_Name: in Unit_Names.Unit_Name;
Repo : out Repository)
is separate;
-- Validates and extracts the data from a repository Ada spec.
-- The parsed Repository is not added to All_Repositories to allow
-- some additional checks in the case of the "default" Root repository
procedure Generate_Repo_Spec (Index: Repository_Index) is separate;
-- See specification (private part)
procedure Load_Repository
(Repo_Spec : in Registrar.Library_Units.Library_Unit;
Expected_Index: in Repository_Index);
-- Verifies and loads the specified Repository, and then appends it to
-- All_Repositories.
--
-- This is not done in parallel for a few reasons:
-- 1. Normally, one does not expect a large number of repos.
-- 2. Repo specs do not take much to parse.
-- 3. If done in parallel, the repositories must still be entered to
-- All_Repositories sequentially, anyways. This induces overhead.
-- Considering points 1 + 2, that overhead would likely nullify any
-- gains in most cases. If a project has hundreds of repositories,
-- it might be better for the user to do some house-keeping.
--
-- Work Orders
--
type Init_AURA_Spec_Order is new Workers.Work_Order with null record;
overriding procedure Execute (Order: in out Init_AURA_Spec_Order);
overriding function Image (Order: Init_AURA_Spec_Order) return String;
-- Ensures the root "aura" package is present and correct, generating if it
-- necessary
type Sort_Repositories_Order is new Workers.Work_Order with null record;
overriding procedure Execute (Order: in out Sort_Repositories_Order);
overriding function Image (Order: Sort_Repositories_Order) return String;
-- Sorts the repository units previously entered to the Registrar, and
-- ensures there are no gaps. This job also verifies or generates the
-- Root Repository. All other repositories are dispatched as
-- Load_Repository_Order's.
--------------------------
-- Init_AURA_Spec_Order --
--------------------------
function Image (Order: Init_AURA_Spec_Order) return String is
("[Init_AURA_Spec_Order] (Repositories)");
procedure Execute (Order: in out Init_AURA_Spec_Order) is
use Registrar.Library_Units;
use Registrar.Source_Files;
use Unit_Names;
AURA_Unit_Name: Unit_Name := Set_Name ("AURA");
AURA_Spec_Unit: Library_Unit;
begin
-- Check for the expected root "AURA" package
if Reg_Qs.Unit_Entered (AURA_Unit_Name) then
AURA_Spec_Unit := Reg_Qs.Lookup_Unit (AURA_Unit_Name);
Assert (Check => AURA_Spec_Unit.Spec_File /= null,
Message => "AURA package has no specification.");
Assert (Check => AURA_Spec_Unit.Body_File = null,
Message => "AURA package shall not have a body.");
declare
AURA_Spec_Stream: aliased Source_Stream
:= Checkout_Read_Stream (AURA_Spec_Unit.Spec_File);
begin
Validate_AURA_Spec (AURA_Spec_Stream'Access);
-- Will raise the appropriately messaged exception if the
-- validation fails
end;
else
Generate_AURA_Spec;
end if;
-- If that worked-out, submit an order for the next step - to
-- sort and load all the repository packages
Initialize_Repositories_Tracker.Increase_Total_Items_By (1);
Workers.Enqueue_Order
(Sort_Repositories_Order
'(Tracker => Initialize_Repositories_Tracker'Access,
others => <>));
end Execute;
-----------------------------
-- Sort_Repositories_Order --
-----------------------------
function Image (Order: Sort_Repositories_Order) return String is
("[Sort_Repositories_Order] (Repositories)");
procedure Execute (Order: in out Sort_Repositories_Order) is
use Registrar.Subsystems;
use Registrar.Library_Units;
use type Registrar.Source_Files.Source_File_Access;
function Less_Than (Left, Right: Library_Unit) return Boolean
is (Left.Name < Right.Name);
package Unit_Sorting is new Ada.Containers.Ordered_Sets
(Element_Type => Library_Unit,
"<" => Less_Than);
AURA_SS: constant Subsystem
:= (AURA => False,
Name => Unit_Names.Set_Name ("AURA"),
State => Available,
others => <>);
Sorted_List : Unit_Sorting.Set;
Unsorted_List: Library_Unit_Sets.Set
:= Reg_Qs.Subsystem_Library_Units (AURA_SS);
begin
-- We need to collect a list of all repository files (AURA.Repository_X)
-- registered during the root registration process, and then sort that
-- list before parsing each one in order. The first spec (Root Repo) is
-- special, must be either validated, or generated
-- Sort (and filter) the unsorted list by adding each
-- aura.repository_x unit to the set, which will cause them to
-- be ordered appropriately
for Unit of Unsorted_List loop
if Unit.Name.Match_Initial ("aura.repository_") then
Assert (Check => Unit.Spec_File /= null,
Message => "Repository unit """
& Unit.Name.To_UTF8_String
& """ has no specification");
Assert (Check => Unit.Body_File = null,
Message => "Repository unit """
& Unit.Name.To_UTF8_String
& """ shall not have a body");
Sorted_List.Insert (Unit);
end if;
end loop;
-- An empty sorted list simply means that there are no repository
-- specs, and therefore we need to create the Root Repo's spec,
-- and call it a day.
if Sorted_List.Length = 0 then
declare
New_Index: Repository_Index;
begin
All_Repositories.Add (New_Repo => Root_Repository_Actual,
New_Index => New_Index);
Generate_Repo_Spec (New_Index);
return;
end;
end if;
-- There should never be any gaps in the sorted list. If Repository_1
-- (Root repository)
-- missing, we'd expect there to be no repository specs at all, and hence
-- we dealt with that condition already. If we're here now we shall, at
-- the very least have Repository_1.
declare
I: Repository_Index := Root_Repository;
begin
for Unit of Sorted_List loop
Assert (Check => Unit.Name = Expected_Unit_Name (I),
Message => "Missing repository unit for "
& "Repository" & Repository_Index'Image (I)
& " ("
& Expected_Unit_Name (I).To_UTF8_String
& ")");
I := I + 1;
end loop;
end;
-- Good to go
Initialize_Repositories_Tracker.Increase_Total_Items_By
(Natural (Sorted_List.Length));
declare
Expected_Index: Repository_Index := Root_Repository;
begin
for Unit of Sorted_List loop
Load_Repository (Repo_Spec => Unit,
Expected_Index => Expected_Index);
Expected_Index := Expected_Index + 1;
end loop;
end;
end Execute;
---------------------
-- Load_Repository --
---------------------
procedure Load_Repository
(Repo_Spec : in Registrar.Library_Units.Library_Unit;
Expected_Index: in Repository_Index)
is
use Registrar.Source_Files;
Repo_Spec_Stream: aliased Source_Stream
:= Checkout_Read_Stream (Repo_Spec.Spec_File);
New_Repo : Repository;
New_Index: Repository_Index;
begin
Parse_Repo_Spec (Stream => Repo_Spec_Stream'Access,
Expected_Name => Expected_Unit_Name (Expected_Index),
Repo => New_Repo);
if New_Repo.Format = System then
-- System repositories need to have their cache state to Requested
-- This ensures that the repo is scanned every time, so that
-- the user can be alerted. This is necessary since System repos
-- checkout subsystems via filesystem symlinks.
New_Repo.Cache_State := Requested;
elsif Expected_Index = Root_Repository then
-- The Root Repo needs to be "automatically" checked-out, and
-- compared against the expected (hard-coded) representation
New_Repo.Cache_State := Available;
New_Repo.Cache_Path := New_Repo.Location;
Assert (Check => New_Repo = Root_Repository_Actual,
Message => "The Root Repository (Repostory"
& Repository_Index'Image (Root_Repository)
& ") does not contain the correct values. "
& "Please delete and rerun aura to regenerate.");
end if;
All_Repositories.Add (New_Repo, New_Index);
pragma Assert (New_Index = Expected_Index);
Initialize_Repositories_Tracker.Increment_Completed_Items;
exception
when others =>
Initialize_Repositories_Tracker.Increment_Failed_Items;
end Load_Repository;
-----------------------------
-- Initialize_Repositories --
-----------------------------
procedure Initialize_Repositories is
begin
All_Repositories.Clear; -- Clean slate
Initialize_Repositories_Tracker.Increase_Total_Items_By (1);
Workers.Enqueue_Order
(Init_AURA_Spec_Order
'(Tracker => Initialize_Repositories_Tracker'Access,
others => <>));
-- This work order will launch the next on completion.
end Initialize_Repositories;
------------------------
-- Total_Repositories --
------------------------
function Total_Repositories return Repository_Count
is (All_Repositories.Total);
------------------------
-- Extract_Repository --
------------------------
function Extract_Repository (Index: Repository_Index)
return Repository
is (All_Repositories.Extract (Index));
-----------------
-- Extract_All --
-----------------
function Extract_All return Repository_Vectors.Vector
is (All_Repositories.Extract_All);
-----------------
-- Cache_State --
-----------------
function Cache_State (Index: Repository_Index)
return Repository_Cache_State
is
Repo: constant Repository := All_Repositories.Extract (Index);
begin
return Repo.Cache_State;
end Cache_State;
--------------------
-- Add_Repository --
--------------------
procedure Add_Repository (New_Repo : in Repository;
New_Index: out Repository_Index)
is begin
All_Repositories.Add (New_Repo, New_Index);
Generate_Repo_Spec (New_Index);
end;
-----------------------
-- Update_Repository --
-----------------------
procedure Update_Repository (Index : in Repository_Index;
Updated: in Repository)
is begin
All_Repositories.Update (Index, Updated);
Generate_Repo_Spec (Index);
end Update_Repository;
-------------------
-- Request_Cache --
-------------------
procedure Request_Cache (Index: in Repository_Index) is
begin
All_Repositories.Request_Cache (Index);
end Request_Cache;
------------------------
-- Update_Cache_State --
------------------------
procedure Update_Cache_State (Index : in Repository_Index;
New_State: in Repository_Cache_State)
is begin
All_Repositories.Update_Cache_State (Index, New_State);
end Update_Cache_State;
end Repositories;
| 36.075306 | 79 | 0.55391 |
cb3a1b3df075699ed6013b86b8e0ada34e8b9785 | 1,546 | ads | Ada | gdb/testsuite/gdb.ada/packed_array_assign/aggregates.ads | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | 1 | 2020-10-14T03:24:35.000Z | 2020-10-14T03:24:35.000Z | gdb/testsuite/gdb.ada/packed_array_assign/aggregates.ads | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | null | null | null | gdb/testsuite/gdb.ada/packed_array_assign/aggregates.ads | greyblue9/binutils-gdb | 05377632b124fe7600eea7f4ee0e9a35d1b0cbdc | [
"BSD-3-Clause"
] | null | null | null | -- Copyright 2018-2021 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Aggregates is
subtype Int is Integer range 0 .. 7;
type Packed_Rec is record
Packed_Array_Assign_W : Integer;
Packed_Array_Assign_X, Packed_Array_Assign_Y : Int;
end record;
pragma Pack (Packed_Rec);
type Packed_RecArr is array (Integer range <>) of Packed_Rec;
pragma Pack (Packed_RecArr);
type Nested_Packed is record
Q000 : Int;
R000 : Packed_Rec;
end record;
pragma Pack (Nested_Packed);
procedure Run_Test;
private
PR : Packed_Rec := (Packed_Array_Assign_Y => 3,
Packed_Array_Assign_W => 104,
Packed_Array_Assign_X => 2);
PRA : Packed_RecArr (1 .. 3);
NPR : Nested_Packed := (q000 => 3, r000 => (packed_array_assign_x => 6, packed_array_assign_y => 1, packed_array_assign_w => 117));
end Aggregates;
| 35.953488 | 134 | 0.694696 |
23d3c4020b4f1d7f100218c2d259dd9b14f3b897 | 1,262 | adb | Ada | source/s-staall.adb | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 33 | 2015-04-04T09:19:36.000Z | 2021-11-10T05:33:34.000Z | source/s-staall.adb | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 8 | 2017-11-14T13:05:07.000Z | 2018-08-09T15:28:49.000Z | source/s-staall.adb | ytomino/drake | 4e4bdcd8b8e23a11a29b31d3a8861fdf60090ea2 | [
"MIT"
] | 9 | 2015-02-03T17:09:53.000Z | 2021-11-12T01:16:05.000Z | with System.System_Allocators;
with System.Unwind.Raising;
with System.Unwind.Standard;
package body System.Standard_Allocators is
pragma Suppress (All_Checks);
function Allocate (
Size : Storage_Elements.Storage_Count)
return Address
is
Result : constant Address := System_Allocators.Allocate (Size);
begin
if Result = Null_Address then
Raise_Heap_Exhausted;
end if;
return Result;
end Allocate;
procedure Free (Storage_Address : Address) is
begin
System_Allocators.Free (Storage_Address);
end Free;
function Reallocate (
Storage_Address : Address;
Size : Storage_Elements.Storage_Count)
return Address
is
Result : constant Address :=
System_Allocators.Reallocate (Storage_Address, Size);
begin
if Result = Null_Address then
Raise_Heap_Exhausted;
end if;
return Result;
end Reallocate;
procedure Raise_Heap_Exhausted is
Heap_Exhausted : constant String := "heap exhausted"; -- (s-memory.adb)
begin
Unwind.Raising.Raise_Exception_From_Here_With (
Unwind.Standard.Storage_Error'Access,
Message => Heap_Exhausted);
end Raise_Heap_Exhausted;
end System.Standard_Allocators;
| 26.851064 | 77 | 0.698098 |
df25fbeeb910cc303e60c38095acff78795f79a2 | 5,213 | ads | Ada | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-tasinf__linux.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-tasinf__linux.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnarl/s-tasinf__linux.ads | djamal2727/Main-Bearing-Analytical-Model | 2f00c2219c71be0175c6f4f8f1d4cca231d97096 | [
"Apache-2.0"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . T A S K _ I N F O --
-- --
-- S p e c --
-- --
-- Copyright (C) 2007-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. --
-- --
------------------------------------------------------------------------------
-- This package contains the definitions and routines associated with the
-- implementation and use of the Task_Info pragma. It is specialized
-- appropriately for targets that make use of this pragma.
-- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes.
-- The functionality in this unit is now provided by the predefined package
-- System.Multiprocessors and the CPU aspect. This package is obsolescent.
-- This is the GNU/Linux version of this module
with System.OS_Interface;
package System.Task_Info is
pragma Obsolescent (Task_Info, "use System.Multiprocessors and CPU aspect");
pragma Preelaborate;
pragma Elaborate_Body;
-- To ensure that a body is allowed
-- The Linux kernel provides a way to define the ideal processor to use for
-- a given thread. The ideal processor is not necessarily the one that will
-- be used by the OS but the OS will always try to schedule this thread to
-- the specified processor if it is available.
-- The Task_Info pragma:
-- pragma Task_Info (EXPRESSION);
-- allows the specification on a task by task basis of a value of type
-- System.Task_Info.Task_Info_Type to be passed to a task when it is
-- created. The specification of this type, and the effect on the task
-- that is created is target dependent.
-- The Task_Info pragma appears within a task definition (compare the
-- definition and implementation of pragma Priority). If no such pragma
-- appears, then the value Unspecified_Task_Info is passed. If a pragma
-- is present, then it supplies an alternative value. If the argument of
-- the pragma is a discriminant reference, then the value can be set on
-- a task by task basis by supplying the appropriate discriminant value.
-- Note that this means that the type used for Task_Info_Type must be
-- suitable for use as a discriminant (i.e. a scalar or access type).
-----------------------
-- Thread Attributes --
-----------------------
subtype CPU_Set is System.OS_Interface.cpu_set_t;
Any_CPU : constant CPU_Set := (bits => (others => True));
No_CPU : constant CPU_Set := (bits => (others => False));
Invalid_CPU_Number : exception;
-- Raised when an invalid CPU mask has been specified
-- i.e. An empty CPU set
type Thread_Attributes is record
CPU_Affinity : aliased CPU_Set := Any_CPU;
end record;
Default_Thread_Attributes : constant Thread_Attributes := (others => <>);
type Task_Info_Type is access all Thread_Attributes;
Unspecified_Task_Info : constant Task_Info_Type := null;
function Number_Of_Processors return Positive;
-- Returns the number of processors on the running host
end System.Task_Info;
| 50.61165 | 79 | 0.558028 |
dfd47013e5ab1fbfba47470b0908bd855ff869e2 | 14,946 | adb | Ada | source/xml/dom/matreshka-dom_nodes.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | null | null | null | source/xml/dom/matreshka-dom_nodes.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | 2 | 2019-01-16T05:15:20.000Z | 2019-02-03T10:03:32.000Z | source/xml/dom/matreshka-dom_nodes.adb | svn2github/matreshka | 9d222b3ad9da508855fb1f5adbe5e8a4fad4c530 | [
"BSD-3-Clause"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, Vadim Godunko <[email protected]> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Text_Codecs;
with Matreshka.DOM_Documents;
with Matreshka.DOM_Lists;
package body Matreshka.DOM_Nodes is
procedure Raise_DOM_Exception
(Self : not null access Node'Class;
Diagnosis : XML.DOM.Error_Code)
with No_Return => True;
------------------
-- Append_Child --
------------------
overriding function Append_Child
(Self : not null access Node;
New_Child : not null XML.DOM.Nodes.DOM_Node_Access)
return not null XML.DOM.Nodes.DOM_Node_Access
is
N : constant Node_Access := Node_Access (New_Child);
begin
-- Remove node from its curent position in the tree.
if N.Parent /= null then
Matreshka.DOM_Lists.Remove_From_Children (N);
-- Remove node from the list of detached nodes.
else
Matreshka.DOM_Lists.Remove_From_Detached (N);
end if;
-- And append node to the requested position.
Matreshka.DOM_Lists.Insert_Into_Children (Self, N);
return New_Child;
end Append_Child;
--------------------------
-- Check_Wrong_Document --
--------------------------
procedure Check_Wrong_Document
(Self : not null access Node'Class;
Node : not null access XML.DOM.Nodes.DOM_Node'Class) is
begin
if Self.Document
/= Matreshka.DOM_Nodes.Node'Class (Node.all).Document
then
Self.Raise_Wrong_Document_Error;
end if;
end Check_Wrong_Document;
------------------
-- Constructors --
------------------
package body Constructors is
----------------
-- Initialize --
----------------
procedure Initialize
(Self : not null access Node'Class;
Document : not null Document_Access)
is
S : constant Node_Access := Node_Access (Self);
begin
-- Append element to the list of detached nodes of the document.
Self.Document := Document;
if Self /= Document then
-- All nodes except document node are added into the list of
-- detached nodes of owner document.
Matreshka.DOM_Lists.Insert_Into_Detached (S);
end if;
end Initialize;
end Constructors;
---------------------
-- Get_First_Child --
---------------------
overriding function Get_First_Child
(Self : not null access constant Node)
return XML.DOM.Nodes.DOM_Node_Access is
begin
return XML.DOM.Nodes.DOM_Node_Access (Self.First);
end Get_First_Child;
--------------------
-- Get_Last_Child --
--------------------
overriding function Get_Last_Child
(Self : not null access constant Node)
return XML.DOM.Nodes.DOM_Node_Access is
begin
return XML.DOM.Nodes.DOM_Node_Access (Self.Last);
end Get_Last_Child;
--------------------
-- Get_Local_Name --
--------------------
overriding function Get_Local_Name
(Self : not null access constant Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return League.Strings.Empty_Universal_String;
end Get_Local_Name;
-----------------------
-- Get_Namespace_URI --
-----------------------
overriding function Get_Namespace_URI
(Self : not null access constant Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return League.Strings.Empty_Universal_String;
end Get_Namespace_URI;
----------------------
-- Get_Next_Sibling --
----------------------
overriding function Get_Next_Sibling
(Self : not null access constant Node)
return XML.DOM.Nodes.DOM_Node_Access is
begin
return XML.DOM.Nodes.DOM_Node_Access (Self.Next);
end Get_Next_Sibling;
--------------------
-- Get_Node_Value --
--------------------
overriding function Get_Node_Value
(Self : not null access constant Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return League.Strings.Empty_Universal_String;
end Get_Node_Value;
------------------------
-- Get_Owner_Document --
------------------------
overriding function Get_Owner_Document
(Self : not null access constant Node)
return XML.DOM.Documents.DOM_Document_Access is
begin
return XML.DOM.Documents.DOM_Document_Access (Self.Document);
end Get_Owner_Document;
---------------------
-- Get_Parent_Node --
---------------------
overriding function Get_Parent_Node
(Self : not null access constant Node)
return XML.DOM.Nodes.DOM_Node_Access is
begin
return XML.DOM.Nodes.DOM_Node_Access (Self.Parent);
end Get_Parent_Node;
--------------------------
-- Get_Previous_Sibling --
--------------------------
overriding function Get_Previous_Sibling
(Self : not null access constant Node)
return XML.DOM.Nodes.DOM_Node_Access is
begin
return XML.DOM.Nodes.DOM_Node_Access (Self.Previous);
end Get_Previous_Sibling;
-------------------------
-- Raise_DOM_Exception --
-------------------------
procedure Raise_DOM_Exception
(Self : not null access Node'Class;
Diagnosis : XML.DOM.Error_Code) is
begin
Self.Document.Diagnosis := Diagnosis;
raise XML.DOM.DOM_Exception
with League.Text_Codecs.To_Exception_Message
(Self.Document.Error_String);
end Raise_DOM_Exception;
--------------------------------
-- Raise_DOMString_Size_Error --
--------------------------------
procedure Raise_DOMString_Size_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.DOMString_Size_Error);
end Raise_DOMString_Size_Error;
-----------------------------------
-- Raise_Hierarchy_Request_Error --
-----------------------------------
procedure Raise_Hierarchy_Request_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Hierarchy_Request_Error);
end Raise_Hierarchy_Request_Error;
----------------------------
-- Raise_Index_Size_Error --
----------------------------
procedure Raise_Index_Size_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Index_Size_Error);
end Raise_Index_Size_Error;
---------------------------------
-- Raise_Inuse_Attribute_Error --
---------------------------------
procedure Raise_Inuse_Attribute_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Inuse_Attribute_Error);
end Raise_Inuse_Attribute_Error;
--------------------------------
-- Raise_Invalid_Access_Error --
--------------------------------
procedure Raise_Invalid_Access_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Invalid_Access_Error);
end Raise_Invalid_Access_Error;
-----------------------------------
-- Raise_Invalid_Character_Error --
-----------------------------------
procedure Raise_Invalid_Character_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Invalid_Character_Error);
end Raise_Invalid_Character_Error;
--------------------------------------
-- Raise_Invalid_Modification_Error --
--------------------------------------
procedure Raise_Invalid_Modification_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Invalid_Modification_Error);
end Raise_Invalid_Modification_Error;
-------------------------------
-- Raise_Invalid_State_Error --
-------------------------------
procedure Raise_Invalid_State_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Invalid_State_Error);
end Raise_Invalid_State_Error;
---------------------------
-- Raise_Namespace_Error --
---------------------------
procedure Raise_Namespace_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Namespace_Error);
end Raise_Namespace_Error;
---------------------------------
-- Raise_No_Data_Allowed_Error --
---------------------------------
procedure Raise_No_Data_Allowed_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.No_Data_Allowed_Error);
end Raise_No_Data_Allowed_Error;
-----------------------------------------
-- Raise_No_Modification_Allowed_Error --
-----------------------------------------
procedure Raise_No_Modification_Allowed_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.No_Modification_Allowed_Error);
end Raise_No_Modification_Allowed_Error;
---------------------------
-- Raise_Not_Found_Error --
---------------------------
procedure Raise_Not_Found_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Not_Found_Error);
end Raise_Not_Found_Error;
-------------------------------
-- Raise_Not_Supported_Error --
-------------------------------
procedure Raise_Not_Supported_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Not_Supported_Error);
end Raise_Not_Supported_Error;
------------------------
-- Raise_Syntax_Error --
------------------------
procedure Raise_Syntax_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Syntax_Error);
end Raise_Syntax_Error;
-------------------------------
-- Raise_Type_Mismatch_Error --
-------------------------------
procedure Raise_Type_Mismatch_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Type_Mismatch_Error);
end Raise_Type_Mismatch_Error;
----------------------------
-- Raise_Validation_Error --
----------------------------
procedure Raise_Validation_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Validation_Error);
end Raise_Validation_Error;
--------------------------------
-- Raise_Wrong_Document_Error --
--------------------------------
procedure Raise_Wrong_Document_Error
(Self : not null access Node'Class) is
begin
Self.Raise_DOM_Exception (XML.DOM.Wrong_Document_Error);
end Raise_Wrong_Document_Error;
------------------
-- Remove_Child --
------------------
overriding function Remove_Child
(Self : not null access Node;
Old_Child : not null XML.DOM.Nodes.DOM_Node_Access)
return not null XML.DOM.Nodes.DOM_Node_Access
is
N : constant Matreshka.DOM_Nodes.Node_Access
:= Matreshka.DOM_Nodes.Node_Access (Old_Child);
begin
if N.Parent /= Self then
Self.Raise_Not_Found_Error;
end if;
-- Remove node from its curent position in the tree and insert into the
-- list of detached nodes.
Matreshka.DOM_Lists.Remove_From_Children (N);
Matreshka.DOM_Lists.Insert_Into_Detached (N);
return Old_Child;
end Remove_Child;
--------------------
-- Set_Node_Value --
--------------------
overriding procedure Set_Node_Value
(Self : not null access Node;
New_Value : League.Strings.Universal_String)
is
pragma Unreferenced (Self);
pragma Unreferenced (New_Value);
begin
null;
end Set_Node_Value;
end Matreshka.DOM_Nodes;
| 32.004283 | 78 | 0.542219 |
cbe596962e9e12c68542cbf8390a7b0a56d3ec6d | 75,215 | adb | Ada | llvm-gcc-4.2-2.9/gcc/ada/cstand.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | 1 | 2016-04-09T02:58:13.000Z | 2016-04-09T02:58:13.000Z | llvm-gcc-4.2-2.9/gcc/ada/cstand.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | llvm-gcc-4.2-2.9/gcc/ada/cstand.adb | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- C S T A N D --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2005, 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 2, 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 COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Csets; use Csets;
with Debug; use Debug;
with Einfo; use Einfo;
with Layout; use Layout;
with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
with Output; use Output;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Ttypes; use Ttypes;
with Ttypef; use Ttypef;
with Scn;
with Sem_Mech; use Sem_Mech;
with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Uintp; use Uintp;
with Urealp; use Urealp;
package body CStand is
Stloc : constant Source_Ptr := Standard_Location;
Staloc : constant Source_Ptr := Standard_ASCII_Location;
-- Standard abbreviations used throughout this package
-----------------------
-- Local Subprograms --
-----------------------
procedure Build_Float_Type (E : Entity_Id; Siz : Int; Digs : Int);
-- Procedure to build standard predefined float base type. The first
-- parameter is the entity for the type, and the second parameter
-- is the size in bits. The third parameter is the digits value.
procedure Build_Signed_Integer_Type (E : Entity_Id; Siz : Int);
-- Procedure to build standard predefined signed integer subtype. The
-- first parameter is the entity for the subtype. The second parameter
-- is the size in bits. The corresponding base type is not built by
-- this routine but instead must be built by the caller where needed.
procedure Create_Operators;
-- Make entries for each of the predefined operators in Standard
procedure Create_Unconstrained_Base_Type
(E : Entity_Id;
K : Entity_Kind);
-- The predefined signed integer types are constrained subtypes which
-- must have a corresponding unconstrained base type. This type is almost
-- useless. The only place it has semantics is Subtypes_Statically_Match.
-- Consequently, we arrange for it to be identical apart from the setting
-- of the constrained bit. This routine takes an entity E for the Type,
-- copies it to estabish the base type, then resets the Ekind of the
-- original entity to K (the Ekind for the subtype). The Etype field of
-- E is set by the call (to point to the created base type entity), and
-- also the Is_Constrained flag of E is set.
--
-- To understand the exact requirement for this, see RM 3.5.4(11) which
-- makes it clear that Integer, for example, is constrained, with the
-- constraint bounds matching the bounds of the (unconstrained) base
-- type. The point is that Integer and Integer'Base have identical
-- bounds, but do not statically match, since a subtype with constraints
-- never matches a subtype with no constraints.
function Identifier_For (S : Standard_Entity_Type) return Node_Id;
-- Returns an identifier node with the same name as the defining
-- identifier corresponding to the given Standard_Entity_Type value
procedure Make_Component
(Rec : Entity_Id;
Typ : Entity_Id;
Nam : String);
-- Build a record component with the given type and name, and append to
-- the list of components of Rec.
function Make_Formal
(Typ : Entity_Id;
Formal_Name : String) return Entity_Id;
-- Construct entity for subprogram formal with given name and type
function Make_Integer (V : Uint) return Node_Id;
-- Builds integer literal with given value
procedure Make_Name (Id : Entity_Id; Nam : String);
-- Make an entry in the names table for Nam, and set as Chars field of Id
function New_Operator (Op : Name_Id; Typ : Entity_Id) return Entity_Id;
-- Build entity for standard operator with given name and type
function New_Standard_Entity
(New_Node_Kind : Node_Kind := N_Defining_Identifier) return Entity_Id;
-- Builds a new entity for Standard
procedure Print_Standard;
-- Print representation of package Standard if switch set
procedure Set_Integer_Bounds
(Id : Entity_Id;
Typ : Entity_Id;
Lb : Uint;
Hb : Uint);
-- Procedure to set bounds for integer type or subtype. Id is the entity
-- whose bounds and type are to be set. The Typ parameter is the Etype
-- value for the entity (which will be the same as Id for all predefined
-- integer base types. The third and fourth parameters are the bounds.
----------------------
-- Build_Float_Type --
----------------------
procedure Build_Float_Type (E : Entity_Id; Siz : Int; Digs : Int) is
begin
Set_Type_Definition (Parent (E),
Make_Floating_Point_Definition (Stloc,
Digits_Expression => Make_Integer (UI_From_Int (Digs))));
Set_Ekind (E, E_Floating_Point_Type);
Set_Etype (E, E);
Init_Size (E, Siz);
Set_Elem_Alignment (E);
Init_Digits_Value (E, Digs);
Set_Float_Bounds (E);
Set_Is_Frozen (E);
Set_Is_Public (E);
Set_Size_Known_At_Compile_Time (E);
end Build_Float_Type;
-------------------------------
-- Build_Signed_Integer_Type --
-------------------------------
procedure Build_Signed_Integer_Type (E : Entity_Id; Siz : Int) is
U2Siz1 : constant Uint := 2 ** (Siz - 1);
Lbound : constant Uint := -U2Siz1;
Ubound : constant Uint := U2Siz1 - 1;
begin
Set_Type_Definition (Parent (E),
Make_Signed_Integer_Type_Definition (Stloc,
Low_Bound => Make_Integer (Lbound),
High_Bound => Make_Integer (Ubound)));
Set_Ekind (E, E_Signed_Integer_Type);
Set_Etype (E, E);
Init_Size (E, Siz);
Set_Elem_Alignment (E);
Set_Integer_Bounds (E, E, Lbound, Ubound);
Set_Is_Frozen (E);
Set_Is_Public (E);
Set_Is_Known_Valid (E);
Set_Size_Known_At_Compile_Time (E);
end Build_Signed_Integer_Type;
----------------------
-- Create_Operators --
----------------------
-- Each operator has an abbreviated signature. The formals have the names
-- LEFT and RIGHT. Their types are not actually used for resolution.
procedure Create_Operators is
Op_Node : Entity_Id;
-- The following tables define the binary and unary operators and their
-- corresponding result type.
Binary_Ops : constant array (S_Binary_Ops) of Name_Id :=
-- There is one entry here for each binary operator, except for the
-- case of concatenation, where there are three entries, one for a
-- String result, one for Wide_String, and one for Wide_Wide_String.
(Name_Op_Add,
Name_Op_And,
Name_Op_Concat,
Name_Op_Concat,
Name_Op_Concat,
Name_Op_Divide,
Name_Op_Eq,
Name_Op_Expon,
Name_Op_Ge,
Name_Op_Gt,
Name_Op_Le,
Name_Op_Lt,
Name_Op_Mod,
Name_Op_Multiply,
Name_Op_Ne,
Name_Op_Or,
Name_Op_Rem,
Name_Op_Subtract,
Name_Op_Xor);
Bin_Op_Types : constant array (S_Binary_Ops) of Entity_Id :=
-- This table has the corresponding result types. The entries are
-- ordered so they correspond to the Binary_Ops array above.
(Universal_Integer, -- Add
Standard_Boolean, -- And
Standard_String, -- Concat (String)
Standard_Wide_String, -- Concat (Wide_String)
Standard_Wide_Wide_String, -- Concat (Wide_Wide_String)
Universal_Integer, -- Divide
Standard_Boolean, -- Eq
Universal_Integer, -- Expon
Standard_Boolean, -- Ge
Standard_Boolean, -- Gt
Standard_Boolean, -- Le
Standard_Boolean, -- Lt
Universal_Integer, -- Mod
Universal_Integer, -- Multiply
Standard_Boolean, -- Ne
Standard_Boolean, -- Or
Universal_Integer, -- Rem
Universal_Integer, -- Subtract
Standard_Boolean); -- Xor
Unary_Ops : constant array (S_Unary_Ops) of Name_Id :=
-- There is one entry here for each unary operator
(Name_Op_Abs,
Name_Op_Subtract,
Name_Op_Not,
Name_Op_Add);
Unary_Op_Types : constant array (S_Unary_Ops) of Entity_Id :=
-- This table has the corresponding result types. The entries are
-- ordered so they correspond to the Unary_Ops array above.
(Universal_Integer, -- Abs
Universal_Integer, -- Subtract
Standard_Boolean, -- Not
Universal_Integer); -- Add
begin
for J in S_Binary_Ops loop
Op_Node := New_Operator (Binary_Ops (J), Bin_Op_Types (J));
SE (J) := Op_Node;
Append_Entity (Make_Formal (Any_Type, "LEFT"), Op_Node);
Append_Entity (Make_Formal (Any_Type, "RIGHT"), Op_Node);
end loop;
for J in S_Unary_Ops loop
Op_Node := New_Operator (Unary_Ops (J), Unary_Op_Types (J));
SE (J) := Op_Node;
Append_Entity (Make_Formal (Any_Type, "RIGHT"), Op_Node);
end loop;
-- For concatenation, we create a separate operator for each
-- array type. This simplifies the resolution of the component-
-- component concatenation operation. In Standard, we set the types
-- of the formals for string, wide [wide]_string, concatenations.
Set_Etype (First_Entity (Standard_Op_Concat), Standard_String);
Set_Etype (Last_Entity (Standard_Op_Concat), Standard_String);
Set_Etype (First_Entity (Standard_Op_Concatw), Standard_Wide_String);
Set_Etype (Last_Entity (Standard_Op_Concatw), Standard_Wide_String);
Set_Etype (First_Entity (Standard_Op_Concatww),
Standard_Wide_Wide_String);
Set_Etype (Last_Entity (Standard_Op_Concatww),
Standard_Wide_Wide_String);
end Create_Operators;
---------------------
-- Create_Standard --
---------------------
-- The tree for the package Standard is prefixed to all compilations.
-- Several entities required by semantic analysis are denoted by global
-- variables that are initialized to point to the corresponding
-- occurrences in STANDARD. The visible entities of STANDARD are
-- created here. The private entities defined in STANDARD are created
-- by Initialize_Standard in the semantics module.
procedure Create_Standard is
Decl_S : constant List_Id := New_List;
-- List of declarations in Standard
Decl_A : constant List_Id := New_List;
-- List of declarations in ASCII
Decl : Node_Id;
Pspec : Node_Id;
Tdef_Node : Node_Id;
Ident_Node : Node_Id;
Ccode : Char_Code;
E_Id : Entity_Id;
R_Node : Node_Id;
B_Node : Node_Id;
procedure Build_Exception (S : Standard_Entity_Type);
-- Procedure to declare given entity as an exception
---------------------
-- Build_Exception --
---------------------
procedure Build_Exception (S : Standard_Entity_Type) is
begin
Set_Ekind (Standard_Entity (S), E_Exception);
Set_Etype (Standard_Entity (S), Standard_Exception_Type);
Set_Exception_Code (Standard_Entity (S), Uint_0);
Set_Is_Public (Standard_Entity (S), True);
Decl :=
Make_Exception_Declaration (Stloc,
Defining_Identifier => Standard_Entity (S));
Append (Decl, Decl_S);
end Build_Exception;
-- Start of processing for Create_Standard
begin
-- Initialize scanner for internal scans of literals
Scn.Initialize_Scanner (No_Unit, Internal_Source_File);
-- First step is to create defining identifiers for each entity
for S in Standard_Entity_Type loop
declare
S_Name : constant String := Standard_Entity_Type'Image (S);
-- Name of entity (note we skip S_ at the start)
Ident_Node : Node_Id;
-- Defining identifier node
begin
Ident_Node := New_Standard_Entity;
Make_Name (Ident_Node, S_Name (3 .. S_Name'Length));
Standard_Entity (S) := Ident_Node;
end;
end loop;
-- Create package declaration node for package Standard
Standard_Package_Node := New_Node (N_Package_Declaration, Stloc);
Pspec := New_Node (N_Package_Specification, Stloc);
Set_Specification (Standard_Package_Node, Pspec);
Set_Defining_Unit_Name (Pspec, Standard_Standard);
Set_Visible_Declarations (Pspec, Decl_S);
Set_Ekind (Standard_Standard, E_Package);
Set_Is_Pure (Standard_Standard);
Set_Is_Compilation_Unit (Standard_Standard);
-- Create type declaration nodes for standard types
for S in S_Types loop
Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Standard_Entity (S));
Set_Is_Frozen (Standard_Entity (S));
Set_Is_Public (Standard_Entity (S));
Append (Decl, Decl_S);
end loop;
-- Create type definition node for type Boolean. The Size is set to
-- 1 as required by Ada 95 and current ARG interpretations for Ada/83.
-- Note: Object_Size of Boolean is 8. This means that we do NOT in
-- general know that Boolean variables have valid values, so we do
-- not set the Is_Known_Valid flag.
Tdef_Node := New_Node (N_Enumeration_Type_Definition, Stloc);
Set_Literals (Tdef_Node, New_List);
Append (Standard_False, Literals (Tdef_Node));
Append (Standard_True, Literals (Tdef_Node));
Set_Type_Definition (Parent (Standard_Boolean), Tdef_Node);
Set_Ekind (Standard_Boolean, E_Enumeration_Type);
Set_First_Literal (Standard_Boolean, Standard_False);
Set_Etype (Standard_Boolean, Standard_Boolean);
Init_Esize (Standard_Boolean, Standard_Character_Size);
Init_RM_Size (Standard_Boolean, 1);
Set_Elem_Alignment (Standard_Boolean);
Set_Is_Unsigned_Type (Standard_Boolean);
Set_Size_Known_At_Compile_Time (Standard_Boolean);
Set_Ekind (Standard_True, E_Enumeration_Literal);
Set_Etype (Standard_True, Standard_Boolean);
Set_Enumeration_Pos (Standard_True, Uint_1);
Set_Enumeration_Rep (Standard_True, Uint_1);
Set_Is_Known_Valid (Standard_True, True);
Set_Ekind (Standard_False, E_Enumeration_Literal);
Set_Etype (Standard_False, Standard_Boolean);
Set_Enumeration_Pos (Standard_False, Uint_0);
Set_Enumeration_Rep (Standard_False, Uint_0);
Set_Is_Known_Valid (Standard_False, True);
-- For the bounds of Boolean, we create a range node corresponding to
-- range False .. True
-- where the occurrences of the literals must point to the
-- corresponding definition.
R_Node := New_Node (N_Range, Stloc);
B_Node := New_Node (N_Identifier, Stloc);
Set_Chars (B_Node, Chars (Standard_False));
Set_Entity (B_Node, Standard_False);
Set_Etype (B_Node, Standard_Boolean);
Set_Is_Static_Expression (B_Node);
Set_Low_Bound (R_Node, B_Node);
B_Node := New_Node (N_Identifier, Stloc);
Set_Chars (B_Node, Chars (Standard_True));
Set_Entity (B_Node, Standard_True);
Set_Etype (B_Node, Standard_Boolean);
Set_Is_Static_Expression (B_Node);
Set_High_Bound (R_Node, B_Node);
Set_Scalar_Range (Standard_Boolean, R_Node);
Set_Etype (R_Node, Standard_Boolean);
Set_Parent (R_Node, Standard_Boolean);
-- Record entity identifiers for boolean literals in the
-- Boolean_Literals array, for easy reference during expansion.
Boolean_Literals := (False => Standard_False, True => Standard_True);
-- Create type definition nodes for predefined integer types
Build_Signed_Integer_Type
(Standard_Short_Short_Integer, Standard_Short_Short_Integer_Size);
Build_Signed_Integer_Type
(Standard_Short_Integer, Standard_Short_Integer_Size);
Build_Signed_Integer_Type
(Standard_Integer, Standard_Integer_Size);
declare
LIS : Nat;
begin
if Debug_Flag_M then
LIS := 64;
else
LIS := Standard_Long_Integer_Size;
end if;
Build_Signed_Integer_Type (Standard_Long_Integer, LIS);
end;
Build_Signed_Integer_Type
(Standard_Long_Long_Integer, Standard_Long_Long_Integer_Size);
Create_Unconstrained_Base_Type
(Standard_Short_Short_Integer, E_Signed_Integer_Subtype);
Create_Unconstrained_Base_Type
(Standard_Short_Integer, E_Signed_Integer_Subtype);
Create_Unconstrained_Base_Type
(Standard_Integer, E_Signed_Integer_Subtype);
Create_Unconstrained_Base_Type
(Standard_Long_Integer, E_Signed_Integer_Subtype);
Create_Unconstrained_Base_Type
(Standard_Long_Long_Integer, E_Signed_Integer_Subtype);
-- Create type definition nodes for predefined float types
Build_Float_Type
(Standard_Short_Float,
Standard_Short_Float_Size,
Standard_Short_Float_Digits);
Build_Float_Type
(Standard_Float,
Standard_Float_Size,
Standard_Float_Digits);
Build_Float_Type
(Standard_Long_Float,
Standard_Long_Float_Size,
Standard_Long_Float_Digits);
Build_Float_Type
(Standard_Long_Long_Float,
Standard_Long_Long_Float_Size,
Standard_Long_Long_Float_Digits);
-- Create type definition node for type Character. Note that we do not
-- set the Literals field, since type Character is handled with special
-- routine that do not need a literal list.
Tdef_Node := New_Node (N_Enumeration_Type_Definition, Stloc);
Set_Type_Definition (Parent (Standard_Character), Tdef_Node);
Set_Ekind (Standard_Character, E_Enumeration_Type);
Set_Etype (Standard_Character, Standard_Character);
Init_Esize (Standard_Character, Standard_Character_Size);
Init_RM_Size (Standard_Character, 8);
Set_Elem_Alignment (Standard_Character);
Set_Is_Unsigned_Type (Standard_Character);
Set_Is_Character_Type (Standard_Character);
Set_Is_Known_Valid (Standard_Character);
Set_Size_Known_At_Compile_Time (Standard_Character);
-- Create the bounds for type Character
R_Node := New_Node (N_Range, Stloc);
-- Low bound for type Character (Standard.Nul)
B_Node := New_Node (N_Character_Literal, Stloc);
Set_Is_Static_Expression (B_Node);
Set_Chars (B_Node, No_Name);
Set_Char_Literal_Value (B_Node, Uint_0);
Set_Entity (B_Node, Empty);
Set_Etype (B_Node, Standard_Character);
Set_Low_Bound (R_Node, B_Node);
-- High bound for type Character
B_Node := New_Node (N_Character_Literal, Stloc);
Set_Is_Static_Expression (B_Node);
Set_Chars (B_Node, No_Name);
Set_Char_Literal_Value (B_Node, UI_From_Int (16#FF#));
Set_Entity (B_Node, Empty);
Set_Etype (B_Node, Standard_Character);
Set_High_Bound (R_Node, B_Node);
Set_Scalar_Range (Standard_Character, R_Node);
Set_Etype (R_Node, Standard_Character);
Set_Parent (R_Node, Standard_Character);
-- Create type definition for type Wide_Character. Note that we do not
-- set the Literals field, since type Wide_Character is handled with
-- special routines that do not need a literal list.
Tdef_Node := New_Node (N_Enumeration_Type_Definition, Stloc);
Set_Type_Definition (Parent (Standard_Wide_Character), Tdef_Node);
Set_Ekind (Standard_Wide_Character, E_Enumeration_Type);
Set_Etype (Standard_Wide_Character, Standard_Wide_Character);
Init_Size (Standard_Wide_Character, Standard_Wide_Character_Size);
Set_Elem_Alignment (Standard_Wide_Character);
Set_Is_Unsigned_Type (Standard_Wide_Character);
Set_Is_Character_Type (Standard_Wide_Character);
Set_Is_Known_Valid (Standard_Wide_Character);
Set_Size_Known_At_Compile_Time (Standard_Wide_Character);
-- Create the bounds for type Wide_Character
R_Node := New_Node (N_Range, Stloc);
-- Low bound for type Wide_Character
B_Node := New_Node (N_Character_Literal, Stloc);
Set_Is_Static_Expression (B_Node);
Set_Chars (B_Node, No_Name); -- ???
Set_Char_Literal_Value (B_Node, Uint_0);
Set_Entity (B_Node, Empty);
Set_Etype (B_Node, Standard_Wide_Character);
Set_Low_Bound (R_Node, B_Node);
-- High bound for type Wide_Character
B_Node := New_Node (N_Character_Literal, Stloc);
Set_Is_Static_Expression (B_Node);
Set_Chars (B_Node, No_Name); -- ???
Set_Char_Literal_Value (B_Node, UI_From_Int (16#FFFF#));
Set_Entity (B_Node, Empty);
Set_Etype (B_Node, Standard_Wide_Character);
Set_High_Bound (R_Node, B_Node);
Set_Scalar_Range (Standard_Wide_Character, R_Node);
Set_Etype (R_Node, Standard_Wide_Character);
Set_Parent (R_Node, Standard_Wide_Character);
-- Create type definition for type Wide_Wide_Character. Note that we
-- do not set the Literals field, since type Wide_Wide_Character is
-- handled with special routines that do not need a literal list.
Tdef_Node := New_Node (N_Enumeration_Type_Definition, Stloc);
Set_Type_Definition (Parent (Standard_Wide_Wide_Character), Tdef_Node);
Set_Ekind (Standard_Wide_Wide_Character, E_Enumeration_Type);
Set_Etype (Standard_Wide_Wide_Character,
Standard_Wide_Wide_Character);
Init_Size (Standard_Wide_Wide_Character,
Standard_Wide_Wide_Character_Size);
Set_Elem_Alignment (Standard_Wide_Wide_Character);
Set_Is_Unsigned_Type (Standard_Wide_Wide_Character);
Set_Is_Character_Type (Standard_Wide_Wide_Character);
Set_Is_Known_Valid (Standard_Wide_Wide_Character);
Set_Size_Known_At_Compile_Time (Standard_Wide_Wide_Character);
Set_Is_Ada_2005 (Standard_Wide_Wide_Character);
-- Create the bounds for type Wide_Wide_Character
R_Node := New_Node (N_Range, Stloc);
-- Low bound for type Wide_Wide_Character
B_Node := New_Node (N_Character_Literal, Stloc);
Set_Is_Static_Expression (B_Node);
Set_Chars (B_Node, No_Name); -- ???
Set_Char_Literal_Value (B_Node, Uint_0);
Set_Entity (B_Node, Empty);
Set_Etype (B_Node, Standard_Wide_Wide_Character);
Set_Low_Bound (R_Node, B_Node);
-- High bound for type Wide_Wide_Character
B_Node := New_Node (N_Character_Literal, Stloc);
Set_Is_Static_Expression (B_Node);
Set_Chars (B_Node, No_Name); -- ???
Set_Char_Literal_Value (B_Node, UI_From_Int (16#7FFF_FFFF#));
Set_Entity (B_Node, Empty);
Set_Etype (B_Node, Standard_Wide_Wide_Character);
Set_High_Bound (R_Node, B_Node);
Set_Scalar_Range (Standard_Wide_Wide_Character, R_Node);
Set_Etype (R_Node, Standard_Wide_Wide_Character);
Set_Parent (R_Node, Standard_Wide_Wide_Character);
-- Create type definition node for type String
Tdef_Node := New_Node (N_Unconstrained_Array_Definition, Stloc);
declare
CompDef_Node : Node_Id;
begin
CompDef_Node := New_Node (N_Component_Definition, Stloc);
Set_Aliased_Present (CompDef_Node, False);
Set_Access_Definition (CompDef_Node, Empty);
Set_Subtype_Indication (CompDef_Node, Identifier_For (S_Character));
Set_Component_Definition (Tdef_Node, CompDef_Node);
end;
Set_Subtype_Marks (Tdef_Node, New_List);
Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node));
Set_Type_Definition (Parent (Standard_String), Tdef_Node);
Set_Ekind (Standard_String, E_String_Type);
Set_Etype (Standard_String, Standard_String);
Set_Component_Type (Standard_String, Standard_Character);
Set_Component_Size (Standard_String, Uint_8);
Init_Size_Align (Standard_String);
Set_Alignment (Standard_String, Uint_1);
-- Set index type of String
E_Id := First
(Subtype_Marks (Type_Definition (Parent (Standard_String))));
Set_First_Index (Standard_String, E_Id);
Set_Entity (E_Id, Standard_Positive);
Set_Etype (E_Id, Standard_Positive);
-- Create type definition node for type Wide_String
Tdef_Node := New_Node (N_Unconstrained_Array_Definition, Stloc);
declare
CompDef_Node : Node_Id;
begin
CompDef_Node := New_Node (N_Component_Definition, Stloc);
Set_Aliased_Present (CompDef_Node, False);
Set_Access_Definition (CompDef_Node, Empty);
Set_Subtype_Indication (CompDef_Node,
Identifier_For (S_Wide_Character));
Set_Component_Definition (Tdef_Node, CompDef_Node);
end;
Set_Subtype_Marks (Tdef_Node, New_List);
Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node));
Set_Type_Definition (Parent (Standard_Wide_String), Tdef_Node);
Set_Ekind (Standard_Wide_String, E_String_Type);
Set_Etype (Standard_Wide_String, Standard_Wide_String);
Set_Component_Type (Standard_Wide_String, Standard_Wide_Character);
Set_Component_Size (Standard_Wide_String, Uint_16);
Init_Size_Align (Standard_Wide_String);
-- Set index type of Wide_String
E_Id := First
(Subtype_Marks (Type_Definition (Parent (Standard_Wide_String))));
Set_First_Index (Standard_Wide_String, E_Id);
Set_Entity (E_Id, Standard_Positive);
Set_Etype (E_Id, Standard_Positive);
-- Create type definition node for type Wide_Wide_String
Tdef_Node := New_Node (N_Unconstrained_Array_Definition, Stloc);
declare
CompDef_Node : Node_Id;
begin
CompDef_Node := New_Node (N_Component_Definition, Stloc);
Set_Aliased_Present (CompDef_Node, False);
Set_Access_Definition (CompDef_Node, Empty);
Set_Subtype_Indication (CompDef_Node,
Identifier_For (S_Wide_Wide_Character));
Set_Component_Definition (Tdef_Node, CompDef_Node);
end;
Set_Subtype_Marks (Tdef_Node, New_List);
Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node));
Set_Type_Definition (Parent (Standard_Wide_Wide_String), Tdef_Node);
Set_Ekind (Standard_Wide_Wide_String, E_String_Type);
Set_Etype (Standard_Wide_Wide_String,
Standard_Wide_Wide_String);
Set_Component_Type (Standard_Wide_Wide_String,
Standard_Wide_Wide_Character);
Set_Component_Size (Standard_Wide_Wide_String, Uint_32);
Init_Size_Align (Standard_Wide_Wide_String);
Set_Is_Ada_2005 (Standard_Wide_Wide_String);
-- Set index type of Wide_Wide_String
E_Id := First
(Subtype_Marks (Type_Definition (Parent (Standard_Wide_Wide_String))));
Set_First_Index (Standard_Wide_Wide_String, E_Id);
Set_Entity (E_Id, Standard_Positive);
Set_Etype (E_Id, Standard_Positive);
-- Create subtype declaration for Natural
Decl := New_Node (N_Subtype_Declaration, Stloc);
Set_Defining_Identifier (Decl, Standard_Natural);
Set_Subtype_Indication (Decl,
New_Occurrence_Of (Standard_Integer, Stloc));
Append (Decl, Decl_S);
Set_Ekind (Standard_Natural, E_Signed_Integer_Subtype);
Set_Etype (Standard_Natural, Base_Type (Standard_Integer));
Init_Esize (Standard_Natural, Standard_Integer_Size);
Init_RM_Size (Standard_Natural, Standard_Integer_Size - 1);
Set_Elem_Alignment (Standard_Natural);
Set_Size_Known_At_Compile_Time
(Standard_Natural);
Set_Integer_Bounds (Standard_Natural,
Typ => Base_Type (Standard_Integer),
Lb => Uint_0,
Hb => Intval (High_Bound (Scalar_Range (Standard_Integer))));
Set_Is_Constrained (Standard_Natural);
Set_Is_Frozen (Standard_Natural);
Set_Is_Public (Standard_Natural);
-- Create subtype declaration for Positive
Decl := New_Node (N_Subtype_Declaration, Stloc);
Set_Defining_Identifier (Decl, Standard_Positive);
Set_Subtype_Indication (Decl,
New_Occurrence_Of (Standard_Integer, Stloc));
Append (Decl, Decl_S);
Set_Ekind (Standard_Positive, E_Signed_Integer_Subtype);
Set_Etype (Standard_Positive, Base_Type (Standard_Integer));
Init_Esize (Standard_Positive, Standard_Integer_Size);
Init_RM_Size (Standard_Positive, Standard_Integer_Size - 1);
Set_Elem_Alignment (Standard_Positive);
Set_Size_Known_At_Compile_Time (Standard_Positive);
Set_Integer_Bounds (Standard_Positive,
Typ => Base_Type (Standard_Integer),
Lb => Uint_1,
Hb => Intval (High_Bound (Scalar_Range (Standard_Integer))));
Set_Is_Constrained (Standard_Positive);
Set_Is_Frozen (Standard_Positive);
Set_Is_Public (Standard_Positive);
-- Create declaration for package ASCII
Decl := New_Node (N_Package_Declaration, Stloc);
Append (Decl, Decl_S);
Pspec := New_Node (N_Package_Specification, Stloc);
Set_Specification (Decl, Pspec);
Set_Defining_Unit_Name (Pspec, Standard_Entity (S_ASCII));
Set_Ekind (Standard_Entity (S_ASCII), E_Package);
Set_Visible_Declarations (Pspec, Decl_A);
-- Create control character definitions in package ASCII. Note that
-- the character literal entries created here correspond to literal
-- values that are impossible in the source, but can be represented
-- internally with no difficulties.
Ccode := 16#00#;
for S in S_ASCII_Names loop
Decl := New_Node (N_Object_Declaration, Staloc);
Set_Constant_Present (Decl, True);
declare
A_Char : constant Entity_Id := Standard_Entity (S);
Expr_Decl : Node_Id;
begin
Set_Sloc (A_Char, Staloc);
Set_Ekind (A_Char, E_Constant);
Set_Never_Set_In_Source (A_Char, True);
Set_Is_True_Constant (A_Char, True);
Set_Etype (A_Char, Standard_Character);
Set_Scope (A_Char, Standard_Entity (S_ASCII));
Set_Is_Immediately_Visible (A_Char, False);
Set_Is_Public (A_Char, True);
Set_Is_Known_Valid (A_Char, True);
Append_Entity (A_Char, Standard_Entity (S_ASCII));
Set_Defining_Identifier (Decl, A_Char);
Set_Object_Definition (Decl, Identifier_For (S_Character));
Expr_Decl := New_Node (N_Character_Literal, Staloc);
Set_Expression (Decl, Expr_Decl);
Set_Is_Static_Expression (Expr_Decl);
Set_Chars (Expr_Decl, No_Name);
Set_Etype (Expr_Decl, Standard_Character);
Set_Char_Literal_Value (Expr_Decl, UI_From_Int (Int (Ccode)));
end;
Append (Decl, Decl_A);
-- Increment character code, dealing with non-contiguities
Ccode := Ccode + 1;
if Ccode = 16#20# then
Ccode := 16#21#;
elsif Ccode = 16#27# then
Ccode := 16#3A#;
elsif Ccode = 16#3C# then
Ccode := 16#3F#;
elsif Ccode = 16#41# then
Ccode := 16#5B#;
end if;
end loop;
-- Create semantic phase entities
Standard_Void_Type := New_Standard_Entity;
Set_Ekind (Standard_Void_Type, E_Void);
Set_Etype (Standard_Void_Type, Standard_Void_Type);
Set_Scope (Standard_Void_Type, Standard_Standard);
Make_Name (Standard_Void_Type, "_void_type");
-- The type field of packages is set to void
Set_Etype (Standard_Standard, Standard_Void_Type);
Set_Etype (Standard_ASCII, Standard_Void_Type);
-- Standard_A_String is actually used in generated code, so it has a
-- type name that is reasonable, but does not overlap any Ada name.
Standard_A_String := New_Standard_Entity;
Set_Ekind (Standard_A_String, E_Access_Type);
Set_Scope (Standard_A_String, Standard_Standard);
Set_Etype (Standard_A_String, Standard_A_String);
if Debug_Flag_6 then
Init_Size (Standard_A_String, System_Address_Size);
else
Init_Size (Standard_A_String, System_Address_Size * 2);
end if;
Init_Alignment (Standard_A_String);
Set_Directly_Designated_Type
(Standard_A_String, Standard_String);
Make_Name (Standard_A_String, "access_string");
Standard_A_Char := New_Standard_Entity;
Set_Ekind (Standard_A_Char, E_Access_Type);
Set_Scope (Standard_A_Char, Standard_Standard);
Set_Etype (Standard_A_Char, Standard_A_String);
Init_Size (Standard_A_Char, System_Address_Size);
Set_Elem_Alignment (Standard_A_Char);
Set_Directly_Designated_Type (Standard_A_Char, Standard_Character);
Make_Name (Standard_A_Char, "access_character");
-- Note on type names. The type names for the following special types
-- are constructed so that they will look reasonable should they ever
-- appear in error messages etc, although in practice the use of the
-- special insertion character } for types results in special handling
-- of these type names in any case. The blanks in these names would
-- trouble in Gigi, but that's OK here, since none of these types
-- should ever get through to Gigi! Attributes of these types are
-- filled out to minimize problems with cascaded errors (for example,
-- Any_Integer is given reasonable and consistent type and size values)
Any_Type := New_Standard_Entity;
Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Any_Type);
Set_Scope (Any_Type, Standard_Standard);
Build_Signed_Integer_Type (Any_Type, Standard_Integer_Size);
Make_Name (Any_Type, "any type");
Any_Id := New_Standard_Entity;
Set_Ekind (Any_Id, E_Variable);
Set_Scope (Any_Id, Standard_Standard);
Set_Etype (Any_Id, Any_Type);
Init_Size_Align (Any_Id);
Make_Name (Any_Id, "any id");
Any_Access := New_Standard_Entity;
Set_Ekind (Any_Access, E_Access_Type);
Set_Scope (Any_Access, Standard_Standard);
Set_Etype (Any_Access, Any_Access);
Init_Size (Any_Access, System_Address_Size);
Set_Elem_Alignment (Any_Access);
Make_Name (Any_Access, "an access type");
Any_Character := New_Standard_Entity;
Set_Ekind (Any_Character, E_Enumeration_Type);
Set_Scope (Any_Character, Standard_Standard);
Set_Etype (Any_Character, Any_Character);
Set_Is_Unsigned_Type (Any_Character);
Set_Is_Character_Type (Any_Character);
Init_Esize (Any_Character, Standard_Character_Size);
Init_RM_Size (Any_Character, 8);
Set_Elem_Alignment (Any_Character);
Set_Scalar_Range (Any_Character, Scalar_Range (Standard_Character));
Make_Name (Any_Character, "a character type");
Any_Array := New_Standard_Entity;
Set_Ekind (Any_Array, E_String_Type);
Set_Scope (Any_Array, Standard_Standard);
Set_Etype (Any_Array, Any_Array);
Set_Component_Type (Any_Array, Any_Character);
Init_Size_Align (Any_Array);
Make_Name (Any_Array, "an array type");
Any_Boolean := New_Standard_Entity;
Set_Ekind (Any_Boolean, E_Enumeration_Type);
Set_Scope (Any_Boolean, Standard_Standard);
Set_Etype (Any_Boolean, Standard_Boolean);
Init_Esize (Any_Boolean, Standard_Character_Size);
Init_RM_Size (Any_Boolean, 1);
Set_Elem_Alignment (Any_Boolean);
Set_Is_Unsigned_Type (Any_Boolean);
Set_Scalar_Range (Any_Boolean, Scalar_Range (Standard_Boolean));
Make_Name (Any_Boolean, "a boolean type");
Any_Composite := New_Standard_Entity;
Set_Ekind (Any_Composite, E_Array_Type);
Set_Scope (Any_Composite, Standard_Standard);
Set_Etype (Any_Composite, Any_Composite);
Set_Component_Size (Any_Composite, Uint_0);
Set_Component_Type (Any_Composite, Standard_Integer);
Init_Size_Align (Any_Composite);
Make_Name (Any_Composite, "a composite type");
Any_Discrete := New_Standard_Entity;
Set_Ekind (Any_Discrete, E_Signed_Integer_Type);
Set_Scope (Any_Discrete, Standard_Standard);
Set_Etype (Any_Discrete, Any_Discrete);
Init_Size (Any_Discrete, Standard_Integer_Size);
Set_Elem_Alignment (Any_Discrete);
Make_Name (Any_Discrete, "a discrete type");
Any_Fixed := New_Standard_Entity;
Set_Ekind (Any_Fixed, E_Ordinary_Fixed_Point_Type);
Set_Scope (Any_Fixed, Standard_Standard);
Set_Etype (Any_Fixed, Any_Fixed);
Init_Size (Any_Fixed, Standard_Integer_Size);
Set_Elem_Alignment (Any_Fixed);
Make_Name (Any_Fixed, "a fixed-point type");
Any_Integer := New_Standard_Entity;
Set_Ekind (Any_Integer, E_Signed_Integer_Type);
Set_Scope (Any_Integer, Standard_Standard);
Set_Etype (Any_Integer, Standard_Long_Long_Integer);
Init_Size (Any_Integer, Standard_Long_Long_Integer_Size);
Set_Elem_Alignment (Any_Integer);
Set_Integer_Bounds
(Any_Integer,
Typ => Base_Type (Standard_Integer),
Lb => Uint_0,
Hb => Intval (High_Bound (Scalar_Range (Standard_Integer))));
Make_Name (Any_Integer, "an integer type");
Any_Modular := New_Standard_Entity;
Set_Ekind (Any_Modular, E_Modular_Integer_Type);
Set_Scope (Any_Modular, Standard_Standard);
Set_Etype (Any_Modular, Standard_Long_Long_Integer);
Init_Size (Any_Modular, Standard_Long_Long_Integer_Size);
Set_Elem_Alignment (Any_Modular);
Set_Is_Unsigned_Type (Any_Modular);
Make_Name (Any_Modular, "a modular type");
Any_Numeric := New_Standard_Entity;
Set_Ekind (Any_Numeric, E_Signed_Integer_Type);
Set_Scope (Any_Numeric, Standard_Standard);
Set_Etype (Any_Numeric, Standard_Long_Long_Integer);
Init_Size (Any_Numeric, Standard_Long_Long_Integer_Size);
Set_Elem_Alignment (Any_Numeric);
Make_Name (Any_Numeric, "a numeric type");
Any_Real := New_Standard_Entity;
Set_Ekind (Any_Real, E_Floating_Point_Type);
Set_Scope (Any_Real, Standard_Standard);
Set_Etype (Any_Real, Standard_Long_Long_Float);
Init_Size (Any_Real, Standard_Long_Long_Float_Size);
Set_Elem_Alignment (Any_Real);
Make_Name (Any_Real, "a real type");
Any_Scalar := New_Standard_Entity;
Set_Ekind (Any_Scalar, E_Signed_Integer_Type);
Set_Scope (Any_Scalar, Standard_Standard);
Set_Etype (Any_Scalar, Any_Scalar);
Init_Size (Any_Scalar, Standard_Integer_Size);
Set_Elem_Alignment (Any_Scalar);
Make_Name (Any_Scalar, "a scalar type");
Any_String := New_Standard_Entity;
Set_Ekind (Any_String, E_String_Type);
Set_Scope (Any_String, Standard_Standard);
Set_Etype (Any_String, Any_String);
Set_Component_Type (Any_String, Any_Character);
Init_Size_Align (Any_String);
Make_Name (Any_String, "a string type");
declare
Index : Node_Id;
begin
Index :=
Make_Range (Stloc,
Low_Bound => Make_Integer (Uint_0),
High_Bound => Make_Integer (Uint_2 ** Standard_Integer_Size));
Set_Etype (Index, Standard_Integer);
Set_First_Index (Any_String, Index);
end;
Standard_Integer_8 := New_Standard_Entity;
Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Standard_Integer_8);
Make_Name (Standard_Integer_8, "integer_8");
Set_Scope (Standard_Integer_8, Standard_Standard);
Build_Signed_Integer_Type (Standard_Integer_8, 8);
Standard_Integer_16 := New_Standard_Entity;
Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Standard_Integer_16);
Make_Name (Standard_Integer_16, "integer_16");
Set_Scope (Standard_Integer_16, Standard_Standard);
Build_Signed_Integer_Type (Standard_Integer_16, 16);
Standard_Integer_32 := New_Standard_Entity;
Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Standard_Integer_32);
Make_Name (Standard_Integer_32, "integer_32");
Set_Scope (Standard_Integer_32, Standard_Standard);
Build_Signed_Integer_Type (Standard_Integer_32, 32);
Standard_Integer_64 := New_Standard_Entity;
Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Standard_Integer_64);
Make_Name (Standard_Integer_64, "integer_64");
Set_Scope (Standard_Integer_64, Standard_Standard);
Build_Signed_Integer_Type (Standard_Integer_64, 64);
Standard_Unsigned := New_Standard_Entity;
Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Standard_Unsigned);
Make_Name (Standard_Unsigned, "unsigned");
Set_Ekind (Standard_Unsigned, E_Modular_Integer_Type);
Set_Scope (Standard_Unsigned, Standard_Standard);
Set_Etype (Standard_Unsigned, Standard_Unsigned);
Init_Size (Standard_Unsigned, Standard_Integer_Size);
Set_Elem_Alignment (Standard_Unsigned);
Set_Modulus (Standard_Unsigned,
Uint_2 ** Standard_Integer_Size);
Set_Is_Unsigned_Type (Standard_Unsigned);
Set_Size_Known_At_Compile_Time
(Standard_Unsigned);
R_Node := New_Node (N_Range, Stloc);
Set_Low_Bound (R_Node, Make_Integer (Uint_0));
Set_High_Bound (R_Node, Make_Integer (Modulus (Standard_Unsigned) - 1));
Set_Etype (Low_Bound (R_Node), Standard_Unsigned);
Set_Etype (High_Bound (R_Node), Standard_Unsigned);
Set_Scalar_Range (Standard_Unsigned, R_Node);
-- Note: universal integer and universal real are constructed as fully
-- formed signed numeric types, with parameters corresponding to the
-- longest runtime types (Long_Long_Integer and Long_Long_Float). This
-- allows Gigi to properly process references to universal types that
-- are not folded at compile time.
Universal_Integer := New_Standard_Entity;
Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Universal_Integer);
Make_Name (Universal_Integer, "universal_integer");
Set_Scope (Universal_Integer, Standard_Standard);
Build_Signed_Integer_Type
(Universal_Integer, Standard_Long_Long_Integer_Size);
Universal_Real := New_Standard_Entity;
Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Universal_Real);
Make_Name (Universal_Real, "universal_real");
Set_Scope (Universal_Real, Standard_Standard);
Build_Float_Type
(Universal_Real,
Standard_Long_Long_Float_Size,
Standard_Long_Long_Float_Digits);
-- Note: universal fixed, unlike universal integer and universal real,
-- is never used at runtime, so it does not need to have bounds set.
Universal_Fixed := New_Standard_Entity;
Decl := New_Node (N_Full_Type_Declaration, Stloc);
Set_Defining_Identifier (Decl, Universal_Fixed);
Make_Name (Universal_Fixed, "universal_fixed");
Set_Ekind (Universal_Fixed, E_Ordinary_Fixed_Point_Type);
Set_Etype (Universal_Fixed, Universal_Fixed);
Set_Scope (Universal_Fixed, Standard_Standard);
Init_Size (Universal_Fixed, Standard_Long_Long_Integer_Size);
Set_Elem_Alignment (Universal_Fixed);
Set_Size_Known_At_Compile_Time
(Universal_Fixed);
-- Create type declaration for Duration, using a 64-bit size. The
-- delta and size values depend on the mode set in system.ads.
Build_Duration : declare
Dlo : Uint;
Dhi : Uint;
Delta_Val : Ureal;
begin
-- In 32 bit mode, the size is 32 bits, and the delta and
-- small values are set to 20 milliseconds (20.0**(10.0**(-3)).
if Duration_32_Bits_On_Target then
Dlo := Intval (Type_Low_Bound (Standard_Integer_32));
Dhi := Intval (Type_High_Bound (Standard_Integer_32));
Delta_Val := UR_From_Components (UI_From_Int (20), Uint_3, 10);
-- In standard 64-bit mode, the size is 64-bits and the delta and
-- small values are set to nanoseconds (1.0**(10.0**(-9))
else
Dlo := Intval (Type_Low_Bound (Standard_Integer_64));
Dhi := Intval (Type_High_Bound (Standard_Integer_64));
Delta_Val := UR_From_Components (Uint_1, Uint_9, 10);
end if;
Tdef_Node := Make_Ordinary_Fixed_Point_Definition (Stloc,
Delta_Expression => Make_Real_Literal (Stloc, Delta_Val),
Real_Range_Specification =>
Make_Real_Range_Specification (Stloc,
Low_Bound => Make_Real_Literal (Stloc,
Realval => Dlo * Delta_Val),
High_Bound => Make_Real_Literal (Stloc,
Realval => Dhi * Delta_Val)));
Set_Type_Definition (Parent (Standard_Duration), Tdef_Node);
Set_Ekind (Standard_Duration, E_Ordinary_Fixed_Point_Type);
Set_Etype (Standard_Duration, Standard_Duration);
if Duration_32_Bits_On_Target then
Init_Size (Standard_Duration, 32);
else
Init_Size (Standard_Duration, 64);
end if;
Set_Elem_Alignment (Standard_Duration);
Set_Delta_Value (Standard_Duration, Delta_Val);
Set_Small_Value (Standard_Duration, Delta_Val);
Set_Scalar_Range (Standard_Duration,
Real_Range_Specification
(Type_Definition (Parent (Standard_Duration))));
-- Normally it does not matter that nodes in package Standard are
-- not marked as analyzed. The Scalar_Range of the fixed-point
-- type Standard_Duration is an exception, because of the special
-- test made in Freeze.Freeze_Fixed_Point_Type.
Set_Analyzed (Scalar_Range (Standard_Duration));
Set_Etype (Type_High_Bound (Standard_Duration), Standard_Duration);
Set_Etype (Type_Low_Bound (Standard_Duration), Standard_Duration);
Set_Is_Static_Expression (Type_High_Bound (Standard_Duration));
Set_Is_Static_Expression (Type_Low_Bound (Standard_Duration));
Set_Corresponding_Integer_Value
(Type_High_Bound (Standard_Duration), Dhi);
Set_Corresponding_Integer_Value
(Type_Low_Bound (Standard_Duration), Dlo);
Set_Size_Known_At_Compile_Time (Standard_Duration);
end Build_Duration;
-- Build standard exception type. Note that the type name here is
-- actually used in the generated code, so it must be set correctly
-- ??? Also note that the Import_Code component is now declared
-- as a System.Standard_Library.Exception_Code to enforce run-time
-- library implementation consistency. It's too early here to resort
-- to rtsfind to get the proper node for that type, so we use the
-- closest possible available type node at hand instead. We should
-- probably be fixing this up at some point.
Standard_Exception_Type := New_Standard_Entity;
Set_Ekind (Standard_Exception_Type, E_Record_Type);
Set_Etype (Standard_Exception_Type, Standard_Exception_Type);
Set_Scope (Standard_Exception_Type, Standard_Standard);
Set_Stored_Constraint
(Standard_Exception_Type, No_Elist);
Init_Size_Align (Standard_Exception_Type);
Set_Size_Known_At_Compile_Time
(Standard_Exception_Type, True);
Make_Name (Standard_Exception_Type, "exception");
Make_Component
(Standard_Exception_Type, Standard_Boolean, "Not_Handled_By_Others");
Make_Component
(Standard_Exception_Type, Standard_Character, "Lang");
Make_Component
(Standard_Exception_Type, Standard_Natural, "Name_Length");
Make_Component
(Standard_Exception_Type, Standard_A_Char, "Full_Name");
Make_Component
(Standard_Exception_Type, Standard_A_Char, "HTable_Ptr");
Make_Component
(Standard_Exception_Type, Standard_Unsigned, "Import_Code");
Make_Component
(Standard_Exception_Type, Standard_A_Char, "Raise_Hook");
-- Build tree for record declaration, for use by the back-end
declare
Comp_List : List_Id;
Comp : Entity_Id;
begin
Comp := First_Entity (Standard_Exception_Type);
Comp_List := New_List;
while Present (Comp) loop
Append (
Make_Component_Declaration (Stloc,
Defining_Identifier => Comp,
Component_Definition =>
Make_Component_Definition (Stloc,
Aliased_Present => False,
Subtype_Indication => New_Occurrence_Of (Etype (Comp),
Stloc))),
Comp_List);
Next_Entity (Comp);
end loop;
Decl := Make_Full_Type_Declaration (Stloc,
Defining_Identifier => Standard_Exception_Type,
Type_Definition =>
Make_Record_Definition (Stloc,
End_Label => Empty,
Component_List =>
Make_Component_List (Stloc,
Component_Items => Comp_List)));
end;
Append (Decl, Decl_S);
Layout_Type (Standard_Exception_Type);
-- Create declarations of standard exceptions
Build_Exception (S_Constraint_Error);
Build_Exception (S_Program_Error);
Build_Exception (S_Storage_Error);
Build_Exception (S_Tasking_Error);
-- Numeric_Error is a normal exception in Ada 83, but in Ada 95
-- it is a renaming of Constraint_Error. Is this test too early???
if Ada_Version = Ada_83 then
Build_Exception (S_Numeric_Error);
else
Decl := New_Node (N_Exception_Renaming_Declaration, Stloc);
E_Id := Standard_Entity (S_Numeric_Error);
Set_Ekind (E_Id, E_Exception);
Set_Exception_Code (E_Id, Uint_0);
Set_Etype (E_Id, Standard_Exception_Type);
Set_Is_Public (E_Id);
Set_Renamed_Entity (E_Id, Standard_Entity (S_Constraint_Error));
Set_Defining_Identifier (Decl, E_Id);
Append (Decl, Decl_S);
Ident_Node := New_Node (N_Identifier, Stloc);
Set_Chars (Ident_Node, Chars (Standard_Entity (S_Constraint_Error)));
Set_Entity (Ident_Node, Standard_Entity (S_Constraint_Error));
Set_Name (Decl, Ident_Node);
end if;
-- Abort_Signal is an entity that does not get made visible
Abort_Signal := New_Standard_Entity;
Set_Chars (Abort_Signal, Name_uAbort_Signal);
Set_Ekind (Abort_Signal, E_Exception);
Set_Exception_Code (Abort_Signal, Uint_0);
Set_Etype (Abort_Signal, Standard_Exception_Type);
Set_Scope (Abort_Signal, Standard_Standard);
Set_Is_Public (Abort_Signal, True);
Decl :=
Make_Exception_Declaration (Stloc,
Defining_Identifier => Abort_Signal);
-- Create defining identifiers for shift operator entities. Note
-- that these entities are used only for marking shift operators
-- generated internally, and hence need no structure, just a name
-- and a unique identity.
Standard_Op_Rotate_Left := New_Standard_Entity;
Set_Chars (Standard_Op_Rotate_Left, Name_Rotate_Left);
Set_Ekind (Standard_Op_Rotate_Left, E_Operator);
Standard_Op_Rotate_Right := New_Standard_Entity;
Set_Chars (Standard_Op_Rotate_Right, Name_Rotate_Right);
Set_Ekind (Standard_Op_Rotate_Right, E_Operator);
Standard_Op_Shift_Left := New_Standard_Entity;
Set_Chars (Standard_Op_Shift_Left, Name_Shift_Left);
Set_Ekind (Standard_Op_Shift_Left, E_Operator);
Standard_Op_Shift_Right := New_Standard_Entity;
Set_Chars (Standard_Op_Shift_Right, Name_Shift_Right);
Set_Ekind (Standard_Op_Shift_Right, E_Operator);
Standard_Op_Shift_Right_Arithmetic := New_Standard_Entity;
Set_Chars (Standard_Op_Shift_Right_Arithmetic,
Name_Shift_Right_Arithmetic);
Set_Ekind (Standard_Op_Shift_Right_Arithmetic,
E_Operator);
-- Create standard operator declarations
Create_Operators;
-- Initialize visibility table with entities in Standard
for E in Standard_Entity_Type loop
if Ekind (Standard_Entity (E)) /= E_Operator then
Set_Name_Entity_Id
(Chars (Standard_Entity (E)), Standard_Entity (E));
Set_Homonym (Standard_Entity (E), Empty);
end if;
if E not in S_ASCII_Names then
Set_Scope (Standard_Entity (E), Standard_Standard);
Set_Is_Immediately_Visible (Standard_Entity (E));
end if;
end loop;
-- The predefined package Standard itself does not have a scope;
-- it is the only entity in the system not to have one, and this
-- is what identifies the package to Gigi.
Set_Scope (Standard_Standard, Empty);
-- Set global variables indicating last Id values and version
Last_Standard_Node_Id := Last_Node_Id;
Last_Standard_List_Id := Last_List_Id;
-- The Error node has an Etype of Any_Type to help error recovery
Set_Etype (Error, Any_Type);
-- Print representation of standard if switch set
if Opt.Print_Standard then
Print_Standard;
end if;
end Create_Standard;
------------------------------------
-- Create_Unconstrained_Base_Type --
------------------------------------
procedure Create_Unconstrained_Base_Type
(E : Entity_Id;
K : Entity_Kind)
is
New_Ent : constant Entity_Id := New_Copy (E);
begin
Set_Ekind (E, K);
Set_Is_Constrained (E, True);
Set_Is_First_Subtype (E, True);
Set_Etype (E, New_Ent);
Append_Entity (New_Ent, Standard_Standard);
Set_Is_Constrained (New_Ent, False);
Set_Etype (New_Ent, New_Ent);
Set_Is_Known_Valid (New_Ent, True);
if K = E_Signed_Integer_Subtype then
Set_Etype (Low_Bound (Scalar_Range (E)), New_Ent);
Set_Etype (High_Bound (Scalar_Range (E)), New_Ent);
end if;
end Create_Unconstrained_Base_Type;
--------------------
-- Identifier_For --
--------------------
function Identifier_For (S : Standard_Entity_Type) return Node_Id is
Ident_Node : Node_Id;
begin
Ident_Node := New_Node (N_Identifier, Stloc);
Set_Chars (Ident_Node, Chars (Standard_Entity (S)));
return Ident_Node;
end Identifier_For;
--------------------
-- Make_Component --
--------------------
procedure Make_Component
(Rec : Entity_Id;
Typ : Entity_Id;
Nam : String)
is
Id : constant Entity_Id := New_Standard_Entity;
begin
Set_Ekind (Id, E_Component);
Set_Etype (Id, Typ);
Set_Scope (Id, Rec);
Init_Component_Location (Id);
Set_Original_Record_Component (Id, Id);
Make_Name (Id, Nam);
Append_Entity (Id, Rec);
end Make_Component;
-----------------
-- Make_Formal --
-----------------
function Make_Formal
(Typ : Entity_Id;
Formal_Name : String) return Entity_Id
is
Formal : Entity_Id;
begin
Formal := New_Standard_Entity;
Set_Ekind (Formal, E_In_Parameter);
Set_Mechanism (Formal, Default_Mechanism);
Set_Scope (Formal, Standard_Standard);
Set_Etype (Formal, Typ);
Make_Name (Formal, Formal_Name);
return Formal;
end Make_Formal;
------------------
-- Make_Integer --
------------------
function Make_Integer (V : Uint) return Node_Id is
N : constant Node_Id := Make_Integer_Literal (Stloc, V);
begin
Set_Is_Static_Expression (N);
return N;
end Make_Integer;
---------------
-- Make_Name --
---------------
procedure Make_Name (Id : Entity_Id; Nam : String) is
begin
for J in 1 .. Nam'Length loop
Name_Buffer (J) := Fold_Lower (Nam (Nam'First + (J - 1)));
end loop;
Name_Len := Nam'Length;
Set_Chars (Id, Name_Find);
end Make_Name;
------------------
-- New_Operator --
------------------
function New_Operator (Op : Name_Id; Typ : Entity_Id) return Entity_Id is
Ident_Node : Entity_Id;
begin
Ident_Node := Make_Defining_Identifier (Stloc, Op);
Set_Is_Pure (Ident_Node, True);
Set_Ekind (Ident_Node, E_Operator);
Set_Etype (Ident_Node, Typ);
Set_Scope (Ident_Node, Standard_Standard);
Set_Homonym (Ident_Node, Get_Name_Entity_Id (Op));
Set_Convention (Ident_Node, Convention_Intrinsic);
Set_Is_Immediately_Visible (Ident_Node, True);
Set_Is_Intrinsic_Subprogram (Ident_Node, True);
Set_Name_Entity_Id (Op, Ident_Node);
Append_Entity (Ident_Node, Standard_Standard);
return Ident_Node;
end New_Operator;
-------------------------
-- New_Standard_Entity --
-------------------------
function New_Standard_Entity
(New_Node_Kind : Node_Kind := N_Defining_Identifier) return Entity_Id
is
E : constant Entity_Id := New_Entity (New_Node_Kind, Stloc);
begin
-- All standard entities are Pure and Public
Set_Is_Pure (E);
Set_Is_Public (E);
-- All standard entity names are analyzed manually, and are thus
-- frozen as soon as they are created.
Set_Is_Frozen (E);
-- Set debug information required for all standard types
Set_Needs_Debug_Info (E);
-- All standard entities are built with fully qualified names, so
-- set the flag to prevent an abortive attempt at requalification!
Set_Has_Qualified_Name (E);
-- Return newly created entity to be completed by caller
return E;
end New_Standard_Entity;
--------------------
-- Print_Standard --
--------------------
procedure Print_Standard is
procedure P (Item : String) renames Output.Write_Line;
-- Short-hand, since we do a lot of line writes here!
procedure P_Int_Range (Size : Pos);
-- Prints the range of an integer based on its Size
procedure P_Float_Range (Id : Entity_Id);
-- Prints the bounds range for the given float type entity
-------------------
-- P_Float_Range --
-------------------
procedure P_Float_Range (Id : Entity_Id) is
Digs : constant Nat := UI_To_Int (Digits_Value (Id));
begin
Write_Str (" range ");
if Vax_Float (Id) then
if Digs = VAXFF_Digits then
Write_Str (VAXFF_First'Universal_Literal_String);
Write_Str (" .. ");
Write_Str (VAXFF_Last'Universal_Literal_String);
elsif Digs = VAXDF_Digits then
Write_Str (VAXDF_First'Universal_Literal_String);
Write_Str (" .. ");
Write_Str (VAXDF_Last'Universal_Literal_String);
else
pragma Assert (Digs = VAXGF_Digits);
Write_Str (VAXGF_First'Universal_Literal_String);
Write_Str (" .. ");
Write_Str (VAXGF_Last'Universal_Literal_String);
end if;
elsif Is_AAMP_Float (Id) then
if Digs = AAMPS_Digits then
Write_Str (AAMPS_First'Universal_Literal_String);
Write_Str (" .. ");
Write_Str (AAMPS_Last'Universal_Literal_String);
else
pragma Assert (Digs = AAMPL_Digits);
Write_Str (AAMPL_First'Universal_Literal_String);
Write_Str (" .. ");
Write_Str (AAMPL_Last'Universal_Literal_String);
end if;
elsif Digs = IEEES_Digits then
Write_Str (IEEES_First'Universal_Literal_String);
Write_Str (" .. ");
Write_Str (IEEES_Last'Universal_Literal_String);
elsif Digs = IEEEL_Digits then
Write_Str (IEEEL_First'Universal_Literal_String);
Write_Str (" .. ");
Write_Str (IEEEL_Last'Universal_Literal_String);
else
pragma Assert (Digs = IEEEX_Digits);
Write_Str (IEEEX_First'Universal_Literal_String);
Write_Str (" .. ");
Write_Str (IEEEX_Last'Universal_Literal_String);
end if;
Write_Str (";");
Write_Eol;
end P_Float_Range;
-----------------
-- P_Int_Range --
-----------------
procedure P_Int_Range (Size : Pos) is
begin
Write_Str (" is range -(2 **");
Write_Int (Size - 1);
Write_Str (")");
Write_Str (" .. +(2 **");
Write_Int (Size - 1);
Write_Str (" - 1);");
Write_Eol;
end P_Int_Range;
-- Start of processing for Print_Standard
begin
P ("-- Representation of package Standard");
Write_Eol;
P ("-- This is not accurate Ada, since new base types cannot be ");
P ("-- created, but the listing shows the target dependent");
P ("-- characteristics of the Standard types for this compiler");
Write_Eol;
P ("package Standard is");
P ("pragma Pure(Standard);");
Write_Eol;
P (" type Boolean is (False, True);");
P (" for Boolean'Size use 1;");
P (" for Boolean use (False => 0, True => 1);");
Write_Eol;
-- Integer types
Write_Str (" type Integer");
P_Int_Range (Standard_Integer_Size);
Write_Str (" for Integer'Size use ");
Write_Int (Standard_Integer_Size);
P (";");
Write_Eol;
P (" subtype Natural is Integer range 0 .. Integer'Last;");
P (" subtype Positive is Integer range 1 .. Integer'Last;");
Write_Eol;
Write_Str (" type Short_Short_Integer");
P_Int_Range (Standard_Short_Short_Integer_Size);
Write_Str (" for Short_Short_Integer'Size use ");
Write_Int (Standard_Short_Short_Integer_Size);
P (";");
Write_Eol;
Write_Str (" type Short_Integer");
P_Int_Range (Standard_Short_Integer_Size);
Write_Str (" for Short_Integer'Size use ");
Write_Int (Standard_Short_Integer_Size);
P (";");
Write_Eol;
Write_Str (" type Long_Integer");
P_Int_Range (Standard_Long_Integer_Size);
Write_Str (" for Long_Integer'Size use ");
Write_Int (Standard_Long_Integer_Size);
P (";");
Write_Eol;
Write_Str (" type Long_Long_Integer");
P_Int_Range (Standard_Long_Long_Integer_Size);
Write_Str (" for Long_Long_Integer'Size use ");
Write_Int (Standard_Long_Long_Integer_Size);
P (";");
Write_Eol;
-- Floating point types
Write_Str (" type Short_Float is digits ");
Write_Int (Standard_Short_Float_Digits);
Write_Eol;
P_Float_Range (Standard_Short_Float);
Write_Str (" for Short_Float'Size use ");
Write_Int (Standard_Short_Float_Size);
P (";");
Write_Eol;
Write_Str (" type Float is digits ");
Write_Int (Standard_Float_Digits);
Write_Eol;
P_Float_Range (Standard_Float);
Write_Str (" for Float'Size use ");
Write_Int (Standard_Float_Size);
P (";");
Write_Eol;
Write_Str (" type Long_Float is digits ");
Write_Int (Standard_Long_Float_Digits);
Write_Eol;
P_Float_Range (Standard_Long_Float);
Write_Str (" for Long_Float'Size use ");
Write_Int (Standard_Long_Float_Size);
P (";");
Write_Eol;
Write_Str (" type Long_Long_Float is digits ");
Write_Int (Standard_Long_Long_Float_Digits);
Write_Eol;
P_Float_Range (Standard_Long_Long_Float);
Write_Str (" for Long_Long_Float'Size use ");
Write_Int (Standard_Long_Long_Float_Size);
P (";");
Write_Eol;
P (" type Character is (...)");
Write_Str (" for Character'Size use ");
Write_Int (Standard_Character_Size);
P (";");
P (" -- See RM A.1(35) for details of this type");
Write_Eol;
P (" type Wide_Character is (...)");
Write_Str (" for Wide_Character'Size use ");
Write_Int (Standard_Wide_Character_Size);
P (";");
P (" -- See RM A.1(36) for details of this type");
Write_Eol;
P (" type Wide_Wide_Character is (...)");
Write_Str (" for Wide_Character'Size use ");
Write_Int (Standard_Wide_Wide_Character_Size);
P (";");
P (" -- See RM A.1(36) for details of this type");
P (" type String is array (Positive range <>) of Character;");
P (" pragma Pack (String);");
Write_Eol;
P (" type Wide_String is array (Positive range <>)" &
" of Wide_Character;");
P (" pragma Pack (Wide_String);");
Write_Eol;
P (" type Wide_Wide_String is array (Positive range <>)" &
" of Wide_Wide_Character;");
P (" pragma Pack (Wide_Wide_String);");
Write_Eol;
-- Here it's OK to use the Duration type of the host compiler since
-- the implementation of Duration in GNAT is target independent.
if Duration_32_Bits_On_Target then
P (" type Duration is delta 0.020");
P (" range -((2 ** 31 - 1) * 0.020) ..");
P (" +((2 ** 31 - 1) * 0.020);");
P (" for Duration'Small use 0.020;");
else
P (" type Duration is delta 0.000000001");
P (" range -((2 ** 63 - 1) * 0.000000001) ..");
P (" +((2 ** 63 - 1) * 0.000000001);");
P (" for Duration'Small use 0.000000001;");
end if;
Write_Eol;
P (" Constraint_Error : exception;");
P (" Program_Error : exception;");
P (" Storage_Error : exception;");
P (" Tasking_Error : exception;");
P (" Numeric_Error : exception renames Constraint_Error;");
Write_Eol;
P ("end Standard;");
end Print_Standard;
----------------------
-- Set_Float_Bounds --
----------------------
procedure Set_Float_Bounds (Id : Entity_Id) is
L : Node_Id;
-- Low bound of literal value
H : Node_Id;
-- High bound of literal value
R : Node_Id;
-- Range specification
Digs : constant Nat := UI_To_Int (Digits_Value (Id));
-- Digits value, used to select bounds
begin
-- Note: for the call from Cstand to initially create the types in
-- Standard, Vax_Float will always be False. Circuitry in Sem_Vfpt
-- will adjust these types appropriately in the Vax_Float case if
-- a pragma Float_Representation (VAX_Float) is used.
if Vax_Float (Id) then
if Digs = VAXFF_Digits then
L := Real_Convert
(VAXFF_First'Universal_Literal_String);
H := Real_Convert
(VAXFF_Last'Universal_Literal_String);
elsif Digs = VAXDF_Digits then
L := Real_Convert
(VAXDF_First'Universal_Literal_String);
H := Real_Convert
(VAXDF_Last'Universal_Literal_String);
else
pragma Assert (Digs = VAXGF_Digits);
L := Real_Convert
(VAXGF_First'Universal_Literal_String);
H := Real_Convert
(VAXGF_Last'Universal_Literal_String);
end if;
elsif Is_AAMP_Float (Id) then
if Digs = AAMPS_Digits then
L := Real_Convert
(AAMPS_First'Universal_Literal_String);
H := Real_Convert
(AAMPS_Last'Universal_Literal_String);
else
pragma Assert (Digs = AAMPL_Digits);
L := Real_Convert
(AAMPL_First'Universal_Literal_String);
H := Real_Convert
(AAMPL_Last'Universal_Literal_String);
end if;
elsif Digs = IEEES_Digits then
L := Real_Convert
(IEEES_First'Universal_Literal_String);
H := Real_Convert
(IEEES_Last'Universal_Literal_String);
elsif Digs = IEEEL_Digits then
L := Real_Convert
(IEEEL_First'Universal_Literal_String);
H := Real_Convert
(IEEEL_Last'Universal_Literal_String);
else
pragma Assert (Digs = IEEEX_Digits);
L := Real_Convert
(IEEEX_First'Universal_Literal_String);
H := Real_Convert
(IEEEX_Last'Universal_Literal_String);
end if;
Set_Etype (L, Id);
Set_Is_Static_Expression (L);
Set_Etype (H, Id);
Set_Is_Static_Expression (H);
R := New_Node (N_Range, Stloc);
Set_Low_Bound (R, L);
Set_High_Bound (R, H);
Set_Includes_Infinities (R, True);
Set_Scalar_Range (Id, R);
Set_Etype (R, Id);
Set_Parent (R, Id);
end Set_Float_Bounds;
------------------------
-- Set_Integer_Bounds --
------------------------
procedure Set_Integer_Bounds
(Id : Entity_Id;
Typ : Entity_Id;
Lb : Uint;
Hb : Uint)
is
L : Node_Id; -- Low bound of literal value
H : Node_Id; -- High bound of literal value
R : Node_Id; -- Range specification
begin
L := Make_Integer (Lb);
H := Make_Integer (Hb);
Set_Etype (L, Typ);
Set_Etype (H, Typ);
R := New_Node (N_Range, Stloc);
Set_Low_Bound (R, L);
Set_High_Bound (R, H);
Set_Scalar_Range (Id, R);
Set_Etype (R, Typ);
Set_Parent (R, Id);
Set_Is_Unsigned_Type (Id, Lb >= 0);
end Set_Integer_Bounds;
end CStand;
| 38.045018 | 79 | 0.624237 |
df8b2d4b752f3db47366d033dfa723680b2098f9 | 11,394 | adb | Ada | server/src/yaml-servers.adb | robdaemon/AdaYaml | 2cb52c5e7eee3a2d9951945d5ddb4eeddc088f6e | [
"MIT"
] | 32 | 2017-08-02T16:45:34.000Z | 2021-08-18T20:12:57.000Z | server/src/yaml-servers.adb | robdaemon/AdaYaml | 2cb52c5e7eee3a2d9951945d5ddb4eeddc088f6e | [
"MIT"
] | 15 | 2017-09-13T09:43:38.000Z | 2022-01-20T23:21:47.000Z | server/src/yaml-servers.adb | robdaemon/AdaYaml | 2cb52c5e7eee3a2d9951945d5ddb4eeddc088f6e | [
"MIT"
] | 5 | 2017-09-19T16:54:22.000Z | 2020-04-09T07:17:02.000Z | with Ada.Exceptions;
with Ada.Strings.Fixed;
with Ada.Text_IO;
with Yaml.Inspect;
package body Yaml.Servers is
type Yaml_Params (Input_Length : Natural) is record
Input : String (1 .. Input_Length);
end record;
function Params (Path : String) return Yaml_Params is
Src_Pos : Positive := 1;
begin
while Src_Pos <= Path'Last and then Path (Src_Pos) /= '?' loop
Src_Pos := Src_Pos + 1;
end loop;
Src_Pos := Src_Pos + 1;
while Src_Pos <= Path'Last loop
declare
Name_End : Positive := Src_Pos;
begin
while Name_End <= Path'Last and then
not (Path (Name_End) in '#' | '&' | '=') loop
Name_End := Name_End + 1;
end loop;
if Name_End <= Path'Last and then Path (Name_End) = '=' then
if Path (Src_Pos .. Name_End - 1) = "input" then
Src_Pos := Name_End + 1;
--while Src_Pos <= Path'Last and then
-- not (Path (Src_Pos) in '&' | '#') loop
while Src_Pos <= Path'Last loop
Src_Pos := Src_Pos + 1;
end loop;
return (Input_Length => Src_Pos - Name_End - 1,
Input => Path (Name_End + 1 .. Src_Pos - 1));
else
Src_Pos := Name_End + 1;
while Src_Pos <= Path'Last and then
not (Path (Src_Pos) in '&' | '#') loop
Src_Pos := Src_Pos + 1;
end loop;
end if;
else
Src_Pos := Name_End;
end if;
end;
exit when Src_Pos > Path'Last or else Path (Src_Pos) /= '&';
Src_Pos := Src_Pos + 1;
end loop;
return (Input_Length => 0, Input => "");
end Params;
procedure Generate (Client : in out Yaml_Client'Class;
Params : Yaml_Params) is
Next_Event_Id : Positive;
procedure Write_Output_Radio (Value : String) is
begin
Client.Accumulate_Body
("<label class=""output-style""><input type=""radio"" " &
"name=""output-style"" value=""" & Value & """ />" & Value &
"</label>");
end Write_Output_Radio;
procedure Start_Emitting is
begin
Client.Accumulate_Body
("<!doctype html><html lang=""en""><head><title>YAML 1.3 Widget</title>" &
"<script src=""resources/yaml-inspector.js""></script>" &
"<link rel=""stylesheet"" href=""resources/yaml.css"" />" &
"</head><body><form id=""yaml-inspect-form""><table id=""yaml-inspect"">" &
"<tr class=""header""><td colspan=""2""><button id=""edit"" type=""button"">Edit</button><button id=""cancel"" type=""button"">Cancel</button>");
Write_Output_Radio ("Events");
Write_Output_Radio ("Canonical");
Write_Output_Radio ("Like Input");
Write_Output_Radio ("JSON");
Client.Accumulate_Body ("</td></tr>");
end Start_Emitting;
procedure Finish_Emitting is
begin
Client.Accumulate_Body ("</tr></table></form></body></html>");
end Finish_Emitting;
procedure Write_Escaped (Content : String) is
First_New : Positive := Content'First;
begin
for Cur in Content'Range loop
case Content (Cur) is
when '<' =>
if First_New < Cur then
Client.Accumulate_Body (Content (First_New .. Cur - 1));
end if;
First_New := Cur + 1;
Client.Accumulate_Body ("<");
when '>' =>
if First_New < Cur then
Client.Accumulate_Body (Content (First_New .. Cur - 1));
end if;
First_New := Cur + 1;
Client.Accumulate_Body ("<");
when others => null;
end case;
end loop;
if First_New <= Content'Last then
Client.Accumulate_Body (Content (First_New .. Content'Last));
end if;
end Write_Escaped;
procedure Start_Parsed_Input is
begin
Client.Accumulate_Body ("<tr><td id=""yaml-input""><textarea name=""input"" id=""editable-input"">");
Write_Escaped (Params.Input);
Client.Accumulate_Body ("</textarea><pre id=""rendered-input""><code>");
Next_Event_Id := 1;
end Start_Parsed_Input;
procedure End_Parsed_Input is
begin
Client.Accumulate_Body ("</code></pre></td>");
end End_Parsed_Input;
procedure Start_Parsed_Output is
begin
Client.Accumulate_Body ("<td id=""yaml-output""><pre><code>");
Next_Event_Id := 1;
end Start_Parsed_Output;
procedure End_Parsed_Output is
begin
Client.Accumulate_Body ("</td></tr>");
end End_Parsed_Output;
generic
Span_Class : String;
procedure Span_Emitter (Content : String);
procedure Span_Emitter (Content : String) is
begin
Client.Accumulate_Body ("<span class=""" & Span_Class & """>");
Write_Escaped (Content);
Client.Accumulate_Body ("</span>");
end Span_Emitter;
procedure Emit_Whitespace is new Span_Emitter ("whitespace");
procedure Emit_Comment is new Span_Emitter ("comment");
procedure Emit_Tag is new Span_Emitter ("tag");
procedure Emit_Anchor is new Span_Emitter ("anchor");
procedure Emit_Event_Content is new Span_Emitter ("content");
procedure Emit_Raw_Event (E : Event) is
begin
Client.Accumulate_Body
("<span class=""event event" & Ada.Strings.Fixed.Trim
(Next_Event_Id'Img, Ada.Strings.Left) & ' ' & E.Kind'Img & """>");
Client.Accumulate_Body (To_String (E));
Client.Accumulate_Body ("</span>" & Character'Val (10));
Next_Event_Id := Next_Event_Id + 1;
end Emit_Raw_Event;
procedure Start_Rendered_Event (E : Event) is
begin
Client.Accumulate_Body
("<span class=""event event" & Ada.Strings.Fixed.Trim
(Next_Event_Id'Img, Ada.Strings.Left) & ' ' & E.Kind'Img & """>");
end Start_Rendered_Event;
procedure End_Rendered_Event is
begin
Client.Accumulate_Body ("</span>");
Next_Event_Id := Next_Event_Id + 1;
end End_Rendered_Event;
procedure Emit_Unparseable is new Span_Emitter ("unparseable");
procedure Write_Error_Name_And_Message (Error_Name, Message : String) is
Last_Written : Natural := 0;
Cur : Positive := Message'First;
Cur_Column : Positive := 1;
Column_Start : Boolean := True;
begin
Client.Accumulate_Body ("<span class=""error-name"">");
Client.Accumulate_Body (Error_Name);
Client.Accumulate_Body (":</span>" & Character'Val (10) & " ");
loop
while Cur <= Message'Last and then Message (Cur) /= ' ' and then
Cur_Column <= 60 loop
Cur := Cur + 1;
Cur_Column := Cur_Column + 1;
end loop;
if Cur < Message'Last then
Write_Escaped (Message (Last_Written + 1 .. Message'Last));
exit;
elsif Cur <= Message'Last and then Message (Cur) = ' ' then
Write_Escaped (Message (Last_Written + 1 .. Cur));
Last_Written := Cur;
Column_Start := False;
elsif Column_Start then
Write_Escaped (Message (Last_Written + 1 .. Cur - 1));
Client.Accumulate_Body (Character'Val (10) & " ");
Last_Written := Cur - 1;
Cur_Column := 1;
else
Client.Accumulate_Body (Character'Val (10) & " ");
Cur_Column := 1;
Column_Start := True;
end if;
end loop;
Client.Accumulate_Body (Character'Val (10) & Character'Val (10));
end Write_Error_Name_And_Message;
procedure Emit_Lexer_Error (Token_Start, Error_Char : Mark;
Error_Message : String) is
Line_End : Positive;
begin
Write_Error_Name_And_Message ("Lexer_Error", Error_Message);
Write_Escaped (Params.Input (Token_Start.Index + 1 - Token_Start.Column .. Token_Start.Index - 1));
Client.Accumulate_Body ("<span class=""containing-token"">");
Write_Escaped (Params.Input (Token_Start.Index .. Error_Char.Index - 1));
Client.Accumulate_Body ("</span><span class=""illegal-character"">");
Write_Escaped (Params.Input (Error_Char.Index .. Error_Char.Index));
Client.Accumulate_Body ("</span>");
Line_End := Error_Char.Index + 1;
while Line_End <= Params.Input'Last and then
Params.Input (Line_End) /= Character'Val (10) loop
Line_End := Line_End + 1;
end loop;
Write_Escaped (Params.Input (Error_Char.Index + 1 .. Line_End - 1));
end Emit_Lexer_Error;
procedure Emit_Parser_Error (Token_Start, Token_End : Mark;
Error_Message : String) is
Line_End : Positive;
begin
Write_Error_Name_And_Message ("Parser_Error", Error_Message);
Write_Escaped (Params.Input (Token_Start.Index + 1 - Token_Start.Column .. Token_Start.Index - 1));
Client.Accumulate_Body ("<span class=""illegal-token"">");
Write_Escaped (Params.Input (Token_Start.Index .. Token_End.Index - 1));
Client.Accumulate_Body ("</span>");
Line_End := Token_End.Index;
while Line_End <= Params.Input'Last and then
Params.Input (Line_End) /= Character'Val (10) loop
Line_End := Line_End + 1;
end loop;
Write_Escaped (Params.Input (Token_End.Index .. Line_End - 1));
end Emit_Parser_Error;
procedure Inspect_HTML is new Yaml.Inspect;
begin
Inspect_HTML (Params.Input);
end Generate;
procedure Do_Get (Client : in out Yaml_Client) is
Status : HTTP.Status_Line renames Get_Status_Line (Client);
begin
Ada.Text_IO.Put_Line ("GET: " & Status.Kind'Img);
case Status.Kind is
when HTTP.None =>
Client.Reply_Text (404, "Not found", "Resource not found");
when HTTP.File =>
Ada.Text_IO.Put_Line ("File: " & Status.File);
Client.Send_Status_Line (200, "OK");
Client.Send_Date;
Client.Send_Server;
Client.Send_Content_Type ("text/html");
Generate (Client, Params (Status.File));
Client.Send_Body;
when HTTP.URI =>
Ada.Text_IO.Put_Line ("URI: " & Status.Path);
Ada.Text_IO.Put_Line ("Query: " & Status.Query);
Client.Send_Status_Line (200, "OK");
Client.Send_Date;
Client.Send_Server;
Client.Send_Content_Type ("text/html");
Generate (Client, Params (Status.Path));
Client.Send_Body;
end case;
exception when Error : others =>
Ada.Text_IO.Put_Line ("Got exception: " & Ada.Exceptions.Exception_Name (Error));
Ada.Text_IO.Put_Line ("Message: " & Ada.Exceptions.Exception_Message (Error));
raise;
end Do_Get;
end Yaml.Servers;
| 40.119718 | 159 | 0.56363 |
23e5a97d53734909ccce848da8e4a7cb982b8f33 | 306 | adb | Ada | gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/test_oconst.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/test_oconst.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/test_oconst.adb | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | -- { dg-do run }
with OCONST1, OCONST2, OCONST3, OCONST4, OCONST5;
procedure Test_Oconst is
begin
OCONST1.check (OCONST1.My_R);
OCONST2.check (OCONST2.My_R);
OCONST3.check (OCONST3.My_R);
OCONST4.check (OCONST4.My_R);
OCONST5.check (OCONST5.My_R0, 0);
OCONST5.check (OCONST5.My_R1, 1);
end;
| 21.857143 | 49 | 0.712418 |
dcbb33cc8af699d2cbd932cf1af1e089e5e155bc | 1,777 | adb | Ada | source/sets.adb | jquorning/CELLE | 0584a22bd48464c2727751fca9dbca079e217b0c | [
"blessing"
] | null | null | null | source/sets.adb | jquorning/CELLE | 0584a22bd48464c2727751fca9dbca079e217b0c | [
"blessing"
] | null | null | null | source/sets.adb | jquorning/CELLE | 0584a22bd48464c2727751fca9dbca079e217b0c | [
"blessing"
] | null | null | null | --
--
--
with Ada.Unchecked_Deallocation;
package body Sets is
Index_First : Index_Type := Index_Type'First;
Index_Last : Index_Type := Index_Type'First;
procedure Set_Range (First : in Index_Type;
Last : in Index_Type)
is
begin
Index_First := First;
Index_Last := Last;
end Set_Range;
function Set_New return Set_Type is
begin
return new Set_Array'(Index_First .. Index_Last => False);
end Set_New;
procedure Set_Free (Set : in out Set_Type) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => Set_Array,
Name => Set_Type);
begin
Free (Set);
end Set_Free;
function Set_Add (Set : in out Set_Type;
Item : in Index_Type) return Boolean
is
RV : Boolean;
begin
pragma Assert (Item >= Index_First);
pragma Assert (Item <= Index_Last);
RV := Set (Item);
Set (Item) := True;
return not RV;
end Set_Add;
function Set_Union (Set_1 : in out Set_Type;
Set_2 : in out Set_Type) return Boolean
is
Progress : Boolean;
begin
Progress := False;
for I in Index_First .. Index_Last loop
if Set_2 (I) then
if not Set_1 (I) then
Progress := True;
Set_1 (I) := True;
end if;
end if;
end loop;
return Progress;
end Set_Union;
function Set_Find (Set : in Set_Type;
Item : in Index_Type) return Boolean
is
begin
return Set (Item);
end Set_Find;
function First_Index return Index_Type is (Index_First);
function Last_Index return Index_Type is (Index_Last);
end Sets;
| 22.2125 | 64 | 0.573438 |
234898e28e9872048905d73fa66517b9d0734db1 | 2,272 | ads | Ada | resources/scripts/cert/facebookct.ads | mehrdad-shokri/amass | bf4df987c63d0509bf3e94cba2e4448855fc0805 | [
"Apache-2.0"
] | 1 | 2021-03-27T09:57:11.000Z | 2021-03-27T09:57:11.000Z | resources/scripts/cert/facebookct.ads | rishuranjanofficial/Amass | a7e3d07febafae6220032121a1b1c4f508e16ec0 | [
"Apache-2.0"
] | null | null | null | resources/scripts/cert/facebookct.ads | rishuranjanofficial/Amass | a7e3d07febafae6220032121a1b1c4f508e16ec0 | [
"Apache-2.0"
] | null | null | null | -- Copyright 2017 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 = "FacebookCT"
type = "cert"
function start()
setratelimit(20)
end
function vertical(ctx, domain)
if (api == nil or api.key == "" or api.secret == "") then
return
end
local dec
local resp
local cacheurl = queryurl_notoken(domain)
-- Check if the response data is in the graph database
if (api.ttl ~= nil and api.ttl > 0) then
resp = obtain_response(cacheurl, api.ttl)
end
if (resp == nil or resp == "") then
local err
resp, err = request({
url=authurl(api.key, api.secret),
headers={['Content-Type']="application/json"},
})
if (err ~= nil and err ~= "") then
return
end
dec = json.decode(resp)
if (dec == nil or dec.access_token == nil or dec.access_token == "") then
return
end
resp, err = request({
url=queryurl(domain, dec.access_token),
headers={['Content-Type']="application/json"},
})
if (err ~= nil and err ~= "") then
return
end
if (api.ttl ~= nil and api.ttl > 0) then
cache_response(cacheurl, resp)
end
end
dec = json.decode(resp)
if (dec == nil or #(dec.data) == 0) then
return
end
for i, r in pairs(dec.data) do
for j, name in pairs(r.domains) do
sendnames(ctx, name)
end
end
end
function authurl(id, secret)
return "https://graph.facebook.com/oauth/access_token?client_id=" .. id .. "&client_secret=" .. secret .. "&grant_type=client_credentials"
end
function queryurl(domain, token)
return "https://graph.facebook.com/certificates?fields=domains&access_token=" .. token .. "&query=*." .. domain
end
function queryurl_notoken(domain)
return "https://graph.facebook.com/certificates?fields=domains&query=*." .. domain
end
function sendnames(ctx, content)
local names = find(content, subdomainre)
if names == nil then
return
end
for i, v in pairs(names) do
newname(ctx, v)
end
end
| 25.52809 | 142 | 0.590229 |
Subsets and Splits